aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2014-12-12 13:02:27 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2014-12-12 13:02:27 +0100
commita24a99a13dc7bc256c9edc9703bc4a9d28b33ce7 (patch)
treed50d555866abbbb59eb2810d53eb1d5f2f9fc9a8 /org.eclipse.jgit/src/org
parent42b20d41271a8cd3e3b87513332f64cdd764e6e6 (diff)
downloadjgit-a24a99a13dc7bc256c9edc9703bc4a9d28b33ce7.tar.gz
jgit-a24a99a13dc7bc256c9edc9703bc4a9d28b33ce7.zip
Prevent NPE if ref can't be resolved when executing ReflogCommand
If the specified ref can't be resolved we should throw a RefNotFoundException instead of an NPE. Bug: 455005 Change-Id: I6ec9bf1c0f330eea5eb8277268f62663bdf58f66 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/ReflogCommand.java4
1 files changed, 4 insertions, 0 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 8cd78aebe1..4536af1be0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ReflogCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ReflogCommand.java
@@ -48,6 +48,7 @@ import java.util.Collection;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.InvalidRefNameException;
+import org.eclipse.jgit.api.errors.RefNotFoundException;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ReflogEntry;
@@ -97,6 +98,9 @@ public class ReflogCommand extends GitCommand<Collection<ReflogEntry>> {
try {
ReflogReader reader = repo.getReflogReader(ref);
+ if (reader == null)
+ throw new RefNotFoundException(MessageFormat.format(
+ JGitText.get().refNotResolved, ref));
return reader.getReverseEntries();
} catch (IOException e) {
throw new InvalidRefNameException(MessageFormat.format(