CherryPick: check for null with checkNotNull instead of checkState
Contrary to checkState, FindBugs recognises checkNotNull and will not raise warnings about subsequent dereferences of objects that could be null. Change-Id: I1c4edbcad2e6a8bc295ebead9aedd93c2d79654b
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
|
||||
package com.google.gerrit.server.git.strategy;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.gerrit.server.git.strategy.CommitMergeStatus.SKIPPED_IDENTICAL_TREE;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -151,7 +151,7 @@ public class CherryPick extends SubmitStrategy {
|
||||
&& toMerge.getStatusCode() == SKIPPED_IDENTICAL_TREE) {
|
||||
return null;
|
||||
}
|
||||
checkState(newCommit != null,
|
||||
checkNotNull(newCommit,
|
||||
"no new commit produced by CherryPick of %s, expected to fail fast",
|
||||
toMerge.change().getId());
|
||||
PatchSet prevPs = args.psUtil.current(ctx.getDb(), ctx.getNotes());
|
||||
|
||||
Reference in New Issue
Block a user