Skip to content

Commit

Permalink
fix for NPE with scope=WITHIN and compareVersion=NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerspitz committed Nov 15, 2021
1 parent 4feec7f commit c5e8cf0
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -69,7 +70,7 @@ private static boolean validateComparison(Map<String, Object> configMap, String
configMap.put(ConfigHandling.RANGE, compareRange);

if (compareScope.equals(Comparisons.Scope.WITHIN)) {
if (!compareVersion.equals(benchmarkVersion)) {
if (StringUtils.isNotEmpty(compareVersion) && !compareVersion.equals(benchmarkVersion)) {
compareVersion = benchmarkVersion;
configMap.put(ConfigHandling.COMPARE_VERSION, compareVersion);
logWarn("{} : mode={} - Compare scope set to WITHIN but compareVersion specified as a separate version, will ignore compareVersion",
Expand Down Expand Up @@ -174,11 +175,12 @@ public static void logComparison(State state, Map<String, Object> logConfigs, St
StringBuilder sb = new StringBuilder();
Scope scope = (Scope) logConfigs.get(ConfigHandling.SCOPE);
String compareVersion = (String) logConfigs.get(ConfigHandling.COMPARE_VERSION);
if (compareVersion.equals(ConfigHandling.DEFAULT_COMPARE_VERSION)) {
compareVersion = Requests.getPreviousVersion(benchmarkFingerprint);
}

sb.append("{} COMPARISON - {} : mode={} - method={} ({} version={}");
if (scope.equals(Scope.BETWEEN)) {
if (compareVersion.equals(ConfigHandling.DEFAULT_COMPARE_VERSION)) {
compareVersion = Requests.getPreviousVersion(benchmarkFingerprint);
}
sb.append(" and version=").append(compareVersion);
}
sb.append("), range={}");
Expand Down

0 comments on commit c5e8cf0

Please sign in to comment.