aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-ce-task-projectanalysis
diff options
context:
space:
mode:
authorZipeng WU <zipeng.wu@sonarsource.com>2020-12-08 17:15:51 +0100
committersonartech <sonartech@sonarsource.com>2020-12-09 20:07:21 +0000
commitbebc9fdb1fed6713073517eb1fa9b003c7bd34ae (patch)
tree3df1ce8c7080082c83a1b353bbdc71d1da831f74 /server/sonar-ce-task-projectanalysis
parent2ac64829407349d696108c9d09c70d7ea2ad266a (diff)
downloadsonarqube-bebc9fdb1fed6713073517eb1fa9b003c7bd34ae.tar.gz
sonarqube-bebc9fdb1fed6713073517eb1fa9b003c7bd34ae.zip
Fix optional get without ifPresent check
Diffstat (limited to 'server/sonar-ce-task-projectanalysis')
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepositoryImpl.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepositoryImpl.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepositoryImpl.java
index 513f7481a40..3347430b736 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepositoryImpl.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepositoryImpl.java
@@ -113,7 +113,7 @@ public class MeasureRepositoryImpl implements MeasureRepository {
String metricKey = batchMeasure.getMetricKey();
if (reportMetricValidator.validate(metricKey)) {
Metric metric = metricRepository.getByKey(metricKey);
- delegate.add(component, metric, batchMeasureToMeasure.toMeasure(batchMeasure, metric).get(), OverridePolicy.DO_NOT_OVERRIDE);
+ batchMeasureToMeasure.toMeasure(batchMeasure, metric).ifPresent(measure -> delegate.add(component, metric, measure, OverridePolicy.DO_NOT_OVERRIDE));
}
}
}