Fix NPE in MergeabilityCache.getIfPresent

LoadingCache.getIfPresent is explicitly @Nullable. Unfortunately, when
it returned null, it was being unboxed to a boolean, causing an NPE.

This bug has been around since the mergeability implementation was
rewritten, but has likely not been very common because mergeability
bits are computed pretty aggressively (if asynchronously).

Change-Id: Ie3d8e16db76b28056832c002ab0899072d0ea356
This commit is contained in:
Dave Borowitz
2015-04-01 12:36:45 -07:00
parent 521b5fd7c4
commit 4193e33184
2 changed files with 3 additions and 3 deletions

View File

@@ -33,7 +33,7 @@ public interface MergeabilityCache {
}
@Override
public boolean getIfPresent(ObjectId commit, Ref intoRef,
public Boolean getIfPresent(ObjectId commit, Ref intoRef,
SubmitType submitType, String mergeStrategy) {
throw new UnsupportedOperationException("Mergeability checking disabled");
}
@@ -42,6 +42,6 @@ public interface MergeabilityCache {
public boolean get(ObjectId commit, Ref intoRef, SubmitType submitType,
String mergeStrategy, Branch.NameKey dest, Repository repo, ReviewDb db);
public boolean getIfPresent(ObjectId commit, Ref intoRef,
public Boolean getIfPresent(ObjectId commit, Ref intoRef,
SubmitType submitType, String mergeStrategy);
}