aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2016-11-09 09:43:06 +0100
committerDuarte Meneses <duarte.meneses@sonarsource.com>2016-11-09 09:43:08 +0100
commitd23cb6ddfee1c0e88f85696b200ae90e4ac5b5db (patch)
treeafd48646de7ec12cbd8738d5c71084576b4dbf6a
parent7941a52aeb459349a6baedc7de780edcc1d0f295 (diff)
downloadsonarqube-d23cb6ddfee1c0e88f85696b200ae90e4ac5b5db.tar.gz
sonarqube-d23cb6ddfee1c0e88f85696b200ae90e4ac5b5db.zip
Improve quality
-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;
}
}