Browse Source

ReceivePack: Catch InvalidObjectIdException instead of IAE

The more specific type InvalidObjectIdException is thrown by
ObjectId.fromString().  Use it here in ReceivePack as the more
generic IAE is never thrown by the body of the try-catch block.

Change-Id: I53fc13c561c7d429a50b5eb82773f1a670431c54
stable-4.5
Shawn Pearce 9 years ago
parent
commit
61d444305e
  1. 3
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java

3
org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java

@ -67,6 +67,7 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.eclipse.jgit.errors.InvalidObjectIdException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.errors.PackProtocolException;
import org.eclipse.jgit.errors.TooLargePackException;
@ -1147,7 +1148,7 @@ public abstract class BaseReceivePack {
try {
oldId = ObjectId.fromString(oldStr);
newId = ObjectId.fromString(newStr);
} catch (IllegalArgumentException e) {
} catch (InvalidObjectIdException e) {
throw new PackProtocolException(
JGitText.get().errorInvalidProtocolWantedOldNewRef, e);
}

Loading…
Cancel
Save