Browse Source

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
stable-4.1
Dave Borowitz 9 years ago
parent
commit
d8b9c5145b
  1. 7
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java

7
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;

Loading…
Cancel
Save