]> source.dussan.org Git - jgit.git/commitdiff
Git API does not declare GitAPIException call() and related cleanups 00/6100/11
authorRobin Rosenberg <robin.rosenberg@dewire.com>
Wed, 30 May 2012 00:07:25 +0000 (02:07 +0200)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Wed, 30 May 2012 20:08:49 +0000 (22:08 +0200)
All commands should throw a GitAPIException so new exceptions can be
added without breaking the builds of old code, i.e. anyone that calls
a Git API should catch GitAPIException and not just the currently known
exceptions.

Now the only checked exceptions on Git API calls are GitException and
subclasses of it. New checked exceptions that are subclasses of
GitException may be added without breaking the API.

Javadoc for GitAPIException is declared on GitCommand and
inherited to subclasses. JGitInternalException is not explicitly
documented anymore.

Unfortunately this change itself breaks the API. The intention is
that it shall be possible to add new checked subclasses of
GitAPIException without breaking the API.

Bug: 366914
EGit-Change-Id: I50380f13fc82c22d0036f47c7859cc3a77e767c5
Change-Id: I50380f13fc82c22d0036f47c7859cc3a77e767c5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
63 files changed:
org.eclipse.jgit.ant/src/org/eclipse/jgit/ant/tasks/GitCloneTask.java
org.eclipse.jgit.ant/src/org/eclipse/jgit/ant/tasks/GitInitTask.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BranchCommandTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CheckoutCommandTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CleanCommandTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitAndLogCommandTests.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/GitConstructionTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/InitCommandTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ResetCommandTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RmCommandTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StatusCommandTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutMaliciousPathTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleAddTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleInitTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleStatusTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleSyncTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleUpdateTest.java
org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/AddNoteCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteTagCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/GitCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/ListBranchCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/ListNotesCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/ListTagCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/ReflogCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/RemoveNoteCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/RmCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/ShowNoteCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/StashDropCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/StashListCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/StatusCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleStatusCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/errors/UnmergedPathsException.java

index f40b7b1e2326e22cd290aeea8299c7ed851c3e6b..8d12ce3ad4e1208b318c31fbb060a214a23ce83a 100644 (file)
@@ -110,7 +110,7 @@ public class GitCloneTask extends Task {
                try {
                        clone.setURI(uri).setDirectory(destination).setBranch(branch).setBare(bare);
                        clone.call();
-               } catch (RuntimeException e) {
+               } catch (Exception e) {
                        log("Could not clone repository: " + e, e, Project.MSG_ERR);
                        throw new BuildException("Could not clone repository: " + e.getMessage(), e);
                }
index 7b1610eebe31562d9210333ab93155ec9c0fd1d7..efdab42aaaa15b61e46c4c8223cacb0a1507c736 100644 (file)
@@ -91,7 +91,7 @@ public class GitInitTask extends Task {
                        InitCommand init = Git.init();
                        init.setBare(bare).setDirectory(destination);
                        init.call();
-               } catch (JGitInternalException e) {
+               } catch (Exception e) {
                        throw new BuildException("Could not initialize repository", e);
                }
        }
index 2fb228e01de93340cf0c684b782e96759fad773e..fd74098496bb55a4da688c6321ca6e0d4b724304 100644 (file)
@@ -52,6 +52,7 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.PrintWriter;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.NoFilepatternException;
 import org.eclipse.jgit.dircache.DirCache;
 import org.eclipse.jgit.dircache.DirCacheBuilder;
@@ -72,7 +73,7 @@ import org.junit.Test;
 public class AddCommandTest extends RepositoryTestCase {
 
        @Test
-       public void testAddNothing() {
+       public void testAddNothing() throws GitAPIException {
                Git git = new Git(db);
 
                try {
@@ -85,7 +86,7 @@ public class AddCommandTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testAddNonExistingSingleFile() throws NoFilepatternException {
+       public void testAddNonExistingSingleFile() throws GitAPIException {
                Git git = new Git(db);
 
                DirCache dc = git.add().addFilepattern("a.txt").call();
@@ -94,7 +95,7 @@ public class AddCommandTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testAddExistingSingleFile() throws IOException, NoFilepatternException {
+       public void testAddExistingSingleFile() throws IOException, GitAPIException {
                File file = new File(db.getWorkTree(), "a.txt");
                FileUtils.createNewFile(file);
                PrintWriter writer = new PrintWriter(file);
@@ -112,7 +113,7 @@ public class AddCommandTest extends RepositoryTestCase {
 
        @Test
        public void testAddExistingSingleSmallFileWithNewLine() throws IOException,
-                       NoFilepatternException {
+                       GitAPIException {
                File file = new File(db.getWorkTree(), "a.txt");
                FileUtils.createNewFile(file);
                PrintWriter writer = new PrintWriter(file);
@@ -136,7 +137,7 @@ public class AddCommandTest extends RepositoryTestCase {
 
        @Test
        public void testAddExistingSingleMediumSizeFileWithNewLine()
-                       throws IOException, NoFilepatternException {
+                       throws IOException, GitAPIException {
                File file = new File(db.getWorkTree(), "a.txt");
                FileUtils.createNewFile(file);
                StringBuilder data = new StringBuilder();
@@ -165,7 +166,7 @@ public class AddCommandTest extends RepositoryTestCase {
 
        @Test
        public void testAddExistingSingleBinaryFile() throws IOException,
-                       NoFilepatternException {
+                       GitAPIException {
                File file = new File(db.getWorkTree(), "a.txt");
                FileUtils.createNewFile(file);
                PrintWriter writer = new PrintWriter(file);
@@ -188,7 +189,8 @@ public class AddCommandTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testAddExistingSingleFileInSubDir() throws IOException, NoFilepatternException {
+       public void testAddExistingSingleFileInSubDir() throws IOException,
+                       GitAPIException {
                FileUtils.mkdir(new File(db.getWorkTree(), "sub"));
                File file = new File(db.getWorkTree(), "sub/a.txt");
                FileUtils.createNewFile(file);
@@ -206,7 +208,8 @@ public class AddCommandTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testAddExistingSingleFileTwice() throws IOException, NoFilepatternException {
+       public void testAddExistingSingleFileTwice() throws IOException,
+                       GitAPIException {
                File file = new File(db.getWorkTree(), "a.txt");
                FileUtils.createNewFile(file);
                PrintWriter writer = new PrintWriter(file);
index 32d2e01b24efeabb4429f54f351ea45bd7eee047..b000fe24e5cdd7aabce045127cf3bf51a57293b9 100644 (file)
@@ -466,9 +466,7 @@ public class BranchCommandTest extends RepositoryTestCase {
 
        public Ref createBranch(Git actGit, String name, boolean force,
                        String startPoint, SetupUpstreamMode mode)
-                       throws JGitInternalException, RefAlreadyExistsException,
-                       RefNotFoundException,
-                       InvalidRefNameException {
+                       throws JGitInternalException, GitAPIException {
                CreateBranchCommand cmd = actGit.branchCreate();
                cmd.setName(name);
                cmd.setForce(force);
index a51a8b4697a7d036e5c844623eaee8ee8e9df93f..9060cd5307d4d22bd340bd166d4dc76b020c86e1 100644 (file)
@@ -56,10 +56,8 @@ import java.io.FileInputStream;
 import java.io.IOException;
 
 import org.eclipse.jgit.api.CheckoutResult.Status;
-import org.eclipse.jgit.api.errors.CheckoutConflictException;
-import org.eclipse.jgit.api.errors.InvalidRefNameException;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
-import org.eclipse.jgit.api.errors.RefAlreadyExistsException;
 import org.eclipse.jgit.api.errors.RefNotFoundException;
 import org.eclipse.jgit.dircache.DirCache;
 import org.eclipse.jgit.dircache.DirCacheEntry;
@@ -129,9 +127,7 @@ public class CheckoutCommandTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testCheckoutToNonExistingBranch() throws JGitInternalException,
-                       RefAlreadyExistsException, InvalidRefNameException,
-                       CheckoutConflictException {
+       public void testCheckoutToNonExistingBranch() throws GitAPIException {
                try {
                        git.checkout().setName("badbranch").call();
                        fail("Should have failed");
@@ -225,8 +221,7 @@ public class CheckoutCommandTest extends RepositoryTestCase {
 
        @Test
        public void testDetachedHeadOnCheckout() throws JGitInternalException,
-                       RefAlreadyExistsException, RefNotFoundException,
-                       InvalidRefNameException, IOException, CheckoutConflictException {
+                       IOException, GitAPIException {
                CheckoutCommand co = git.checkout();
                co.setName("master").call();
 
index a660a5292b5428efaeb842804829bb152dffb939..07387e4fa6968ef5bf532b91d7ce32bdc8559bb4 100644 (file)
@@ -44,10 +44,10 @@ package org.eclipse.jgit.api;
 
 import static org.junit.Assert.assertTrue;
 
-import java.io.IOException;
 import java.util.Set;
 import java.util.TreeSet;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.errors.NoWorkTreeException;
 import org.eclipse.jgit.lib.RepositoryTestCase;
 import org.junit.Before;
@@ -75,7 +75,7 @@ public class CleanCommandTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testClean() throws NoWorkTreeException, IOException {
+       public void testClean() throws NoWorkTreeException, GitAPIException {
                // create status
                StatusCommand command = git.status();
                Status status = command.call();
@@ -94,7 +94,8 @@ public class CleanCommandTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testCleanWithPaths() throws NoWorkTreeException, IOException {
+       public void testCleanWithPaths() throws NoWorkTreeException,
+                       GitAPIException {
                // create status
                StatusCommand command = git.status();
                Status status = command.call();
@@ -114,7 +115,8 @@ public class CleanCommandTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testCleanWithDryRun() throws NoWorkTreeException, IOException {
+       public void testCleanWithDryRun() throws NoWorkTreeException,
+                       GitAPIException {
                // create status
                StatusCommand command = git.status();
                Status status = command.call();
index 906a8966fa2f15ac6e45cf5b5cb56ebe9743fb07..4441ea93012370e1bd234d38d5319cbe65bee86e 100644 (file)
@@ -55,6 +55,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.eclipse.jgit.api.ListBranchCommand.ListMode;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.junit.TestRepository;
 import org.eclipse.jgit.lib.ConfigConstants;
@@ -103,7 +104,8 @@ public class CloneCommandTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testCloneRepository() throws IOException {
+       public void testCloneRepository() throws IOException,
+                       JGitInternalException, GitAPIException {
                File directory = createTempDirectory("testCloneRepository");
                CloneCommand command = Git.cloneRepository();
                command.setDirectory(directory);
@@ -131,7 +133,8 @@ public class CloneCommandTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testCloneRepositoryWithBranch() throws IOException {
+       public void testCloneRepositoryWithBranch() throws IOException,
+                       JGitInternalException, GitAPIException {
                File directory = createTempDirectory("testCloneRepositoryWithBranch");
                CloneCommand command = Git.cloneRepository();
                command.setBranch("refs/heads/master");
@@ -178,7 +181,8 @@ public class CloneCommandTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testCloneRepositoryOnlyOneBranch() throws IOException {
+       public void testCloneRepositoryOnlyOneBranch() throws IOException,
+                       JGitInternalException, GitAPIException {
                File directory = createTempDirectory("testCloneRepositoryWithBranch");
                CloneCommand command = Git.cloneRepository();
                command.setBranch("refs/heads/master");
@@ -222,7 +226,7 @@ public class CloneCommandTest extends RepositoryTestCase {
 
        @Test
        public void testCloneRepositoryWhenDestinationDirectoryExistsAndIsNotEmpty()
-                       throws IOException {
+                       throws IOException, JGitInternalException, GitAPIException {
                String dirName = "testCloneTargetDirectoryNotEmpty";
                File directory = createTempDirectory(dirName);
                CloneCommand command = Git.cloneRepository();
index e6b6a096fa092e36411e4d7907de6b30127cb99c..ed32e27b0a7c0cd3b25e8893acaa635fd98e4136 100644 (file)
@@ -50,15 +50,12 @@ import static org.junit.Assert.fail;
 import java.io.File;
 import java.io.IOException;
 import java.io.PrintWriter;
-import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
+
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
-import org.eclipse.jgit.api.errors.NoFilepatternException;
-import org.eclipse.jgit.api.errors.NoHeadException;
 import org.eclipse.jgit.api.errors.NoMessageException;
-import org.eclipse.jgit.api.errors.WrongRepositoryStateException;
 import org.eclipse.jgit.errors.IncorrectObjectTypeException;
 import org.eclipse.jgit.errors.MissingObjectException;
-import org.eclipse.jgit.errors.UnmergedPathException;
 import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.lib.PersonIdent;
@@ -77,9 +74,8 @@ import org.junit.Test;
  */
 public class CommitAndLogCommandTests extends RepositoryTestCase {
        @Test
-       public void testSomeCommits() throws NoHeadException, NoMessageException,
-                       ConcurrentRefUpdateException, JGitInternalException,
-                       WrongRepositoryStateException, IOException {
+       public void testSomeCommits() throws JGitInternalException, IOException,
+                       GitAPIException {
 
                // do 4 commits
                Git git = new Git(db);
@@ -115,9 +111,8 @@ public class CommitAndLogCommandTests extends RepositoryTestCase {
        }
 
        @Test
-       public void testLogWithFilter() throws IOException, NoFilepatternException,
-                       NoHeadException, NoMessageException, ConcurrentRefUpdateException,
-                       JGitInternalException, WrongRepositoryStateException {
+       public void testLogWithFilter() throws IOException, JGitInternalException,
+                       GitAPIException {
 
                Git git = new Git(db);
 
@@ -170,9 +165,7 @@ public class CommitAndLogCommandTests extends RepositoryTestCase {
 
        // try to do a commit without specifying a message. Should fail!
        @Test
-       public void testWrongParams() throws UnmergedPathException,
-                       NoHeadException, ConcurrentRefUpdateException,
-                       JGitInternalException, WrongRepositoryStateException {
+       public void testWrongParams() throws GitAPIException {
                Git git = new Git(db);
                try {
                        git.commit().setAuthor(author).call();
@@ -185,10 +178,7 @@ public class CommitAndLogCommandTests extends RepositoryTestCase {
        // try to work with Commands after command has been invoked. Should throw
        // exceptions
        @Test
-       public void testMultipleInvocations() throws NoHeadException,
-                       ConcurrentRefUpdateException, NoMessageException,
-                       UnmergedPathException, JGitInternalException,
-                       WrongRepositoryStateException {
+       public void testMultipleInvocations() throws GitAPIException {
                Git git = new Git(db);
                CommitCommand commitCmd = git.commit();
                commitCmd.setMessage("initial commit").call();
@@ -211,9 +201,8 @@ public class CommitAndLogCommandTests extends RepositoryTestCase {
        }
 
        @Test
-       public void testMergeEmptyBranches() throws IOException, NoHeadException,
-                       NoMessageException, ConcurrentRefUpdateException,
-                       JGitInternalException, WrongRepositoryStateException {
+       public void testMergeEmptyBranches() throws IOException,
+                       JGitInternalException, GitAPIException {
                Git git = new Git(db);
                git.commit().setMessage("initial commit").call();
                RefUpdate r = db.updateRef("refs/heads/side");
@@ -235,10 +224,8 @@ public class CommitAndLogCommandTests extends RepositoryTestCase {
        }
 
        @Test
-       public void testAddUnstagedChanges() throws IOException, NoHeadException,
-                       NoMessageException, ConcurrentRefUpdateException,
-                       JGitInternalException, WrongRepositoryStateException,
-                       NoFilepatternException {
+       public void testAddUnstagedChanges() throws IOException,
+                       JGitInternalException, GitAPIException {
                File file = new File(db.getWorkTree(), "a.txt");
                FileUtils.createNewFile(file);
                PrintWriter writer = new PrintWriter(file);
@@ -268,9 +255,7 @@ public class CommitAndLogCommandTests extends RepositoryTestCase {
        }
 
        @Test
-       public void testModeChange() throws IOException, NoFilepatternException,
-                       NoHeadException, NoMessageException, ConcurrentRefUpdateException,
-                       JGitInternalException, WrongRepositoryStateException {
+       public void testModeChange() throws IOException, GitAPIException {
                Git git = new Git(db);
 
                // create file
@@ -298,10 +283,9 @@ public class CommitAndLogCommandTests extends RepositoryTestCase {
        }
 
        @Test
-       public void testCommitRange() throws NoHeadException, NoMessageException,
-                       UnmergedPathException, ConcurrentRefUpdateException,
-                       JGitInternalException, WrongRepositoryStateException,
-                       IncorrectObjectTypeException, MissingObjectException {
+       public void testCommitRange() throws GitAPIException,
+                       JGitInternalException, MissingObjectException,
+                       IncorrectObjectTypeException {
                // do 4 commits and set the range to the second and fourth one
                Git git = new Git(db);
                git.commit().setMessage("first commit").call();
@@ -334,9 +318,8 @@ public class CommitAndLogCommandTests extends RepositoryTestCase {
        }
 
        @Test
-       public void testCommitAmend() throws NoHeadException, NoMessageException,
-                       ConcurrentRefUpdateException, JGitInternalException,
-                       WrongRepositoryStateException, IOException {
+       public void testCommitAmend() throws JGitInternalException, IOException,
+                       GitAPIException {
                Git git = new Git(db);
                git.commit().setMessage("first comit").call(); // typo
                git.commit().setAmend(true).setMessage("first commit").call();
@@ -357,10 +340,8 @@ public class CommitAndLogCommandTests extends RepositoryTestCase {
        }
 
        @Test
-       public void testInsertChangeId() throws NoHeadException,
-                       NoMessageException,
-                       UnmergedPathException, ConcurrentRefUpdateException,
-                       JGitInternalException, WrongRepositoryStateException {
+       public void testInsertChangeId() throws JGitInternalException,
+                       GitAPIException {
                Git git = new Git(db);
                String messageHeader = "Some header line\n\nSome detail explanation\n";
                String changeIdTemplate = "\nChange-Id: I"
index 8031769204bb5250e5a3195864baedd876891512..d8e1a058f76f98e38f789e466e7634e7cb850439 100644 (file)
@@ -48,6 +48,8 @@ import static org.junit.Assert.fail;
 import java.io.IOException;
 
 import org.eclipse.jgit.api.ListBranchCommand.ListMode;
+import org.eclipse.jgit.api.errors.GitAPIException;
+import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.errors.RepositoryNotFoundException;
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.lib.RepositoryTestCase;
@@ -84,7 +86,7 @@ public class GitConstructionTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testWrap() {
+       public void testWrap() throws JGitInternalException, GitAPIException {
                Git git = Git.wrap(db);
                assertEquals(1, git.branchList().call().size());
 
@@ -101,7 +103,8 @@ public class GitConstructionTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testOpen() throws IOException {
+       public void testOpen() throws IOException, JGitInternalException,
+                       GitAPIException {
                Git git = Git.open(db.getDirectory());
                assertEquals(1, git.branchList().call().size());
 
index 28236369e484fac513c81f7010b7cda8ee998a11..7db9ce71c13fd202d2ae74eb12dade978e62b07f 100644 (file)
@@ -48,6 +48,8 @@ import static org.junit.Assert.assertTrue;
 import java.io.File;
 import java.io.IOException;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
+import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.lib.RepositoryTestCase;
 import org.junit.Before;
@@ -62,7 +64,8 @@ public class InitCommandTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testInitRepository() throws IOException {
+       public void testInitRepository() throws IOException, JGitInternalException,
+                       GitAPIException {
                File directory = createTempDirectory("testInitRepository");
                InitCommand command = new InitCommand();
                command.setDirectory(directory);
@@ -72,7 +75,8 @@ public class InitCommandTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testInitNonEmptyRepository() throws IOException {
+       public void testInitNonEmptyRepository() throws IOException,
+                       JGitInternalException, GitAPIException {
                File directory = createTempDirectory("testInitRepository2");
                File someFile = new File(directory, "someFile");
                someFile.createNewFile();
@@ -86,7 +90,8 @@ public class InitCommandTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testInitBareRepository() throws IOException {
+       public void testInitBareRepository() throws IOException,
+                       JGitInternalException, GitAPIException {
                File directory = createTempDirectory("testInitBareRepository");
                InitCommand command = new InitCommand();
                command.setDirectory(directory);
index 3087ca829bf4a4ebdda4ac55fc090c21a7a8cd86..f16d436d94f78b9fc0b079c82cd9cd7e90eb76f6 100644 (file)
@@ -54,12 +54,8 @@ import java.io.IOException;
 import java.io.PrintWriter;
 
 import org.eclipse.jgit.api.ResetCommand.ResetType;
-import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
-import org.eclipse.jgit.api.errors.NoFilepatternException;
-import org.eclipse.jgit.api.errors.NoHeadException;
-import org.eclipse.jgit.api.errors.NoMessageException;
-import org.eclipse.jgit.api.errors.WrongRepositoryStateException;
 import org.eclipse.jgit.dircache.DirCache;
 import org.eclipse.jgit.dircache.DirCacheEntry;
 import org.eclipse.jgit.errors.AmbiguousObjectException;
@@ -87,9 +83,8 @@ public class ResetCommandTest extends RepositoryTestCase {
 
        private DirCacheEntry prestage;
 
-       public void setupRepository() throws IOException, NoFilepatternException,
-                       NoHeadException, NoMessageException, ConcurrentRefUpdateException,
-                       JGitInternalException, WrongRepositoryStateException {
+       public void setupRepository() throws IOException, JGitInternalException,
+                       GitAPIException {
 
                // create initial commit
                git = new Git(db);
@@ -138,9 +133,7 @@ public class ResetCommandTest extends RepositoryTestCase {
 
        @Test
        public void testHardReset() throws JGitInternalException,
-                       AmbiguousObjectException, IOException, NoFilepatternException,
-                       NoHeadException, NoMessageException, ConcurrentRefUpdateException,
-                       WrongRepositoryStateException {
+                       AmbiguousObjectException, IOException, GitAPIException {
                setupRepository();
                ObjectId prevHead = db.resolve(Constants.HEAD);
                git.reset().setMode(ResetType.HARD).setRef(initialCommit.getName())
@@ -160,7 +153,7 @@ public class ResetCommandTest extends RepositoryTestCase {
 
        @Test
        public void testResetToNonexistingHEAD() throws JGitInternalException,
-                       AmbiguousObjectException, IOException {
+                       AmbiguousObjectException, IOException, GitAPIException {
 
                // create a file in the working tree of a fresh repo
                git = new Git(db);
@@ -176,9 +169,7 @@ public class ResetCommandTest extends RepositoryTestCase {
 
        @Test
        public void testSoftReset() throws JGitInternalException,
-                       AmbiguousObjectException, IOException, NoFilepatternException,
-                       NoHeadException, NoMessageException, ConcurrentRefUpdateException,
-                       WrongRepositoryStateException {
+                       AmbiguousObjectException, IOException, GitAPIException {
                setupRepository();
                ObjectId prevHead = db.resolve(Constants.HEAD);
                git.reset().setMode(ResetType.SOFT).setRef(initialCommit.getName())
@@ -198,9 +189,7 @@ public class ResetCommandTest extends RepositoryTestCase {
 
        @Test
        public void testMixedReset() throws JGitInternalException,
-                       AmbiguousObjectException, IOException, NoFilepatternException,
-                       NoHeadException, NoMessageException, ConcurrentRefUpdateException,
-                       WrongRepositoryStateException {
+                       AmbiguousObjectException, IOException, GitAPIException {
                setupRepository();
                ObjectId prevHead = db.resolve(Constants.HEAD);
                git.reset().setMode(ResetType.MIXED).setRef(initialCommit.getName())
index d826b4c13545221527811d473e4c14375ddbf63f..2eb4f22940b5553c791b7402bf226148bee43fec 100644 (file)
@@ -46,8 +46,8 @@ import static org.junit.Assert.assertEquals;
 
 import java.io.IOException;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
-import org.eclipse.jgit.api.errors.NoFilepatternException;
 import org.eclipse.jgit.lib.RepositoryTestCase;
 import org.junit.Before;
 import org.junit.Test;
@@ -71,7 +71,7 @@ public class RmCommandTest extends RepositoryTestCase {
 
        @Test
        public void testRemove() throws JGitInternalException,
-                       NoFilepatternException, IllegalStateException, IOException {
+                       IllegalStateException, IOException, GitAPIException {
                assertEquals("[test.txt, mode:100644, content:Hello world]",
                                indexState(CONTENT));
                RmCommand command = git.rm();
index faca7ea3abec5ac44deb214ae0d7247f2297e64e..c9a6048695155f4b148c1653790b53df927bf709 100644 (file)
@@ -52,13 +52,15 @@ import java.util.Set;
 
 import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.NoFilepatternException;
+import org.eclipse.jgit.errors.NoWorkTreeException;
 import org.eclipse.jgit.lib.RepositoryTestCase;
 import org.junit.Test;
 
 public class StatusCommandTest extends RepositoryTestCase {
 
        @Test
-       public void testEmptyStatus() throws IOException {
+       public void testEmptyStatus() throws NoWorkTreeException,
+                       GitAPIException {
                Git git = new Git(db);
 
                Status stat = git.status().call();
index 7f381e3932244fe5e622b19cebf5ebb083f2df0a..b417b44851039ab6c155003203c58f1d9f8709cb 100644 (file)
@@ -48,15 +48,9 @@ import static org.junit.Assert.fail;
 import java.io.IOException;
 import java.util.List;
 
-import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.InvalidTagNameException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
-import org.eclipse.jgit.api.errors.NoHeadException;
-import org.eclipse.jgit.api.errors.NoMessageException;
-import org.eclipse.jgit.api.errors.WrongRepositoryStateException;
-import org.eclipse.jgit.errors.IncorrectObjectTypeException;
-import org.eclipse.jgit.errors.MissingObjectException;
-import org.eclipse.jgit.errors.UnmergedPathException;
 import org.eclipse.jgit.lib.Ref;
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.lib.RepositoryTestCase;
@@ -67,10 +61,7 @@ import org.junit.Test;
 public class TagCommandTest extends RepositoryTestCase {
 
        @Test
-       public void testTaggingOnHead() throws NoHeadException, NoMessageException,
-                       ConcurrentRefUpdateException, JGitInternalException,
-                       WrongRepositoryStateException, InvalidTagNameException,
-                       MissingObjectException, IncorrectObjectTypeException, IOException {
+       public void testTaggingOnHead() throws GitAPIException, IOException {
                Git git = new Git(db);
                RevCommit commit = git.commit().setMessage("initial commit").call();
                Ref tagRef = git.tag().setName("tag").call();
@@ -80,10 +71,7 @@ public class TagCommandTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testTagging() throws NoHeadException, NoMessageException,
-                       UnmergedPathException, ConcurrentRefUpdateException,
-                       JGitInternalException, WrongRepositoryStateException,
-                       InvalidTagNameException {
+       public void testTagging() throws GitAPIException, JGitInternalException {
                Git git = new Git(db);
                git.commit().setMessage("initial commit").call();
                RevCommit commit = git.commit().setMessage("second commit").call();
@@ -93,9 +81,7 @@ public class TagCommandTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testEmptyTagName() throws NoHeadException, NoMessageException,
-                       UnmergedPathException, ConcurrentRefUpdateException,
-                       JGitInternalException, WrongRepositoryStateException {
+       public void testEmptyTagName() throws GitAPIException {
                Git git = new Git(db);
                git.commit().setMessage("initial commit").call();
                try {
@@ -108,10 +94,7 @@ public class TagCommandTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testInvalidTagName() throws NoHeadException,
-                       NoMessageException, UnmergedPathException,
-                       ConcurrentRefUpdateException, JGitInternalException,
-                       WrongRepositoryStateException {
+       public void testInvalidTagName() throws GitAPIException {
                Git git = new Git(db);
                git.commit().setMessage("initial commit").call();
                try {
@@ -123,10 +106,7 @@ public class TagCommandTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testFailureOnSignedTags() throws NoHeadException,
-                       NoMessageException, UnmergedPathException,
-                       ConcurrentRefUpdateException, JGitInternalException,
-                       WrongRepositoryStateException, InvalidTagNameException {
+       public void testFailureOnSignedTags() throws GitAPIException {
                Git git = new Git(db);
                git.commit().setMessage("initial commit").call();
                try {
index 65d0418b33830972f12f8d584d7cb93074b32430..fb9cc2cbfcaa527918fc11f24c2dc716f644c893 100644 (file)
@@ -46,14 +46,8 @@ import java.io.IOException;
 import java.util.Arrays;
 
 import org.eclipse.jgit.api.Git;
-import org.eclipse.jgit.api.errors.CheckoutConflictException;
-import org.eclipse.jgit.api.errors.InvalidRefNameException;
-import org.eclipse.jgit.api.errors.JGitInternalException;
-import org.eclipse.jgit.api.errors.RefAlreadyExistsException;
-import org.eclipse.jgit.api.errors.RefNotFoundException;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.dircache.InvalidPathException;
-import org.eclipse.jgit.errors.IncorrectObjectTypeException;
-import org.eclipse.jgit.errors.MissingObjectException;
 import org.eclipse.jgit.junit.MockSystemReader;
 import org.eclipse.jgit.revwalk.RevWalk;
 import org.eclipse.jgit.util.SystemReader;
@@ -338,20 +332,11 @@ public class DirCacheCheckoutMaliciousPathTest extends RepositoryTestCase {
         *            perform the actual test on the second checkout
         * @param path
         *            to the blob, one or more levels
+        * @throws GitAPIException
         * @throws IOException
-        * @throws RefAlreadyExistsException
-        * @throws RefNotFoundException
-        * @throws InvalidRefNameException
-        * @throws MissingObjectException
-        * @throws IncorrectObjectTypeException
-        * @throws CheckoutConflictException
-        * @throws JGitInternalException
         */
-       private void testMaliciousPath(boolean good, boolean secondCheckout, String... path)
-                       throws IOException, RefAlreadyExistsException,
-                       RefNotFoundException, InvalidRefNameException,
-                       MissingObjectException, IncorrectObjectTypeException,
-                       JGitInternalException, CheckoutConflictException {
+       private void testMaliciousPath(boolean good, boolean secondCheckout,
+                       String... path) throws GitAPIException, IOException {
                Git git = new Git(db);
                ObjectInserter newObjectInserter;
                newObjectInserter = git.getRepository().newObjectInserter();
index b7caecc2c29d05a1182a7f93937d496bbbc5c81d..dde32d7e9fc1c3a1516e3f07e7e0b481b4bf4a89 100644 (file)
@@ -59,7 +59,7 @@ import java.util.TreeSet;
 import org.eclipse.jgit.api.Git;
 import org.eclipse.jgit.api.MergeResult;
 import org.eclipse.jgit.api.MergeResult.MergeStatus;
-import org.eclipse.jgit.api.errors.NoFilepatternException;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.dircache.DirCache;
 import org.eclipse.jgit.dircache.DirCacheEditor;
 import org.eclipse.jgit.dircache.DirCacheEditor.PathEdit;
@@ -139,7 +139,7 @@ public class IndexDiffTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testModified() throws IOException, NoFilepatternException {
+       public void testModified() throws IOException, GitAPIException {
 
                writeTrashFile("file2", "file2");
                writeTrashFile("dir/file3", "dir/file3");
@@ -291,8 +291,7 @@ public class IndexDiffTest extends RepositoryTestCase {
        }
 
        @Test
-       public void testUnchangedSimple() throws IOException,
-                       NoFilepatternException {
+       public void testUnchangedSimple() throws IOException, GitAPIException {
                writeTrashFile("a.b", "a.b");
                writeTrashFile("a.c", "a.c");
                writeTrashFile("a=c", "a=c");
@@ -328,11 +327,10 @@ public class IndexDiffTest extends RepositoryTestCase {
         * used by Git.
         *
         * @throws IOException
-        * @throws NoFilepatternException
+        * @throws GitAPIException
         */
        @Test
-       public void testUnchangedComplex() throws IOException,
-                       NoFilepatternException {
+       public void testUnchangedComplex() throws IOException, GitAPIException {
                Git git = new Git(db);
                writeTrashFile("a.b", "a.b");
                writeTrashFile("a.c", "a.c");
index 568cd9e2bc56ab08fc7f869a0bd5ee00f69361cc..940a78ac4f106d6fa877a93d42ecce49fc454a32 100644 (file)
@@ -53,6 +53,7 @@ import java.text.MessageFormat;
 import org.eclipse.jgit.api.Git;
 import org.eclipse.jgit.api.Status;
 import org.eclipse.jgit.api.SubmoduleAddCommand;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.dircache.DirCache;
 import org.eclipse.jgit.dircache.DirCacheEditor;
@@ -75,7 +76,7 @@ import org.junit.Test;
 public class SubmoduleAddTest extends RepositoryTestCase {
 
        @Test
-       public void commandWithNullPath() {
+       public void commandWithNullPath() throws GitAPIException {
                try {
                        new SubmoduleAddCommand(db).setURI("uri").call();
                        fail("Exception not thrown");
@@ -85,7 +86,7 @@ public class SubmoduleAddTest extends RepositoryTestCase {
        }
 
        @Test
-       public void commandWithEmptyPath() {
+       public void commandWithEmptyPath() throws GitAPIException {
                try {
                        new SubmoduleAddCommand(db).setPath("").setURI("uri").call();
                        fail("Exception not thrown");
@@ -95,7 +96,7 @@ public class SubmoduleAddTest extends RepositoryTestCase {
        }
 
        @Test
-       public void commandWithNullUri() {
+       public void commandWithNullUri() throws GitAPIException {
                try {
                        new SubmoduleAddCommand(db).setPath("sub").call();
                        fail("Exception not thrown");
@@ -105,7 +106,7 @@ public class SubmoduleAddTest extends RepositoryTestCase {
        }
 
        @Test
-       public void commandWithEmptyUri() {
+       public void commandWithEmptyUri() throws GitAPIException {
                try {
                        new SubmoduleAddCommand(db).setPath("sub").setURI("").call();
                        fail("Exception not thrown");
index f0a0750c5c1f99f50c99ad639486ea180919fb14..424ad01fcbbb871b7cb13f3546f4015aa331cac2 100644 (file)
@@ -53,6 +53,7 @@ import java.io.IOException;
 import java.util.Collection;
 
 import org.eclipse.jgit.api.SubmoduleInitCommand;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.dircache.DirCache;
 import org.eclipse.jgit.dircache.DirCacheEditor;
@@ -73,7 +74,7 @@ import org.junit.Test;
 public class SubmoduleInitTest extends RepositoryTestCase {
 
        @Test
-       public void repositoryWithNoSubmodules() {
+       public void repositoryWithNoSubmodules() throws GitAPIException {
                SubmoduleInitCommand command = new SubmoduleInitCommand(db);
                Collection<String> modules = command.call();
                assertNotNull(modules);
@@ -82,7 +83,7 @@ public class SubmoduleInitTest extends RepositoryTestCase {
 
        @Test
        public void repositoryWithUninitializedModule() throws IOException,
-                       ConfigInvalidException {
+                       ConfigInvalidException, GitAPIException {
                final String path = addSubmoduleToIndex();
 
                SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
@@ -156,7 +157,7 @@ public class SubmoduleInitTest extends RepositoryTestCase {
 
        @Test
        public void resolveOneLevelHigherRelativeUrl() throws IOException,
-                       ConfigInvalidException {
+                       ConfigInvalidException, GitAPIException {
                final String path = addSubmoduleToIndex();
 
                String base = "git://server/repo.git";
@@ -197,7 +198,7 @@ public class SubmoduleInitTest extends RepositoryTestCase {
 
        @Test
        public void resolveTwoLevelHigherRelativeUrl() throws IOException,
-                       ConfigInvalidException {
+                       ConfigInvalidException, GitAPIException {
                final String path = addSubmoduleToIndex();
 
                String base = "git://server/repo.git";
@@ -238,7 +239,7 @@ public class SubmoduleInitTest extends RepositoryTestCase {
 
        @Test
        public void resolveWorkingDirectoryRelativeUrl() throws IOException,
-                       ConfigInvalidException {
+                       GitAPIException, ConfigInvalidException {
                final String path = addSubmoduleToIndex();
 
                String base = db.getWorkTree().getAbsolutePath();
@@ -281,7 +282,7 @@ public class SubmoduleInitTest extends RepositoryTestCase {
 
        @Test
        public void resolveInvalidParentUrl() throws IOException,
-                       ConfigInvalidException {
+                       ConfigInvalidException, GitAPIException {
                final String path = addSubmoduleToIndex();
 
                String base = "no_slash";
index dc79d84259f4d9f993eb3ac3966119b3ecc806fd..6feefdb2d193ba28f357af0aeec202e947f47def 100644 (file)
@@ -53,6 +53,7 @@ import java.util.Map.Entry;
 
 import org.eclipse.jgit.api.Git;
 import org.eclipse.jgit.api.SubmoduleStatusCommand;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.dircache.DirCache;
 import org.eclipse.jgit.dircache.DirCacheEditor;
 import org.eclipse.jgit.dircache.DirCacheEditor.PathEdit;
@@ -74,7 +75,7 @@ import org.junit.Test;
 public class SubmoduleStatusTest extends RepositoryTestCase {
 
        @Test
-       public void repositoryWithNoSubmodules() {
+       public void repositoryWithNoSubmodules() throws GitAPIException {
                SubmoduleStatusCommand command = new SubmoduleStatusCommand(db);
                Map<String, SubmoduleStatus> statuses = command.call();
                assertNotNull(statuses);
@@ -82,7 +83,8 @@ public class SubmoduleStatusTest extends RepositoryTestCase {
        }
 
        @Test
-       public void repositoryWithMissingSubmodule() throws IOException {
+       public void repositoryWithMissingSubmodule() throws IOException,
+                       GitAPIException {
                final ObjectId id = ObjectId
                                .fromString("abcd1234abcd1234abcd1234abcd1234abcd1234");
                final String path = "sub";
@@ -113,7 +115,8 @@ public class SubmoduleStatusTest extends RepositoryTestCase {
        }
 
        @Test
-       public void repositoryWithUninitializedSubmodule() throws IOException {
+       public void repositoryWithUninitializedSubmodule() throws IOException,
+                       GitAPIException {
                final ObjectId id = ObjectId
                                .fromString("abcd1234abcd1234abcd1234abcd1234abcd1234");
                final String path = "sub";
@@ -152,7 +155,8 @@ public class SubmoduleStatusTest extends RepositoryTestCase {
        }
 
        @Test
-       public void repositoryWithNoHeadInSubmodule() throws IOException {
+       public void repositoryWithNoHeadInSubmodule() throws IOException,
+                       GitAPIException {
                final ObjectId id = ObjectId
                                .fromString("abcd1234abcd1234abcd1234abcd1234abcd1234");
                final String path = "sub";
@@ -202,7 +206,8 @@ public class SubmoduleStatusTest extends RepositoryTestCase {
        }
 
        @Test
-       public void repositoryWithNoSubmoduleRepository() throws IOException {
+       public void repositoryWithNoSubmoduleRepository() throws IOException,
+                       GitAPIException {
                final ObjectId id = ObjectId
                                .fromString("abcd1234abcd1234abcd1234abcd1234abcd1234");
                final String path = "sub";
@@ -247,7 +252,8 @@ public class SubmoduleStatusTest extends RepositoryTestCase {
        }
 
        @Test
-       public void repositoryWithInitializedSubmodule() throws IOException {
+       public void repositoryWithInitializedSubmodule() throws IOException,
+                       GitAPIException {
                final ObjectId id = ObjectId
                                .fromString("abcd1234abcd1234abcd1234abcd1234abcd1234");
                final String path = "sub";
@@ -302,7 +308,7 @@ public class SubmoduleStatusTest extends RepositoryTestCase {
 
        @Test
        public void repositoryWithDifferentRevCheckedOutSubmodule()
-                       throws IOException {
+                       throws IOException, GitAPIException {
                final ObjectId id = ObjectId
                                .fromString("abcd1234abcd1234abcd1234abcd1234abcd1234");
                final String path = "sub";
index 4df9077ba0014aa679bb8ba402b869e60d97c81c..3f9ad11f1d1501d77a4392cda31cb535150b664c 100644 (file)
@@ -53,6 +53,7 @@ import java.util.Map.Entry;
 
 import org.eclipse.jgit.api.Git;
 import org.eclipse.jgit.api.SubmoduleSyncCommand;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.dircache.DirCache;
 import org.eclipse.jgit.dircache.DirCacheEditor;
 import org.eclipse.jgit.dircache.DirCacheEditor.PathEdit;
@@ -73,7 +74,7 @@ import org.junit.Test;
 public class SubmoduleSyncTest extends RepositoryTestCase {
 
        @Test
-       public void repositoryWithNoSubmodules() {
+       public void repositoryWithNoSubmodules() throws GitAPIException {
                SubmoduleSyncCommand command = new SubmoduleSyncCommand(db);
                Map<String, String> modules = command.call();
                assertNotNull(modules);
index 9bb4a63aabdae8aecbc85e36adc2ec210233e9f7..eb0cf2b0b68f3094b4b03ff88180666e6770cced 100644 (file)
@@ -52,6 +52,7 @@ import java.util.Collection;
 
 import org.eclipse.jgit.api.Git;
 import org.eclipse.jgit.api.SubmoduleUpdateCommand;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.dircache.DirCache;
 import org.eclipse.jgit.dircache.DirCacheEditor;
 import org.eclipse.jgit.dircache.DirCacheEditor.PathEdit;
@@ -73,7 +74,7 @@ import org.junit.Test;
 public class SubmoduleUpdateTest extends RepositoryTestCase {
 
        @Test
-       public void repositoryWithNoSubmodules() {
+       public void repositoryWithNoSubmodules() throws GitAPIException {
                SubmoduleUpdateCommand command = new SubmoduleUpdateCommand(db);
                Collection<String> modules = command.call();
                assertNotNull(modules);
@@ -125,7 +126,8 @@ public class SubmoduleUpdateTest extends RepositoryTestCase {
        }
 
        @Test
-       public void repositoryWithUnconfiguredSubmodule() throws IOException {
+       public void repositoryWithUnconfiguredSubmodule() throws IOException,
+                       GitAPIException {
                final ObjectId id = ObjectId
                                .fromString("abcd1234abcd1234abcd1234abcd1234abcd1234");
                final String path = "sub";
@@ -159,7 +161,8 @@ public class SubmoduleUpdateTest extends RepositoryTestCase {
        }
 
        @Test
-       public void repositoryWithInitializedSubmodule() throws IOException {
+       public void repositoryWithInitializedSubmodule() throws IOException,
+                       GitAPIException {
                final ObjectId id = ObjectId
                                .fromString("abcd1234abcd1234abcd1234abcd1234abcd1234");
                final String path = "sub";
index 3da9640b4911ea68275ef928e69deaf3b71634d3..f89f3e480c9763b64745c1b23af1d7989814a925 100644 (file)
@@ -48,6 +48,7 @@ import java.io.InputStream;
 import java.util.Collection;
 import java.util.LinkedList;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.api.errors.NoFilepatternException;
 import org.eclipse.jgit.dircache.DirCache;
@@ -122,7 +123,7 @@ public class AddCommand extends GitCommand<DirCache> {
         *
         * @return the DirCache after Add
         */
-       public DirCache call() throws NoFilepatternException {
+       public DirCache call() throws GitAPIException, NoFilepatternException {
 
                if (filepatterns.isEmpty())
                        throw new NoFilepatternException(JGitText.get().atLeastOnePatternIsRequired);
index d1c75e2ca198b124c817db2a410d28f020734e70..3af86959da2833f8387e4068033d208853948fb0 100644 (file)
@@ -44,6 +44,7 @@ package org.eclipse.jgit.api;
 
 import java.io.IOException;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.lib.CommitBuilder;
 import org.eclipse.jgit.lib.Constants;
@@ -80,11 +81,7 @@ public class AddNoteCommand extends GitCommand<Note> {
                super(repo);
        }
 
-       /**
-        * @throws JGitInternalException
-        *             upon internal failure
-        */
-       public Note call() throws JGitInternalException {
+       public Note call() throws GitAPIException {
                checkCallable();
                RevWalk walk = new RevWalk(repo);
                ObjectInserter inserter = repo.newObjectInserter();
index 400d94bc88a8d1e01cb866e29750fe962766922a..12be64bb02fff4cba9863eeed65cc31f8674cb5e 100644 (file)
@@ -48,6 +48,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.blame.BlameGenerator;
 import org.eclipse.jgit.blame.BlameResult;
@@ -189,7 +190,7 @@ public class BlameCommand extends GitCommand<BlameResult> {
         *
         * @return list of lines
         */
-       public BlameResult call() throws JGitInternalException {
+       public BlameResult call() throws GitAPIException {
                checkCallable();
                BlameGenerator gen = new BlameGenerator(repo, path);
                try {
index e6d56c8e6f38b46e72752503166bee0978ca4416..03df65d8a79effaf7658172498fbdcd119bb6a97 100644 (file)
@@ -51,6 +51,7 @@ import java.util.List;
 
 import org.eclipse.jgit.api.CheckoutResult.Status;
 import org.eclipse.jgit.api.errors.CheckoutConflictException;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.InvalidRefNameException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.api.errors.RefAlreadyExistsException;
@@ -121,9 +122,11 @@ public class CheckoutCommand extends GitCommand<Ref> {
         * @throws InvalidRefNameException
         *             if the provided name is <code>null</code> or otherwise
         *             invalid
+        * @throws CheckoutConflictException
+        *             if the checkout results in a conflict
         * @return the newly created branch
         */
-       public Ref call() throws JGitInternalException, RefAlreadyExistsException,
+       public Ref call() throws GitAPIException, RefAlreadyExistsException,
                        RefNotFoundException, InvalidRefNameException,
                        CheckoutConflictException {
                checkCallable();
index e31f119cb210acf7ac50afecfa16771850594483..341be91da65dc4fb5f0f519fdc098e7eac223d2a 100644 (file)
@@ -49,6 +49,7 @@ import java.util.Collections;
 import java.util.Set;
 import java.util.TreeSet;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.util.FileUtils;
@@ -81,7 +82,7 @@ public class CleanCommand extends GitCommand<Set<String>> {
         *
         * @return a set of strings representing each file cleaned.
         */
-       public Set<String> call() {
+       public Set<String> call() throws GitAPIException {
                Set<String> files = new TreeSet<String>();
                try {
                        StatusCommand command = new StatusCommand(repo);
@@ -113,7 +114,7 @@ public class CleanCommand extends GitCommand<Set<String>> {
 
        /**
         * If dryRun is set, the paths in question will not actually be deleted.
-        * 
+        *
         * @param dryRun
         *            whether to do a dry run or not
         * @return {@code this}
index f354de1657f1af61dabfcb7ea9d4d51323a748b6..23bbc2aa9cec51887073c02439059dbaf97c9d16 100644 (file)
@@ -50,6 +50,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.InvalidRemoteException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.dircache.DirCache;
@@ -111,11 +112,9 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
        /**
         * Executes the {@code Clone} command.
         *
-        * @throws JGitInternalException
-        *             if the repository can't be created
         * @return the newly created {@code Git} object with associated repository
         */
-       public Git call() throws JGitInternalException {
+       public Git call() throws GitAPIException {
                try {
                        URIish u = new URIish(uri);
                        Repository repository = init(u);
@@ -132,7 +131,7 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
                }
        }
 
-       private Repository init(URIish u) {
+       private Repository init(URIish u) throws GitAPIException {
                InitCommand command = Git.init();
                command.setBare(bare);
                if (directory == null)
@@ -145,9 +144,7 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
        }
 
        private FetchResult fetch(Repository clonedRepo, URIish u)
-                       throws URISyntaxException,
-                       JGitInternalException,
-                       InvalidRemoteException, IOException {
+                       throws URISyntaxException, IOException, GitAPIException {
                // create the remote config and save it
                RemoteConfig config = new RemoteConfig(clonedRepo.getConfig(), remote);
                config.addURI(u);
@@ -193,8 +190,8 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
        }
 
        private void checkout(Repository clonedRepo, FetchResult result)
-                       throws JGitInternalException,
-                       MissingObjectException, IncorrectObjectTypeException, IOException {
+                       throws MissingObjectException, IncorrectObjectTypeException,
+                       IOException, GitAPIException {
 
                Ref head = result.getAdvertisedRef(branch);
                if (branch.equals(Constants.HEAD)) {
@@ -230,7 +227,8 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
                }
        }
 
-       private void cloneSubmodules(Repository clonedRepo) throws IOException {
+       private void cloneSubmodules(Repository clonedRepo) throws IOException,
+                       GitAPIException {
                SubmoduleInitCommand init = new SubmoduleInitCommand(clonedRepo);
                if (init.call().isEmpty())
                        return;
index 242d11efaa6bc29d6879f9656bb9a1a696e31df2..eac6fe6a407d31b3ea0cfa5c62376f6082eb7b5a 100644 (file)
@@ -50,10 +50,12 @@ import java.util.LinkedList;
 import java.util.List;
 
 import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.api.errors.NoFilepatternException;
 import org.eclipse.jgit.api.errors.NoHeadException;
 import org.eclipse.jgit.api.errors.NoMessageException;
+import org.eclipse.jgit.api.errors.UnmergedPathsException;
 import org.eclipse.jgit.api.errors.WrongRepositoryStateException;
 import org.eclipse.jgit.dircache.DirCache;
 import org.eclipse.jgit.dircache.DirCacheBuilder;
@@ -134,21 +136,18 @@ public class CommitCommand extends GitCommand<RevCommit> {
         *             when called on a git repo without a HEAD reference
         * @throws NoMessageException
         *             when called without specifying a commit message
-        * @throws UnmergedPathException
+        * @throws UnmergedPathsException
         *             when the current index contained unmerged paths (conflicts)
+        * @throws ConcurrentRefUpdateException
+        *             when HEAD or branch ref is updated concurrently by someone
+        *             else
         * @throws WrongRepositoryStateException
         *             when repository is not in the right state for committing
-        * @throws JGitInternalException
-        *             a low-level exception of JGit has occurred. The original
-        *             exception can be retrieved by calling
-        *             {@link Exception#getCause()}. Expect only
-        *             {@code IOException's} to be wrapped. Subclasses of
-        *             {@link IOException} (e.g. {@link UnmergedPathException}) are
-        *             typically not wrapped here but thrown as original exception
         */
-       public RevCommit call() throws NoHeadException, NoMessageException,
-                       UnmergedPathException, ConcurrentRefUpdateException,
-                       JGitInternalException, WrongRepositoryStateException {
+       public RevCommit call() throws GitAPIException, NoHeadException,
+                       NoMessageException, UnmergedPathsException,
+                       ConcurrentRefUpdateException,
+                       WrongRepositoryStateException {
                checkCallable();
 
                RepositoryState state = repo.getRepositoryState();
@@ -269,10 +268,7 @@ public class CommitCommand extends GitCommand<RevCommit> {
                                index.unlock();
                        }
                } catch (UnmergedPathException e) {
-                       // since UnmergedPathException is a subclass of IOException
-                       // which should not be wrapped by a JGitInternalException we
-                       // have to catch and re-throw it here
-                       throw e;
+                       throw new UnmergedPathsException(e);
                } catch (IOException e) {
                        throw new JGitInternalException(
                                        JGitText.get().exceptionCaughtDuringExecutionOfCommitCommand, e);
index 7ef1f2e134c8bbeabf3df6241e85d0baf17589a5..4fb3c174cddd03218fba68e3eb206018da8ec792 100644 (file)
@@ -46,6 +46,7 @@ package org.eclipse.jgit.api;
 import java.io.IOException;
 import java.text.MessageFormat;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.InvalidRefNameException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.api.errors.RefAlreadyExistsException;
@@ -57,9 +58,9 @@ import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.lib.Ref;
 import org.eclipse.jgit.lib.RefUpdate;
+import org.eclipse.jgit.lib.RefUpdate.Result;
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.lib.StoredConfig;
-import org.eclipse.jgit.lib.RefUpdate.Result;
 import org.eclipse.jgit.revwalk.RevCommit;
 import org.eclipse.jgit.revwalk.RevWalk;
 
@@ -119,7 +120,7 @@ public class CreateBranchCommand extends GitCommand<Ref> {
         *             invalid
         * @return the newly created branch
         */
-       public Ref call() throws JGitInternalException, RefAlreadyExistsException,
+       public Ref call() throws GitAPIException, RefAlreadyExistsException,
                        RefNotFoundException, InvalidRefNameException {
                checkCallable();
                processOptions();
index fe629f30a2d22016ea03e50f7b369bc782a7fdbc..0d03162543b976e350a5fd2144de82b040960713 100644 (file)
@@ -51,6 +51,7 @@ import java.util.List;
 import java.util.Set;
 
 import org.eclipse.jgit.api.errors.CannotDeleteCurrentBranchException;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.api.errors.NotMergedException;
 import org.eclipse.jgit.internal.JGitText;
@@ -58,9 +59,9 @@ import org.eclipse.jgit.lib.ConfigConstants;
 import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.Ref;
 import org.eclipse.jgit.lib.RefUpdate;
+import org.eclipse.jgit.lib.RefUpdate.Result;
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.lib.StoredConfig;
-import org.eclipse.jgit.lib.RefUpdate.Result;
 import org.eclipse.jgit.revwalk.RevCommit;
 import org.eclipse.jgit.revwalk.RevWalk;
 
@@ -93,9 +94,10 @@ public class DeleteBranchCommand extends GitCommand<List<String>> {
         * @throws NotMergedException
         *             when trying to delete a branch which has not been merged into
         *             the currently checked out branch without force
+        * @throws CannotDeleteCurrentBranchException
         * @return the list with the (full) names of the deleted branches
         */
-       public List<String> call() throws JGitInternalException,
+       public List<String> call() throws GitAPIException,
                        NotMergedException, CannotDeleteCurrentBranchException {
                checkCallable();
                List<String> result = new ArrayList<String>();
index bd4c8eca383d69240e1f39275bd9ea9d76af8268..ae511c6df0e130d8c7f82da8c9fbb217e6a22d89 100644 (file)
@@ -49,6 +49,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.internal.JGitText;
 import org.eclipse.jgit.lib.Ref;
@@ -77,12 +78,9 @@ public class DeleteTagCommand extends GitCommand<List<String>> {
        }
 
        /**
-        * @throws JGitInternalException
-        *             when trying to delete a tag that doesn't exist
-        *
         * @return the list with the full names of the deleted tags
         */
-       public List<String> call() throws JGitInternalException {
+       public List<String> call() throws GitAPIException {
                checkCallable();
                List<String> result = new ArrayList<String>();
                if (tags.isEmpty())
index e82b0486a64113d816e042966b761320dd51dfc3..9b4476d628e6005b0d16156aa300847cda70cdda 100644 (file)
@@ -50,6 +50,7 @@ import java.io.OutputStream;
 import java.util.List;
 
 import org.eclipse.jgit.api.errors.GitAPIException;
+import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.api.errors.NoHeadException;
 import org.eclipse.jgit.diff.DiffEntry;
 import org.eclipse.jgit.diff.DiffFormatter;
@@ -108,7 +109,7 @@ public class DiffCommand extends GitCommand<List<DiffEntry>> {
         *
         * @return a DiffEntry for each path which is different
         */
-       public List<DiffEntry> call() throws GitAPIException, IOException {
+       public List<DiffEntry> call() throws GitAPIException {
                final DiffFormatter diffFmt;
                if (out != null && !showNameAndStatusOnly)
                        diffFmt = new DiffFormatter(new BufferedOutputStream(out));
@@ -155,6 +156,8 @@ public class DiffCommand extends GitCommand<List<DiffEntry>> {
                                diffFmt.flush();
                                return result;
                        }
+               } catch (IOException e) {
+                       throw new JGitInternalException(e.getMessage(), e);
                } finally {
                        diffFmt.release();
                }
index 181c4c458cc269003c63e1e4b103f336d477ecfe..6df244bcc32066d850e094a0980eb6ba4eb30b54 100644 (file)
@@ -47,6 +47,7 @@ import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.InvalidRemoteException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.errors.NoRemoteRepositoryException;
@@ -106,13 +107,11 @@ public class FetchCommand extends TransportCommand<FetchCommand, FetchResult> {
         *         result
         * @throws InvalidRemoteException
         *             when called with an invalid remote uri
-        * @throws JGitInternalException
-        *             a low-level exception of JGit has occurred. The original
-        *             exception can be retrieved by calling
-        *             {@link Exception#getCause()}.
+        * @throws org.eclipse.jgit.api.errors.TransportException
+        *             when an error occurs during transport
         */
-       public FetchResult call() throws JGitInternalException,
-                       InvalidRemoteException {
+       public FetchResult call() throws GitAPIException, InvalidRemoteException,
+                       org.eclipse.jgit.api.errors.TransportException {
                checkCallable();
 
                try {
@@ -135,7 +134,7 @@ public class FetchCommand extends TransportCommand<FetchCommand, FetchResult> {
                        throw new InvalidRemoteException(MessageFormat.format(
                                        JGitText.get().invalidRemote, remote), e);
                } catch (TransportException e) {
-                       throw new JGitInternalException(
+                       throw new org.eclipse.jgit.api.errors.TransportException(
                                        JGitText.get().exceptionCaughtDuringExecutionOfFetchCommand,
                                        e);
                } catch (URISyntaxException e) {
index 83e7cfd989522b586d4e50afec529614fa4ec0cd..329b1b5aea148a7b5bcec1a7993171ceeb088f84 100644 (file)
@@ -40,6 +40,7 @@ package org.eclipse.jgit.api;
 import java.text.MessageFormat;
 import java.util.concurrent.Callable;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.internal.JGitText;
 import org.eclipse.jgit.lib.Repository;
 
@@ -116,4 +117,13 @@ public abstract class GitCommand<T> implements Callable<T> {
                                        JGitText.get().commandWasCalledInTheWrongState
                                        , this.getClass().getName()));
        }
+
+       /**
+        * Executes the command
+        *
+        * @return T a result. Each command has its own return type
+        * @throws GitAPIException
+        *             or subclass thereof when an error occurs
+        */
+       public abstract T call() throws GitAPIException;
 }
index 77fc3042c548d0821045b35b6ea761fe6f4280b1..8777be55462d2ae6035e37abb4ac4c8eea0d1125 100644 (file)
@@ -46,6 +46,7 @@ import java.io.File;
 import java.io.IOException;
 import java.util.concurrent.Callable;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.Repository;
@@ -65,11 +66,9 @@ public class InitCommand implements Callable<Git> {
        /**
         * Executes the {@code Init} command.
         *
-        * @throws JGitInternalException
-        *             if the repository can't be created
         * @return the newly created {@code Git} object with associated repository
         */
-       public Git call() throws JGitInternalException {
+       public Git call() throws GitAPIException {
                try {
                        RepositoryBuilder builder = new RepositoryBuilder();
                        if (bare)
index 846c5385c566f9b9c8835fc69b353613c9159efd..ea6f34b414fa131aefbe36f02affce06cfa00e61 100644 (file)
@@ -47,10 +47,11 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.HashMap;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.Ref;
@@ -88,11 +89,7 @@ public class ListBranchCommand extends GitCommand<List<Ref>> {
                super(repo);
        }
 
-       /**
-        * @throws JGitInternalException
-        *             upon internal failure
-        */
-       public List<Ref> call() throws JGitInternalException {
+       public List<Ref> call() throws GitAPIException {
                checkCallable();
                Map<String, Ref> refList;
                try {
index 92f883a02e4278f9e422f09c1470746defc1f03b..84fa355af5d10d0c0c1da0a6de8d53ed5cb93f6a 100644 (file)
@@ -47,6 +47,7 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.Ref;
@@ -74,10 +75,9 @@ public class ListNotesCommand extends GitCommand<List<Note>> {
        }
 
        /**
-        * @throws JGitInternalException
-        *             upon internal failure
+        * @return the requested notes
         */
-       public List<Note> call() throws JGitInternalException {
+       public List<Note> call() throws GitAPIException {
                checkCallable();
                List<Note> notes = new ArrayList<Note>();
                RevWalk walk = new RevWalk(repo);
index c1ae88731fd79118ac82826443502049b2c884a5..a0a5d950cab243cedbc00019680f5735f8ad8078 100644 (file)
@@ -49,6 +49,7 @@ import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.Ref;
@@ -71,11 +72,9 @@ public class ListTagCommand extends GitCommand<List<Ref>> {
        }
 
        /**
-        * @throws JGitInternalException
-        *             upon internal failure
         * @return the tags available
         */
-       public List<Ref> call() throws JGitInternalException {
+       public List<Ref> call() throws GitAPIException {
                checkCallable();
                Map<String, Ref> refList;
                List<Ref> tags = new ArrayList<Ref>();
index 04a87b092a0b0a41aca189056a250a5e2ceda243..6d4b3474ef8d537c85a8541a4fa1defe1c6c1ccb 100644 (file)
@@ -47,6 +47,7 @@ import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.api.errors.NoHeadException;
 import org.eclipse.jgit.errors.IncorrectObjectTypeException;
@@ -108,9 +109,10 @@ public class LogCommand extends GitCommand<Iterable<RevCommit>> {
         * method twice on an instance.
         *
         * @return an iteration over RevCommits
+        * @throws NoHeadException
+        *             of the references ref cannot be resolved
         */
-       public Iterable<RevCommit> call() throws NoHeadException,
-                       JGitInternalException {
+       public Iterable<RevCommit> call() throws GitAPIException, NoHeadException {
                checkCallable();
                if (pathFilters.size() > 0)
                        walk.setTreeFilter(AndTreeFilter.create(
@@ -166,7 +168,7 @@ public class LogCommand extends GitCommand<Iterable<RevCommit>> {
         *             typically not wrapped here but thrown as original exception
         */
        public LogCommand add(AnyObjectId start) throws MissingObjectException,
-                       IncorrectObjectTypeException, JGitInternalException {
+                       IncorrectObjectTypeException {
                return add(true, start);
        }
 
@@ -194,7 +196,7 @@ public class LogCommand extends GitCommand<Iterable<RevCommit>> {
         *             typically not wrapped here but thrown as original exception
         */
        public LogCommand not(AnyObjectId start) throws MissingObjectException,
-                       IncorrectObjectTypeException, JGitInternalException {
+                       IncorrectObjectTypeException {
                return add(false, start);
        }
 
@@ -223,8 +225,7 @@ public class LogCommand extends GitCommand<Iterable<RevCommit>> {
         *             typically not wrapped here but thrown as original exception
         */
        public LogCommand addRange(AnyObjectId since, AnyObjectId until)
-                       throws MissingObjectException, IncorrectObjectTypeException,
-                       JGitInternalException {
+                       throws MissingObjectException, IncorrectObjectTypeException {
                return not(since).add(until);
        }
 
index 947b3f5929ec9503181200c4a804e343b248a4a4..b041f33c4c7ca3f00702fd696e3e37173db2c3da 100644 (file)
@@ -144,13 +144,11 @@ public class LsRemoteCommand extends
         * @return a collection of references in the remote repository
         * @throws InvalidRemoteException
         *             when called with an invalid remote uri
-        * @throws JGitInternalException
-        *             a low-level exception of JGit has occurred. The original
-        *             exception can be retrieved by calling
-        *             {@link Exception#getCause()}.
+        * @throws org.eclipse.jgit.api.errors.TransportException
+        *             for errors that occurs during transport
         */
        public Collection<Ref> call() throws GitAPIException,
-                       JGitInternalException {
+                       org.eclipse.jgit.api.errors.TransportException {
                checkCallable();
 
                Transport transport = null;
index 05743e6c2184bf2daf7903b4c669d72c8e600160..c5a95521121e59b590b3a017366cf39f2501a930 100644 (file)
@@ -54,6 +54,7 @@ import java.util.Map;
 import org.eclipse.jgit.api.MergeResult.MergeStatus;
 import org.eclipse.jgit.api.errors.CheckoutConflictException;
 import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.InvalidMergeHeadsException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.api.errors.NoHeadException;
@@ -109,7 +110,7 @@ public class MergeCommand extends GitCommand<MergeResult> {
         *
         * @return the result of the merge
         */
-       public MergeResult call() throws NoHeadException,
+       public MergeResult call() throws GitAPIException, NoHeadException,
                        ConcurrentRefUpdateException, CheckoutConflictException,
                        InvalidMergeHeadsException, WrongRepositoryStateException, NoMessageException {
                checkCallable();
index 3a85f1093e725c555d3386e79ce0198c6ffbc4f1..86d38fb36c87d7fa836ffb30a7caa2d35ea20194 100644 (file)
@@ -110,7 +110,7 @@ public class PullCommand extends TransportCommand<PullCommand, PullResult> {
         *
         * @return the result of the pull
         */
-       public PullResult call() throws WrongRepositoryStateException,
+       public PullResult call() throws GitAPIException, WrongRepositoryStateException,
                        InvalidConfigurationException, DetachedHeadException,
                        InvalidRemoteException, CanceledException, RefNotFoundException,
                        NoHeadException {
index e7f0b06a9691e17d00719cccc4de0092a174fa78..edfb2f7b759c25a2f89628ee781033c7ab3b6b2e 100644 (file)
@@ -50,6 +50,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.InvalidRemoteException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.errors.NotSupportedException;
@@ -108,12 +109,8 @@ public class PushCommand extends
         * @return an iteration over {@link PushResult} objects
         * @throws InvalidRemoteException
         *             when called with an invalid remote uri
-        * @throws JGitInternalException
-        *             a low-level exception of JGit has occurred. The original
-        *             exception can be retrieved by calling
-        *             {@link Exception#getCause()}.
         */
-       public Iterable<PushResult> call() throws JGitInternalException,
+       public Iterable<PushResult> call() throws GitAPIException,
                        InvalidRemoteException {
                checkCallable();
 
@@ -325,7 +322,7 @@ public class PushCommand extends
         * @throws JGitInternalException
         *             the reference name cannot be resolved.
         */
-       public PushCommand add(String nameOrSpec) throws JGitInternalException {
+       public PushCommand add(String nameOrSpec) {
                if (0 <= nameOrSpec.indexOf(':')) {
                        refSpecs.add(new RefSpec(nameOrSpec));
                } else {
index aa6572600c43c22bb128348079cdc19e52342320..5b73657ea79818d5029b840ee18d64dfdd4dfbb5 100644 (file)
@@ -190,8 +190,8 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
         *
         * @return an object describing the result of this command
         */
-       public RebaseResult call() throws NoHeadException, RefNotFoundException,
-                       JGitInternalException, GitAPIException {
+       public RebaseResult call() throws GitAPIException, NoHeadException,
+                       RefNotFoundException {
                RevCommit newHead = null;
                boolean lastStepWasForward = false;
                checkCallable();
@@ -325,8 +325,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
                }
        }
 
-       private RevCommit checkoutCurrentHead() throws IOException,
-                       NoHeadException, JGitInternalException {
+       private RevCommit checkoutCurrentHead() throws IOException, NoHeadException {
                ObjectId headTree = repo.resolve(Constants.HEAD + "^{tree}");
                if (headTree == null)
                        throw new NoHeadException(
@@ -517,8 +516,8 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
                }
        }
 
-       private RebaseResult initFilesAndRewind() throws RefNotFoundException,
-                       IOException, NoHeadException, JGitInternalException {
+       private RebaseResult initFilesAndRewind() throws IOException,
+                       GitAPIException {
                // we need to store everything into files so that we can implement
                // --skip, --continue, and --abort
 
@@ -626,11 +625,11 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
         *
         * @param newCommit
         * @return the new head, or null
-        * @throws RefNotFoundException
         * @throws IOException
+        * @throws GitAPIException
         */
-       public RevCommit tryFastForward(RevCommit newCommit)
-                       throws RefNotFoundException, IOException {
+       public RevCommit tryFastForward(RevCommit newCommit) throws IOException,
+                       GitAPIException {
                Ref head = repo.getRef(Constants.HEAD);
                if (head == null || head.getObjectId() == null)
                        throw new RefNotFoundException(MessageFormat.format(
@@ -653,7 +652,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
        }
 
        private RevCommit tryFastForward(String headName, RevCommit oldCommit,
-                       RevCommit newCommit) throws IOException, JGitInternalException {
+                       RevCommit newCommit) throws IOException, GitAPIException {
                boolean tryRebase = false;
                for (RevCommit parentCommit : newCommit.getParents())
                        if (parentCommit.equals(oldCommit))
index 10757a845c2afeecf033087abf743db32aaa3e5a..c4d112a319f585dc34318a7f79dc51568d1b6bcb 100644 (file)
@@ -46,6 +46,7 @@ import java.io.IOException;
 import java.text.MessageFormat;
 import java.util.Collection;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.InvalidRefNameException;
 import org.eclipse.jgit.internal.JGitText;
 import org.eclipse.jgit.lib.Constants;
@@ -84,7 +85,7 @@ public class ReflogCommand extends GitCommand<Collection<ReflogEntry>> {
                return this;
        }
 
-       public Collection<ReflogEntry> call() throws Exception {
+       public Collection<ReflogEntry> call() throws GitAPIException {
                checkCallable();
 
                try {
index 5b9075e4360589e254621c1d9a27bb420092de93..d1e27709311ea5dc2a07a06ac3efa9e9de3b8b15 100644 (file)
@@ -44,6 +44,7 @@ package org.eclipse.jgit.api;
 
 import java.io.IOException;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.lib.CommitBuilder;
 import org.eclipse.jgit.lib.Constants;
@@ -78,11 +79,7 @@ public class RemoveNoteCommand extends GitCommand<Note> {
                super(repo);
        }
 
-       /**
-        * @throws JGitInternalException
-        *             upon internal failure
-        */
-       public Note call() throws JGitInternalException {
+       public Note call() throws GitAPIException {
                checkCallable();
                RevWalk walk = new RevWalk(repo);
                ObjectInserter inserter = repo.newObjectInserter();
index f5dfa2b1111c00ec03fdd3270ea743bb4ea33bc6..f9cb828d8e696eabe3aefc08fd563099a4de407f 100644 (file)
@@ -48,6 +48,7 @@ import java.text.MessageFormat;
 import java.util.Arrays;
 
 import org.eclipse.jgit.api.errors.DetachedHeadException;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.InvalidRefNameException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.api.errors.RefAlreadyExistsException;
@@ -58,9 +59,9 @@ import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.lib.Ref;
 import org.eclipse.jgit.lib.RefRename;
+import org.eclipse.jgit.lib.RefUpdate.Result;
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.lib.StoredConfig;
-import org.eclipse.jgit.lib.RefUpdate.Result;
 
 /**
  * Used to rename branches.
@@ -94,7 +95,7 @@ public class RenameBranchCommand extends GitCommand<Ref> {
         *             if rename is tried without specifying the old name and HEAD
         *             is detached
         */
-       public Ref call() throws RefNotFoundException, InvalidRefNameException,
+       public Ref call() throws GitAPIException, RefNotFoundException, InvalidRefNameException,
                        RefAlreadyExistsException, DetachedHeadException {
                checkCallable();
 
index 0af684e7eb0328b127bc611d454b7fc474b55d16..2f46b7faf3ccb47ffc5b3300ee5f49e767b5dcd2 100644 (file)
@@ -47,6 +47,7 @@ import java.text.MessageFormat;
 import java.util.Collection;
 import java.util.LinkedList;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.dircache.DirCache;
 import org.eclipse.jgit.dircache.DirCacheCheckout;
@@ -135,7 +136,7 @@ public class ResetCommand extends GitCommand<Ref> {
         *
         * @return the Ref after reset
         */
-       public Ref call() throws IOException {
+       public Ref call() throws GitAPIException {
                checkCallable();
 
                Ref r;
index b6757d807042cef3d4c68aba7ac514bfa5b5e93c..416677c406fbf3ae7c3836956879c394ab06b6ac 100644 (file)
@@ -50,8 +50,8 @@ import java.util.Map;
 
 import org.eclipse.jgit.api.MergeResult.MergeStatus;
 import org.eclipse.jgit.api.errors.GitAPIException;
-import org.eclipse.jgit.api.errors.MultipleParentsNotAllowedException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
+import org.eclipse.jgit.api.errors.MultipleParentsNotAllowedException;
 import org.eclipse.jgit.api.errors.NoHeadException;
 import org.eclipse.jgit.dircache.DirCacheCheckout;
 import org.eclipse.jgit.internal.JGitText;
index 2b8cafccee6d4d342d89b39257dbcce3cc8213d7..d29d547bd1047cf270cbaa608a556ce1dc2cd407 100644 (file)
@@ -47,6 +47,7 @@ import java.io.IOException;
 import java.util.Collection;
 import java.util.LinkedList;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.api.errors.NoFilepatternException;
 import org.eclipse.jgit.dircache.DirCache;
@@ -99,7 +100,8 @@ public class RmCommand extends GitCommand<DirCache> {
         *
         * @return the DirCache after Rm
         */
-       public DirCache call() throws NoFilepatternException {
+       public DirCache call() throws GitAPIException,
+                       NoFilepatternException {
 
                if (filepatterns.isEmpty())
                        throw new NoFilepatternException(JGitText.get().atLeastOnePatternIsRequired);
index 45f53e7fae852203a4856c3874f73276d18aa996..7d411c3ecf06987f075bfd71072aef620f929e8e 100644 (file)
@@ -44,6 +44,7 @@ package org.eclipse.jgit.api;
 
 import java.io.IOException;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.Ref;
@@ -73,11 +74,7 @@ public class ShowNoteCommand extends GitCommand<Note> {
                super(repo);
        }
 
-       /**
-        * @throws JGitInternalException
-        *             upon internal failure
-        */
-       public Note call() throws JGitInternalException {
+       public Note call() throws GitAPIException {
                checkCallable();
                RevWalk walk = new RevWalk(repo);
                NoteMap map = NoteMap.newEmptyMap();
index 3876e48cd0137872aed3b9e83582b887c2b1669c..4992d3ccd3db7804c27959150cdcbd7d1e7a7129 100644 (file)
@@ -189,8 +189,7 @@ public class StashApplyCommand extends GitCommand<ObjectId> {
                return false;
        }
 
-       private ObjectId getHeadTree() throws JGitInternalException,
-                       GitAPIException {
+       private ObjectId getHeadTree() throws GitAPIException {
                final ObjectId headTree;
                try {
                        headTree = repo.resolve(Constants.HEAD + "^{tree}");
@@ -202,7 +201,7 @@ public class StashApplyCommand extends GitCommand<ObjectId> {
                return headTree;
        }
 
-       private ObjectId getStashId() throws JGitInternalException, GitAPIException {
+       private ObjectId getStashId() throws GitAPIException {
                final String revision = stashRef != null ? stashRef : DEFAULT_REF;
                final ObjectId stashId;
                try {
@@ -298,7 +297,7 @@ public class StashApplyCommand extends GitCommand<ObjectId> {
         *
         * @return id of stashed commit that was applied
         */
-       public ObjectId call() throws GitAPIException, JGitInternalException {
+       public ObjectId call() throws GitAPIException {
                checkCallable();
 
                if (repo.getRepositoryState() != RepositoryState.SAFE)
index 5ba61622ea6f983cfd5416108cc47354e395b529..4056894c9dcf977d63b358b90233220cbf56b710 100644 (file)
@@ -212,7 +212,7 @@ public class StashCreateCommand extends GitCommand<RevCommit> {
         *
         * @return stashed commit or null if no changes to stash
         */
-       public RevCommit call() throws GitAPIException, JGitInternalException {
+       public RevCommit call() throws GitAPIException {
                checkCallable();
 
                Ref head = getHead();
index e718417d1e875d99eede6a91208b07421416710f..eb61298e2c42b5364ec35bf5577a76243cee75f9 100644 (file)
@@ -168,7 +168,7 @@ public class StashDropCommand extends GitCommand<ObjectId> {
         *
         * @return commit id of stash reference or null if no more stashed changes
         */
-       public ObjectId call() throws GitAPIException, JGitInternalException {
+       public ObjectId call() throws GitAPIException {
                checkCallable();
 
                Ref stashRef = getRef();
index 8f7bf2e0f52e834ee81c5e71e6057ae09ebaba64..407b5ab1ee3fac39192e42fd72edec2d659857fe 100644 (file)
@@ -49,6 +49,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.InvalidRefNameException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.internal.JGitText;
@@ -75,7 +76,7 @@ public class StashListCommand extends GitCommand<Collection<RevCommit>> {
                super(repo);
        }
 
-       public Collection<RevCommit> call() throws Exception {
+       public Collection<RevCommit> call() throws GitAPIException {
                checkCallable();
 
                try {
index 7d7eb1871faec6eb2742c3dca2dc3a26f5f6a37b..b3e112fc6ab78884eb44c604f88e87e2c8e93984 100644 (file)
@@ -44,6 +44,8 @@ package org.eclipse.jgit.api;
 
 import java.io.IOException;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
+import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.errors.NoWorkTreeException;
 import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.IndexDiff;
@@ -80,14 +82,17 @@ public class StatusCommand extends GitCommand<Status> {
         * @return a {@link Status} object telling about each path where working
         *         tree, index or HEAD differ from each other.
         */
-       public Status call() throws IOException, NoWorkTreeException {
+       public Status call() throws GitAPIException, NoWorkTreeException {
                if (workingTreeIt == null)
                        workingTreeIt = new FileTreeIterator(repo);
 
-               IndexDiff diff = new IndexDiff(repo, Constants.HEAD, workingTreeIt);
-               diff.diff();
-
-               return new Status(diff);
+               try {
+                       IndexDiff diff = new IndexDiff(repo, Constants.HEAD, workingTreeIt);
+                       diff.diff();
+                       return new Status(diff);
+               } catch (IOException e) {
+                       throw new JGitInternalException(e.getMessage(), e);
+               }
        }
 
        /**
index 454fc23853928043654df10c0900704976600095..bfef053d85db12570f8a7cc344bbbae134cac278 100644 (file)
@@ -46,6 +46,7 @@ import java.io.File;
 import java.io.IOException;
 import java.text.MessageFormat;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.api.errors.NoFilepatternException;
 import org.eclipse.jgit.errors.ConfigInvalidException;
@@ -134,7 +135,7 @@ public class SubmoduleAddCommand extends
                return SubmoduleWalk.forIndex(repo).setFilter(filter).next();
        }
 
-       public Repository call() throws JGitInternalException {
+       public Repository call() throws GitAPIException {
                checkCallable();
                if (path == null || path.length() == 0)
                        throw new IllegalArgumentException(JGitText.get().pathNotConfigured);
index fef13704efde93217940e50269f5f948760d7f58..e799bfb8bdc75b69c6d1c279fac95dbd2dc770bd 100644 (file)
@@ -47,6 +47,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.errors.ConfigInvalidException;
 import org.eclipse.jgit.lib.ConfigConstants;
@@ -89,7 +90,7 @@ public class SubmoduleInitCommand extends GitCommand<Collection<String>> {
                return this;
        }
 
-       public Collection<String> call() throws JGitInternalException {
+       public Collection<String> call() throws GitAPIException {
                checkCallable();
 
                try {
index 05425837856a064c4f4b44f2ec25cae838b2c1a1..d27f90c12904796fe786434fa7a31ea6168e1e45 100644 (file)
@@ -48,6 +48,7 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.errors.ConfigInvalidException;
 import org.eclipse.jgit.lib.Constants;
@@ -89,7 +90,7 @@ public class SubmoduleStatusCommand extends
                return this;
        }
 
-       public Map<String, SubmoduleStatus> call() throws JGitInternalException {
+       public Map<String, SubmoduleStatus> call() throws GitAPIException {
                checkCallable();
 
                try {
index fd8ddc941d53b2f9c84aab9b51406b49a8cf0281..edc54ff4cc1511e3d46bfc9e1a59ed8add384a04 100644 (file)
@@ -48,6 +48,7 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.errors.ConfigInvalidException;
 import org.eclipse.jgit.lib.ConfigConstants;
@@ -106,7 +107,7 @@ public class SubmoduleSyncCommand extends GitCommand<Map<String, String>> {
                        return null;
        }
 
-       public Map<String, String> call() throws JGitInternalException {
+       public Map<String, String> call() throws GitAPIException {
                checkCallable();
 
                try {
index f94b2099a0201fb84f92ac29a05ac8fcbcdc0e12..be705ee6dd983b9366fe874dc97413a1bb005c3e 100644 (file)
@@ -109,7 +109,7 @@ public class SubmoduleUpdateCommand extends
                return this;
        }
 
-       public Collection<String> call() throws JGitInternalException {
+       public Collection<String> call() throws GitAPIException {
                checkCallable();
 
                try {
index c867b53e8d493bb8237e1e382c5a125d885cfa97..cef9e18349fb4bf8009860f81ce51773cc3530e6 100644 (file)
@@ -46,6 +46,7 @@ import java.io.IOException;
 import java.text.MessageFormat;
 
 import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.InvalidTagNameException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.api.errors.NoHeadException;
@@ -100,15 +101,10 @@ public class TagCommand extends GitCommand<Ref> {
         * @return a {@link Ref} a ref pointing to a tag
         * @throws NoHeadException
         *             when called on a git repo without a HEAD reference
-        * @throws JGitInternalException
-        *             a low-level exception of JGit has occurred. The original
-        *             exception can be retrieved by calling
-        *             {@link Exception#getCause()}. Expect only
-        *             {@code IOException's} to be wrapped.
         * @since 2.0
         */
-       public Ref call() throws JGitInternalException,
-                       ConcurrentRefUpdateException, InvalidTagNameException, NoHeadException {
+       public Ref call() throws GitAPIException, ConcurrentRefUpdateException,
+                       InvalidTagNameException, NoHeadException {
                checkCallable();
 
                RepositoryState state = repo.getRepositoryState();
index 19101dbb05993ffdfe654b563ee03dc580337fc4..0990040150520cd9edcf7008025e0318573c99f3 100644 (file)
@@ -49,6 +49,16 @@ public class UnmergedPathsException extends GitAPIException {
         * The default constructor with a default message
         */
        public UnmergedPathsException() {
-               super(JGitText.get().unmergedPaths);
+               this(null);
+       }
+
+       /**
+        * The default constructor with a default message
+        *
+        * @param cause
+        *            original exception
+        */
+       public UnmergedPathsException(Throwable cause) {
+               super(JGitText.get().unmergedPaths, cause);
        }
 }