aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/api
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2012-06-05 16:52:49 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2012-06-05 16:55:39 +0200
commitb61d35e848e637ef85fde4ebe95d60ced171e963 (patch)
treef62e5736dda647d06def29b0cee6680a81c9dd56 /org.eclipse.jgit/src/org/eclipse/jgit/api
parent1c0ac7cd10750e3c82eff61201cfc3ba91b203da (diff)
downloadjgit-b61d35e848e637ef85fde4ebe95d60ced171e963.tar.gz
jgit-b61d35e848e637ef85fde4ebe95d60ced171e963.zip
Further cleanup of exceptions in Git API
- Translate internal exceptions to corresponding API exception - Do not catch GitAPI exceptions internally to an internal exception. Just pass them to caller - Mention thrown exceptions in javadoc Change-Id: I9044cf86d2b0bcc8b63b7cc016e1bf0055a62053 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java14
-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.java15
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java61
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java14
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/ReflogCommand.java9
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java13
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/StashDropCommand.java1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/StashListCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java32
17 files changed, 129 insertions, 65 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java
index 8658b0709b..32abf86edc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java
@@ -102,8 +102,12 @@ public class ApplyCommand extends GitCommand<ApplyResult> {
* method twice on an instance.
*
* @return an {@link ApplyResult} object representing the command result
+ * @throws GitAPIException
+ * @throws PatchFormatException
+ * @throws PatchApplyException
*/
- public ApplyResult call() throws GitAPIException {
+ public ApplyResult call() throws GitAPIException, PatchFormatException,
+ PatchApplyException {
checkCallable();
ApplyResult r = new ApplyResult();
try {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
index 41265e8328..b5bf119082 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
@@ -47,10 +47,14 @@ import java.text.MessageFormat;
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.MultipleParentsNotAllowedException;
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.DirCacheCheckout;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.AnyObjectId;
@@ -94,8 +98,16 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> {
* invocation of the command. Don't call this method twice on an instance.
*
* @return the result of the cherry-pick
+ * @throws GitAPIException
+ * @throws WrongRepositoryStateException
+ * @throws ConcurrentRefUpdateException
+ * @throws UnmergedPathsException
+ * @throws NoMessageException
+ * @throws NoHeadException
*/
- public CherryPickResult call() throws GitAPIException {
+ public CherryPickResult call() throws GitAPIException, NoMessageException,
+ UnmergedPathsException, ConcurrentRefUpdateException,
+ WrongRepositoryStateException, NoHeadException {
RevCommit newHead = null;
List<Ref> cherryPickedRefs = new LinkedList<Ref>();
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 341be91da6..1c19e93736 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java
@@ -51,6 +51,7 @@ import java.util.TreeSet;
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.Repository;
import org.eclipse.jgit.util.FileUtils;
@@ -81,8 +82,10 @@ public class CleanCommand extends GitCommand<Set<String>> {
* call to {@link #call()})
*
* @return a set of strings representing each file cleaned.
+ * @throws GitAPIException
+ * @throws NoWorkTreeException
*/
- public Set<String> call() throws GitAPIException {
+ public Set<String> call() throws NoWorkTreeException, GitAPIException {
Set<String> files = new TreeSet<String>();
try {
StatusCommand command = new StatusCommand(repo);
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 23bbc2aa9c..067e92a960 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
@@ -113,8 +113,12 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
* Executes the {@code Clone} command.
*
* @return the newly created {@code Git} object with associated repository
+ * @throws InvalidRemoteException
+ * @throws org.eclipse.jgit.api.errors.TransportException
+ * @throws GitAPIException
*/
- public Git call() throws GitAPIException {
+ public Git call() throws GitAPIException, InvalidRemoteException,
+ org.eclipse.jgit.api.errors.TransportException {
try {
URIish u = new URIish(uri);
Repository repository = init(u);
@@ -124,10 +128,9 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
return new Git(repository);
} catch (IOException ioe) {
throw new JGitInternalException(ioe.getMessage(), ioe);
- } catch (InvalidRemoteException e) {
- throw new JGitInternalException(e.getMessage(), e);
} catch (URISyntaxException e) {
- throw new JGitInternalException(e.getMessage(), e);
+ throw new InvalidRemoteException(MessageFormat.format(
+ JGitText.get().invalidRemote, remote));
}
}
@@ -144,7 +147,9 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
}
private FetchResult fetch(Repository clonedRepo, URIish u)
- throws URISyntaxException, IOException, GitAPIException {
+ throws URISyntaxException,
+ org.eclipse.jgit.api.errors.TransportException, IOException,
+ GitAPIException {
// create the remote config and save it
RemoteConfig config = new RemoteConfig(clonedRepo.getConfig(), remote);
config.addURI(u);
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 6df244bcc3..69c4923723 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java
@@ -135,8 +135,7 @@ public class FetchCommand extends TransportCommand<FetchCommand, FetchResult> {
JGitText.get().invalidRemote, remote), e);
} catch (TransportException e) {
throw new org.eclipse.jgit.api.errors.TransportException(
- JGitText.get().exceptionCaughtDuringExecutionOfFetchCommand,
- e);
+ e.getMessage(), e);
} catch (URISyntaxException e) {
throw new InvalidRemoteException(MessageFormat.format(
JGitText.get().invalidRemote, remote));
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 b041f33c4c..c450ea962c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java
@@ -148,6 +148,7 @@ public class LsRemoteCommand extends
* for errors that occurs during transport
*/
public Collection<Ref> call() throws GitAPIException,
+ InvalidRemoteException,
org.eclipse.jgit.api.errors.TransportException {
checkCallable();
@@ -186,8 +187,8 @@ public class LsRemoteCommand extends
JGitText.get().exceptionCaughtDuringExecutionOfLsRemoteCommand,
e);
} catch (TransportException e) {
- throw new org.eclipse.jgit.api.errors.TransportException(
- JGitText.get().exceptionCaughtDuringExecutionOfLsRemoteCommand,
+ throw new org.eclipse.jgit.api.errors.TransportException(
+ e.getMessage(),
e);
} finally {
if (fc != null)
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 86d38fb36c..fa425d37fb 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
@@ -48,16 +48,12 @@ import java.text.MessageFormat;
import org.eclipse.jgit.api.RebaseCommand.Operation;
import org.eclipse.jgit.api.errors.CanceledException;
-import org.eclipse.jgit.api.errors.CheckoutConflictException;
-import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
import org.eclipse.jgit.api.errors.DetachedHeadException;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.InvalidConfigurationException;
-import org.eclipse.jgit.api.errors.InvalidMergeHeadsException;
import org.eclipse.jgit.api.errors.InvalidRemoteException;
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.RefNotFoundException;
import org.eclipse.jgit.api.errors.WrongRepositoryStateException;
import org.eclipse.jgit.internal.JGitText;
@@ -109,11 +105,21 @@ public class PullCommand extends TransportCommand<PullCommand, PullResult> {
* command. Don't call this method twice on an instance.
*
* @return the result of the pull
+ * @throws WrongRepositoryStateException
+ * @throws InvalidConfigurationException
+ * @throws DetachedHeadException
+ * @throws InvalidRemoteException
+ * @throws CanceledException
+ * @throws RefNotFoundException
+ * @throws NoHeadException
+ * @throws org.eclipse.jgit.api.errors.TransportException
+ * @throws GitAPIException
*/
- public PullResult call() throws GitAPIException, WrongRepositoryStateException,
- InvalidConfigurationException, DetachedHeadException,
- InvalidRemoteException, CanceledException, RefNotFoundException,
- NoHeadException {
+ public PullResult call() throws GitAPIException,
+ WrongRepositoryStateException, InvalidConfigurationException,
+ DetachedHeadException, InvalidRemoteException, CanceledException,
+ RefNotFoundException, NoHeadException,
+ org.eclipse.jgit.api.errors.TransportException {
checkCallable();
monitor.beginTask(JGitText.get().pullTaskName, 2);
@@ -239,44 +245,19 @@ public class PullCommand extends TransportCommand<PullCommand, PullResult> {
PullResult result;
if (doRebase) {
RebaseCommand rebase = new RebaseCommand(repo);
- try {
- RebaseResult rebaseRes = rebase.setUpstream(commitToMerge)
- .setProgressMonitor(monitor).setOperation(
- Operation.BEGIN).call();
- result = new PullResult(fetchRes, remote, rebaseRes);
- } catch (NoHeadException e) {
- throw new JGitInternalException(e.getMessage(), e);
- } catch (RefNotFoundException e) {
- throw new JGitInternalException(e.getMessage(), e);
- } catch (JGitInternalException e) {
- throw new JGitInternalException(e.getMessage(), e);
- } catch (GitAPIException e) {
- throw new JGitInternalException(e.getMessage(), e);
- }
+ RebaseResult rebaseRes = rebase.setUpstream(commitToMerge)
+ .setProgressMonitor(monitor).setOperation(Operation.BEGIN)
+ .call();
+ result = new PullResult(fetchRes, remote, rebaseRes);
} else {
MergeCommand merge = new MergeCommand(repo);
String name = "branch \'"
+ Repository.shortenRefName(remoteBranchName) + "\' of "
+ remoteUri;
merge.include(name, commitToMerge);
- MergeResult mergeRes;
- try {
- mergeRes = merge.call();
- monitor.update(1);
- result = new PullResult(fetchRes, remote, mergeRes);
- } catch (NoHeadException e) {
- throw new JGitInternalException(e.getMessage(), e);
- } catch (ConcurrentRefUpdateException e) {
- throw new JGitInternalException(e.getMessage(), e);
- } catch (CheckoutConflictException e) {
- throw new JGitInternalException(e.getMessage(), e);
- } catch (InvalidMergeHeadsException e) {
- throw new JGitInternalException(e.getMessage(), e);
- } catch (WrongRepositoryStateException e) {
- throw new JGitInternalException(e.getMessage(), e);
- } catch (NoMessageException e) {
- throw new JGitInternalException(e.getMessage(), e);
- }
+ MergeResult mergeRes = merge.call();
+ monitor.update(1);
+ result = new PullResult(fetchRes, remote, mergeRes);
}
monitor.endTask();
return result;
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 edfb2f7b75..1a4058e12d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java
@@ -109,9 +109,13 @@ public class PushCommand extends
* @return an iteration over {@link PushResult} objects
* @throws InvalidRemoteException
* when called with an invalid remote uri
+ * @throws org.eclipse.jgit.api.errors.TransportException
+ * when an error occurs with the transport
+ * @throws GitAPIException
*/
public Iterable<PushResult> call() throws GitAPIException,
- InvalidRemoteException {
+ InvalidRemoteException,
+ org.eclipse.jgit.api.errors.TransportException {
checkCallable();
ArrayList<PushResult> pushResults = new ArrayList<PushResult>(3);
@@ -150,9 +154,8 @@ public class PushCommand extends
pushResults.add(result);
} catch (TransportException e) {
- throw new JGitInternalException(
- JGitText.get().exceptionCaughtDuringExecutionOfPushCommand,
- e);
+ throw new org.eclipse.jgit.api.errors.TransportException(
+ e.getMessage(), e);
} finally {
transport.close();
}
@@ -161,6 +164,9 @@ public class PushCommand extends
} catch (URISyntaxException e) {
throw new InvalidRemoteException(MessageFormat.format(
JGitText.get().invalidRemote, remote));
+ } catch (TransportException e) {
+ throw new org.eclipse.jgit.api.errors.TransportException(
+ e.getMessage(), e);
} catch (NotSupportedException e) {
throw new JGitInternalException(
JGitText.get().exceptionCaughtDuringExecutionOfPushCommand,
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 ecf85932e9..645c9ff1fc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
@@ -189,9 +189,13 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
* this method twice on an instance.
*
* @return an object describing the result of this command
+ * @throws GitAPIException
+ * @throws WrongRepositoryStateException
+ * @throws NoHeadException
+ * @throws RefNotFoundException
*/
public RebaseResult call() throws GitAPIException, NoHeadException,
- RefNotFoundException {
+ RefNotFoundException, WrongRepositoryStateException {
RevCommit newHead = null;
boolean lastStepWasForward = false;
checkCallable();
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 c4d112a319..ef344b5c35 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ReflogCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ReflogCommand.java
@@ -85,7 +85,14 @@ public class ReflogCommand extends GitCommand<Collection<ReflogEntry>> {
return this;
}
- public Collection<ReflogEntry> call() throws GitAPIException {
+ /**
+ * Run the reflog command
+ *
+ * @throws GitAPIException
+ * @throws InvalidRefNameException
+ */
+ public Collection<ReflogEntry> call() throws GitAPIException,
+ InvalidRefNameException {
checkCallable();
try {
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 24984803ff..b34b902cec 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java
@@ -136,6 +136,7 @@ public class ResetCommand extends GitCommand<Ref> {
* twice on an instance.
*
* @return the Ref after reset
+ * @throws GitAPIException
*/
public Ref call() throws GitAPIException, CheckoutConflictException {
checkCallable();
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 416677c406..fde6b94d2d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
@@ -49,10 +49,14 @@ import java.util.List;
import java.util.Map;
import org.eclipse.jgit.api.MergeResult.MergeStatus;
+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.MultipleParentsNotAllowedException;
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.DirCacheCheckout;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.AnyObjectId;
@@ -105,8 +109,15 @@ public class RevertCommand extends GitCommand<RevCommit> {
* returned. If a failure occurred during revert <code>null</code>
* is returned. The list of successfully reverted {@link Ref}'s can
* be obtained by calling {@link #getRevertedRefs()}
+ * @throws GitAPIException
+ * @throws WrongRepositoryStateException
+ * @throws ConcurrentRefUpdateException
+ * @throws UnmergedPathsException
+ * @throws NoMessageException
*/
- public RevCommit call() throws GitAPIException {
+ public RevCommit call() throws NoMessageException, UnmergedPathsException,
+ ConcurrentRefUpdateException, WrongRepositoryStateException,
+ GitAPIException {
RevCommit newHead = null;
checkCallable();
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 4992d3ccd3..c26a48525d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
@@ -296,8 +296,11 @@ public class StashApplyCommand extends GitCommand<ObjectId> {
* Apply the changes in a stashed commit to the working directory and index
*
* @return id of stashed commit that was applied
+ * @throws GitAPIException
+ * @throws WrongRepositoryStateException
*/
- public ObjectId call() throws GitAPIException {
+ public ObjectId call() throws GitAPIException,
+ WrongRepositoryStateException {
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 4056894c9d..4c7ae6ade2 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java
@@ -211,6 +211,7 @@ public class StashCreateCommand extends GitCommand<RevCommit> {
* and reset to the current HEAD commit.
*
* @return stashed commit or null if no changes to stash
+ * @throws GitAPIException
*/
public RevCommit call() throws GitAPIException {
checkCallable();
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 eb61298e2c..dde736bb5f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashDropCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashDropCommand.java
@@ -167,6 +167,7 @@ public class StashDropCommand extends GitCommand<ObjectId> {
* stash reference after the drop occurs
*
* @return commit id of stash reference or null if no more stashed changes
+ * @throws GitAPIException
*/
public ObjectId call() throws GitAPIException {
checkCallable();
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 407b5ab1ee..697790596c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashListCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashListCommand.java
@@ -76,7 +76,8 @@ public class StashListCommand extends GitCommand<Collection<RevCommit>> {
super(repo);
}
- public Collection<RevCommit> call() throws GitAPIException {
+ public Collection<RevCommit> call() throws GitAPIException,
+ InvalidRefNameException {
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 be705ee6dd..caf2cedc4e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java
@@ -47,8 +47,16 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+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.InvalidConfigurationException;
+import org.eclipse.jgit.api.errors.InvalidMergeHeadsException;
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.RefNotFoundException;
+import org.eclipse.jgit.api.errors.WrongRepositoryStateException;
import org.eclipse.jgit.dircache.DirCacheCheckout;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.lib.ConfigConstants;
@@ -109,7 +117,25 @@ public class SubmoduleUpdateCommand extends
return this;
}
- public Collection<String> call() throws GitAPIException {
+ /**
+ * Execute the SubmoduleUpdateCommand command.
+ *
+ * @return a collection of updated submodule paths
+ * @throws ConcurrentRefUpdateException
+ * @throws CheckoutConflictException
+ * @throws InvalidMergeHeadsException
+ * @throws InvalidConfigurationException
+ * @throws NoHeadException
+ * @throws NoMessageException
+ * @throws RefNotFoundException
+ * @throws WrongRepositoryStateException
+ * @throws GitAPIException
+ */
+ public Collection<String> call() throws InvalidConfigurationException,
+ NoHeadException, ConcurrentRefUpdateException,
+ CheckoutConflictException, InvalidMergeHeadsException,
+ WrongRepositoryStateException, NoMessageException, NoHeadException,
+ RefNotFoundException, GitAPIException {
checkCallable();
try {
@@ -168,9 +194,7 @@ public class SubmoduleUpdateCommand extends
} catch (IOException e) {
throw new JGitInternalException(e.getMessage(), e);
} catch (ConfigInvalidException e) {
- throw new JGitInternalException(e.getMessage(), e);
- } catch (GitAPIException e) {
- throw new JGitInternalException(e.getMessage(), e);
+ throw new InvalidConfigurationException(e.getMessage(), e);
}
}
}