aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/AddNoteCommand.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java18
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java26
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteTagCommand.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java13
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/GitCommand.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/ListBranchCommand.java9
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/ListNotesCommand.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/ListTagCommand.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java13
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java9
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java19
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/ReflogCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RemoveNoteCommand.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RmCommand.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/ShowNoteCommand.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/StashDropCommand.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/StashListCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/StatusCommand.java15
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleStatusCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/errors/UnmergedPathsException.java12
42 files changed, 151 insertions, 136 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java
index 3da9640b49..f89f3e480c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java
@@ -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);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/AddNoteCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/AddNoteCommand.java
index d1c75e2ca1..3af86959da 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/AddNoteCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/AddNoteCommand.java
@@ -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();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java
index 400d94bc88..12be64bb02 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java
@@ -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 {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
index e6d56c8e6f..03df65d8a7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
@@ -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();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java
index e31f119cb2..341be91da6 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java
@@ -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}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
index f354de1657..23bbc2aa9c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
@@ -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;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
index 242d11efaa..eac6fe6a40 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
@@ -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);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java
index 7ef1f2e134..4fb3c174cd 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java
@@ -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();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java
index fe629f30a2..0d03162543 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java
@@ -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>();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteTagCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteTagCommand.java
index bd4c8eca38..ae511c6df0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteTagCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteTagCommand.java
@@ -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())
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java
index e82b0486a6..9b4476d628 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java
@@ -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();
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java
index 181c4c458c..6df244bcc3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java
@@ -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) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/GitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/GitCommand.java
index 83e7cfd989..329b1b5aea 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/GitCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/GitCommand.java
@@ -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;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java
index 77fc3042c5..8777be5546 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java
@@ -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)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ListBranchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ListBranchCommand.java
index 846c5385c5..ea6f34b414 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ListBranchCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ListBranchCommand.java
@@ -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 {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ListNotesCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ListNotesCommand.java
index 92f883a02e..84fa355af5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ListNotesCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ListNotesCommand.java
@@ -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);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ListTagCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ListTagCommand.java
index c1ae88731f..a0a5d950ca 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ListTagCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ListTagCommand.java
@@ -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>();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java
index 04a87b092a..6d4b3474ef 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java
@@ -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);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java
index 947b3f5929..b041f33c4c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java
@@ -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;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
index 05743e6c21..c5a9552112 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
@@ -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();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
index 3a85f1093e..86d38fb36c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
@@ -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 {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java
index e7f0b06a96..edfb2f7b75 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java
@@ -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 {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
index aa6572600c..5b73657ea7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
@@ -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))
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ReflogCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ReflogCommand.java
index 10757a845c..c4d112a319 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ReflogCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ReflogCommand.java
@@ -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 {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RemoveNoteCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RemoveNoteCommand.java
index 5b9075e436..d1e2770931 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RemoveNoteCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RemoveNoteCommand.java
@@ -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();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java
index f5dfa2b111..f9cb828d8e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java
@@ -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();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java
index 0af684e7eb..2f46b7faf3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java
@@ -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;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
index b6757d8070..416677c406 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
@@ -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;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RmCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RmCommand.java
index 2b8cafccee..d29d547bd1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RmCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RmCommand.java
@@ -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);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ShowNoteCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ShowNoteCommand.java
index 45f53e7fae..7d411c3ecf 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ShowNoteCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ShowNoteCommand.java
@@ -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();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
index 3876e48cd0..4992d3ccd3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
@@ -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)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java
index 5ba61622ea..4056894c9d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java
@@ -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();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashDropCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashDropCommand.java
index e718417d1e..eb61298e2c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashDropCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashDropCommand.java
@@ -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();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashListCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashListCommand.java
index 8f7bf2e0f5..407b5ab1ee 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashListCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashListCommand.java
@@ -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 {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/StatusCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/StatusCommand.java
index 7d7eb1871f..b3e112fc6a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StatusCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StatusCommand.java
@@ -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);
+ }
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java
index 454fc23853..bfef053d85 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java
@@ -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);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java
index fef13704ef..e799bfb8bd 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java
@@ -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 {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleStatusCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleStatusCommand.java
index 0542583785..d27f90c129 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleStatusCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleStatusCommand.java
@@ -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 {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java
index fd8ddc941d..edc54ff4cc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java
@@ -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 {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java
index f94b2099a0..be705ee6dd 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java
@@ -109,7 +109,7 @@ public class SubmoduleUpdateCommand extends
return this;
}
- public Collection<String> call() throws JGitInternalException {
+ public Collection<String> call() throws GitAPIException {
checkCallable();
try {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java
index c867b53e8d..cef9e18349 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java
@@ -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();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/UnmergedPathsException.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/UnmergedPathsException.java
index 19101dbb05..0990040150 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/UnmergedPathsException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/UnmergedPathsException.java
@@ -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);
}
}