aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki <kevin@github.com>2011-12-06 10:00:28 -0800
committerKevin Sawicki <kevin@github.com>2011-12-08 11:36:05 -0800
commit4535a9e2a32c0c3b9f74c76998474fae4e57b321 (patch)
treeffbefe10de0ca639caf551b5af133b80f3635ae8
parent47d16163747e322b2445887e1436e0f766649c34 (diff)
downloadjgit-4535a9e2a32c0c3b9f74c76998474fae4e57b321.tar.gz
jgit-4535a9e2a32c0c3b9f74c76998474fae4e57b321.zip
Throw invalid ref exception instead of invalid remote exception
ReflogCommand command was throwing an incorrect exception type when an IOException was wrapped and rethrown from the underlying ReflogReader. The IOException cause is now provided to the thrown exception as well. Change-Id: I9f1842c2d414d3e9c658843f9b448bc18891748e
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/ReflogCommand.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/errors/InvalidRefNameException.java8
2 files changed, 11 insertions, 3 deletions
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 bd16e3f912..8d0720742f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ReflogCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ReflogCommand.java
@@ -47,7 +47,7 @@ import java.text.MessageFormat;
import java.util.Collection;
import org.eclipse.jgit.JGitText;
-import org.eclipse.jgit.api.errors.InvalidRemoteException;
+import org.eclipse.jgit.api.errors.InvalidRefNameException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.storage.file.ReflogEntry;
@@ -91,8 +91,8 @@ public class ReflogCommand extends GitCommand<Collection<ReflogEntry>> {
ReflogReader reader = new ReflogReader(repo, ref);
return reader.getReverseEntries();
} catch (IOException e) {
- throw new InvalidRemoteException(MessageFormat.format(
- JGitText.get().cannotRead, ref));
+ throw new InvalidRefNameException(MessageFormat.format(
+ JGitText.get().cannotRead, ref), e);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/InvalidRefNameException.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/InvalidRefNameException.java
index 139c41cd5f..287713c82c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/InvalidRefNameException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/InvalidRefNameException.java
@@ -49,4 +49,12 @@ public class InvalidRefNameException extends GitAPIException {
public InvalidRefNameException(String msg) {
super(msg);
}
+
+ /**
+ * @param msg
+ * @param cause
+ */
+ public InvalidRefNameException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
}