Browse Source

Remove AmbiguousObjectException from BranchCreateCommand.call()

We wanted to wrap all LowLevel JGit excpetions into a
JGitInternalException so that users of this high-level interface
don't have to explicitly catch all of them. This
was forgotten on BranchCreateCommand.call() and I added
it.

Change-Id: Ie140e99574fb004137c66e80fb92eb6c6d0fa5e1
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
stable-0.10
Christian Halstrick 14 years ago
parent
commit
0a8d54c286
  1. 3
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BranchCommandTest.java
  2. 7
      org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java

3
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BranchCommandTest.java

@ -53,7 +53,6 @@ import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.api.errors.NotMergedException;
import org.eclipse.jgit.api.errors.RefAlreadyExistsException;
import org.eclipse.jgit.api.errors.RefNotFoundException;
import org.eclipse.jgit.errors.AmbiguousObjectException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefUpdate;
@ -404,7 +403,7 @@ public class BranchCommandTest extends RepositoryTestCase {
public Ref createBranch(Git actGit, String name, boolean force,
String startPoint, SetupUpstreamMode mode)
throws JGitInternalException, RefAlreadyExistsException,
AmbiguousObjectException, RefNotFoundException,
RefNotFoundException,
InvalidRefNameException {
CreateBranchCommand cmd = actGit.branchCreate();
cmd.setName(name);

7
org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java

@ -114,16 +114,13 @@ public class CreateBranchCommand extends GitCommand<Ref> {
* that already exists
* @throws RefNotFoundException
* if the start point can not be found
* @throws AmbiguousObjectException
* if the start point is ambiguous
* @throws InvalidRefNameException
* if the provided name is <code>null</code> or otherwise
* invalid
* @return the newly created branch
*/
public Ref call() throws JGitInternalException, RefAlreadyExistsException,
RefNotFoundException, AmbiguousObjectException,
InvalidRefNameException {
RefNotFoundException, InvalidRefNameException {
checkCallable();
processOptions();
try {
@ -267,8 +264,6 @@ public class CreateBranchCommand extends GitCommand<Ref> {
config.save();
}
return result;
} catch (AmbiguousObjectException e) {
throw e;
} catch (IOException ioe) {
throw new JGitInternalException(ioe.getMessage(), ioe);
}

Loading…
Cancel
Save