aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2017-08-18 22:10:07 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2017-08-21 21:39:21 +0200
commitc0ad2f9a1be5a558adb927d59c524793b67e6bba (patch)
tree9bccc64bf6f9c11a6cdf6be9f4867719204d2282
parentc6306ac45b9d9eb5940b8ebca400f948daf20c7d (diff)
downloadsonarqube-c0ad2f9a1be5a558adb927d59c524793b67e6bba.tar.gz
sonarqube-c0ad2f9a1be5a558adb927d59c524793b67e6bba.zip
SONAR-9734 fix Quality flaws
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReader.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReaderImpl.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/source/SourceLinesRepository.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/source/SourceLinesRepositoryImpl.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReaderImplTest.java3
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReaderRule.java4
6 files changed, 8 insertions, 9 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReader.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReader.java
index 1305f9d14a2..a4d52ff7535 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReader.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReader.java
@@ -19,7 +19,7 @@
*/
package org.sonar.server.computation.task.projectanalysis.batch;
-import com.google.common.base.Optional;
+import java.util.Optional;
import javax.annotation.CheckForNull;
import org.sonar.core.util.CloseableIterator;
import org.sonar.scanner.protocol.output.ScannerReport;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReaderImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReaderImpl.java
index 51f10103566..c98d75a7fda 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReaderImpl.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReaderImpl.java
@@ -19,7 +19,6 @@
*/
package org.sonar.server.computation.task.projectanalysis.batch;
-import com.google.common.base.Optional;
import com.google.common.base.Throwables;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.Parser;
@@ -29,6 +28,7 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.NoSuchElementException;
+import java.util.Optional;
import javax.annotation.CheckForNull;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
@@ -144,7 +144,7 @@ public class BatchReportReaderImpl implements BatchReportReader {
ensureInitialized();
File file = delegate.readFileSource(fileRef);
if (file == null) {
- return Optional.absent();
+ return Optional.empty();
}
try {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/source/SourceLinesRepository.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/source/SourceLinesRepository.java
index 7f19f857058..50260afa797 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/source/SourceLinesRepository.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/source/SourceLinesRepository.java
@@ -29,7 +29,7 @@ public interface SourceLinesRepository {
* <p>
* The returned {@link CloseableIterator} will wrap the {@link CloseableIterator} returned by
* {@link org.sonar.server.computation.task.projectanalysis.batch.BatchReportReader#readFileSource(int)} but enforces that the number
- * of lines specified by {@link org.sonar.batch.protocol.output.ScannerReport.Component#getLines()} is respected, adding
+ * of lines specified by {@link org.sonar.scanner.protocol.output.ScannerReport.Component#getLines()} is respected, adding
* an extra empty last line if required.
* </p>
*
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/source/SourceLinesRepositoryImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/source/SourceLinesRepositoryImpl.java
index cba254cb716..9753c2d81b5 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/source/SourceLinesRepositoryImpl.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/source/SourceLinesRepositoryImpl.java
@@ -19,7 +19,7 @@
*/
package org.sonar.server.computation.task.projectanalysis.source;
-import com.google.common.base.Optional;
+import java.util.Optional;
import org.sonar.core.util.CloseableIterator;
import org.sonar.server.computation.task.projectanalysis.batch.BatchReportReader;
import org.sonar.server.computation.task.projectanalysis.component.Component;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReaderImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReaderImplTest.java
index 5366c016a36..f05dbebfea2 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReaderImplTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReaderImplTest.java
@@ -32,7 +32,6 @@ import org.sonar.scanner.protocol.output.ScannerReportWriter;
import static com.google.common.collect.ImmutableList.of;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.guava.api.Assertions.assertThat;
public class BatchReportReaderImplTest {
private static final int COMPONENT_REF = 1;
@@ -275,7 +274,7 @@ public class BatchReportReaderImplTest {
@Test
public void readFileSource_returns_absent_optional_when_file_does_not_exist() {
- assertThat(underTest.readFileSource(COMPONENT_REF)).isAbsent();
+ assertThat(underTest.readFileSource(COMPONENT_REF)).isEmpty();
}
@Test
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReaderRule.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReaderRule.java
index 4018c9259c3..40c995edc1f 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReaderRule.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/batch/BatchReportReaderRule.java
@@ -19,7 +19,6 @@
*/
package org.sonar.server.computation.task.projectanalysis.batch;
-import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.Arrays;
@@ -27,6 +26,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import java.util.Optional;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.junit.rules.TestRule;
@@ -246,7 +246,7 @@ public class BatchReportReaderRule implements TestRule, BatchReportReader {
public Optional<CloseableIterator<String>> readFileSource(int fileRef) {
List<String> lines = fileSources.get(fileRef);
if (lines == null) {
- return Optional.absent();
+ return Optional.empty();
}
return Optional.of(CloseableIterator.from(lines.iterator()));