]> source.dussan.org Git - jgit.git/commitdiff
Throw invalid ref exception instead of invalid remote exception 49/4749/6
authorKevin Sawicki <kevin@github.com>
Tue, 6 Dec 2011 18:00:28 +0000 (10:00 -0800)
committerKevin Sawicki <kevin@github.com>
Thu, 8 Dec 2011 19:36:05 +0000 (11:36 -0800)
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

org.eclipse.jgit/src/org/eclipse/jgit/api/ReflogCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/errors/InvalidRefNameException.java

index bd16e3f9125e95738e86a1450300281f4b9f9303..8d0720742fc3782fbf47ec2162967cabd9182b8f 100644 (file)
@@ -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);
                }
        }
 
index 139c41cd5fdafef95ea9126a600da19f5ee0ad6c..287713c82caa3f946ced3222793f5eb25becb1f4 100644 (file)
@@ -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);
+       }
 }