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
This commit is contained in:
Shawn Pearce 2016-07-04 18:26:53 -07:00
parent 5196798cb7
commit 61d444305e
1 changed files with 2 additions and 1 deletions

View File

@ -67,6 +67,7 @@
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 @@ static ReceiveCommand parseCommand(String line) throws PackProtocolException {
try {
oldId = ObjectId.fromString(oldStr);
newId = ObjectId.fromString(newStr);
} catch (IllegalArgumentException e) {
} catch (InvalidObjectIdException e) {
throw new PackProtocolException(
JGitText.get().errorInvalidProtocolWantedOldNewRef, e);
}