aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/cpd/deprecated/JavaCpdBlockIndexer.java4
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectBuildersExecutor.java3
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/measure/MeasureValueCoder.java3
3 files changed, 4 insertions, 6 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/cpd/deprecated/JavaCpdBlockIndexer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/cpd/deprecated/JavaCpdBlockIndexer.java
index b1717e8b82e..635b1248b70 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/cpd/deprecated/JavaCpdBlockIndexer.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/cpd/deprecated/JavaCpdBlockIndexer.java
@@ -23,6 +23,7 @@ import com.google.common.collect.Lists;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.List;
@@ -90,7 +91,8 @@ public class JavaCpdBlockIndexer extends CpdBlockIndexer {
List<Statement> statements;
- try (Reader reader = new InputStreamReader(new FileInputStream(inputFile.file()), fs.encoding())) {
+ try (InputStream is = new FileInputStream(inputFile.file());
+ Reader reader = new InputStreamReader(is, fs.encoding())) {
statements = statementChunker.chunk(tokenChunker.chunk(reader));
} catch (FileNotFoundException e) {
throw new IllegalStateException("Cannot find file " + inputFile.file(), e);
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectBuildersExecutor.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectBuildersExecutor.java
index 19fad3cfdfb..2790d095511 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectBuildersExecutor.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectBuildersExecutor.java
@@ -60,9 +60,6 @@ public class ProjectBuildersExecutor {
}
private static String getDescription(ProjectBuilder projectBuilder) {
- if (projectBuilder == null) {
- return null;
- }
Method toString;
try {
toString = projectBuilder.getClass().getMethod("toString");
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/measure/MeasureValueCoder.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/measure/MeasureValueCoder.java
index 15655a1f46c..cdeb31e1877 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/measure/MeasureValueCoder.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/measure/MeasureValueCoder.java
@@ -49,9 +49,8 @@ class MeasureValueCoder implements ValueCoder {
if (metric == null) {
throw new IllegalStateException("Unknow metric with key " + metricKey);
}
- DefaultMeasure<?> m = new DefaultMeasure()
+ return new DefaultMeasure()
.forMetric(metric)
.withValue((Serializable) value.get());
- return m;
}
}