diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2012-12-04 00:30:18 +0100 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org <gerrit@eclipse.org> | 2012-12-05 18:16:57 -0500 |
commit | 8d062dec0ca6815bd24457b02dbbc24f9dc143ee (patch) | |
tree | be9c8022c84e7d0c274df70bb7b7066679d48ff7 /org.eclipse.jgit | |
parent | 72ee3280e08ef9d4a99466f0dbd29f419b5445b7 (diff) | |
download | jgit-8d062dec0ca6815bd24457b02dbbc24f9dc143ee.tar.gz jgit-8d062dec0ca6815bd24457b02dbbc24f9dc143ee.zip |
[findBugs] Don't pass null for non-null parameter in RebaseCommand
Change-Id: Iee4d50aa9c6b75f9906d2c51a940ddc90a944192
Diffstat (limited to 'org.eclipse.jgit')
3 files changed, 7 insertions, 1 deletions
diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties index 3270267881..b4ba2e88a5 100644 --- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties +++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties @@ -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} 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 2cf759c5ff..0022672744 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java @@ -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(), diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java index 7caeba8beb..9843c2d1f6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java @@ -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; |