From d8b9c5145b0a728a520ff0cc02f6d20f333fa235 Mon Sep 17 00:00:00 2001 From: Dave Borowitz Date: Wed, 15 Jul 2015 17:55:17 -0700 Subject: [PATCH] BaseReceivePack: Don't throw from getPushCertificate() Rather than lazily parsing the push in this method, parse it at the end of recvCommands(), which already contains the necessary try/catch for handling this error. This allows later callers to avoid having to handle this condition superfluously. Change-Id: I5dcaf1a44bf4e321adc281e3381e7e17ac89db06 --- .../src/org/eclipse/jgit/transport/BaseReceivePack.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java index 518a3178f6..ca287f8bfb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java @@ -254,6 +254,7 @@ public abstract class BaseReceivePack { private PushCertificateParser pushCertificateParser; private SignedPushConfig signedPushConfig; + private PushCertificate pushCert; /** * Get the push certificate used to verify the pusher's identity. @@ -262,11 +263,10 @@ public abstract class BaseReceivePack { * * @return the parsed certificate, or null if push certificates are disabled * or no cert was presented by the client. - * @throws IOException if the certificate was present but invalid. * @since 4.1 */ - public PushCertificate getPushCertificate() throws IOException { - return getPushCertificateParser().build(); + public PushCertificate getPushCertificate() { + return pushCert; } /** @@ -1117,6 +1117,7 @@ public abstract class BaseReceivePack { certParser.addCommand(cmd); } } + pushCert = certParser.build(); } catch (PackProtocolException e) { sendError(e.getMessage()); throw e; -- 2.39.5