import java.util.List;
import java.util.concurrent.TimeUnit;
+import org.eclipse.jgit.errors.PackProtocolException;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Repository;
if (s.length() <= header.length()
|| !s.startsWith(header)
|| s.charAt(header.length()) != ' ') {
- throw new IOException(MessageFormat.format(
+ throw new PackProtocolException(MessageFormat.format(
JGitText.get().pushCertificateInvalidHeader, header));
}
return s.substring(header.length() + 1);
try {
version = parseHeader(pckIn, VERSION);
if (!version.equals(VERSION_0_1)) {
- throw new IOException(MessageFormat.format(
+ throw new PackProtocolException(MessageFormat.format(
JGitText.get().pushCertificateInvalidFieldValue, VERSION, version));
}
String pusherStr = parseHeader(pckIn, PUSHER);
pusher = RawParseUtils.parsePersonIdent(pusherStr);
if (pusher == null) {
- throw new IOException(MessageFormat.format(
+ throw new PackProtocolException(MessageFormat.format(
JGitText.get().pushCertificateInvalidFieldValue,
PUSHER, pusherStr));
}
receivedNonce = parseHeader(pckIn, NONCE);
// An empty line.
if (!pckIn.readString().isEmpty()) {
- throw new IOException(
+ throw new PackProtocolException(
JGitText.get().pushCertificateInvalidHeader);
}
} catch (EOFException eof) {
- throw new IOException(
+ throw new PackProtocolException(
JGitText.get().pushCertificateInvalidHeader, eof);
}
nonceStatus = nonceGenerator != null
}
signature = sig.toString();
if (!pckIn.readStringRaw().equals(END_CERT)) {
- throw new IOException(JGitText.get().pushCertificateInvalidSignature);
+ throw new PackProtocolException(
+ JGitText.get().pushCertificateInvalidSignature);
}
} catch (EOFException eof) {
- throw new IOException(
+ throw new PackProtocolException(
JGitText.get().pushCertificateInvalidSignature, eof);
}
}