]> source.dussan.org Git - jgit.git/commitdiff
[findBugs] Don't pass null for non-null parameter in RebaseCommand 16/9016/2
authorMatthias Sohn <matthias.sohn@sap.com>
Mon, 3 Dec 2012 23:30:18 +0000 (00:30 +0100)
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>
Wed, 5 Dec 2012 23:16:57 +0000 (18:16 -0500)
Change-Id: Iee4d50aa9c6b75f9906d2c51a940ddc90a944192

org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java

index 3270267881c722cfcf12041bb46034037ed79e15..b4ba2e88a504528c3828d2233f5337d4b1ffb5d3 100644 (file)
@@ -1,6 +1,7 @@
 abbreviationLengthMustBeNonNegative=Abbreviation length must not be negative.
 abortingRebase=Aborting rebase: resetting to {0}
 abortingRebaseFailed=Could not abort rebase
+abortingRebaseFailedNoOrigHead=Could not abort rebase since ORIG_HEAD is null
 advertisementCameBefore=advertisement of {0}^{} came before {1}
 advertisementOfCameBefore=advertisement of {0}^{} came before {1}
 amazonS3ActionFailed={0} of ''{1}'' failed: {2} {3}
index 2cf759c5ff28f81e2570a32017ae142732581bf0..0022672744aad3cbbb5480422c8a42026f59c0cf 100644 (file)
@@ -822,7 +822,11 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
                                        ProgressMonitor.UNKNOWN);
 
                        DirCacheCheckout dco;
-                       RevCommit commit = walk.parseCommit(repo.resolve(commitId));
+                       if (commitId == null)
+                               throw new JGitInternalException(
+                                               JGitText.get().abortingRebaseFailedNoOrigHead);
+                       ObjectId id = repo.resolve(commitId);
+                       RevCommit commit = walk.parseCommit(id);
                        if (result.getStatus().equals(Status.FAILED)) {
                                RevCommit head = walk.parseCommit(repo.resolve(Constants.HEAD));
                                dco = new DirCacheCheckout(repo, head.getTree(),
index 7caeba8bebaab3f24d854d51388b9a1bbcbc87a7..9843c2d1f6a0e5caefcfc6ae2d7d476dac7d84b9 100644 (file)
@@ -62,6 +62,7 @@ public class JGitText extends TranslationBundle {
        /***/ public String abbreviationLengthMustBeNonNegative;
        /***/ public String abortingRebase;
        /***/ public String abortingRebaseFailed;
+       /***/ public String abortingRebaseFailedNoOrigHead;
        /***/ public String advertisementCameBefore;
        /***/ public String advertisementOfCameBefore;
        /***/ public String amazonS3ActionFailed;