]> source.dussan.org Git - sonarqube.git/commitdiff
fix quality flaws
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Fri, 18 Dec 2015 09:00:18 +0000 (10:00 +0100)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Fri, 18 Dec 2015 09:00:18 +0000 (10:00 +0100)
server/sonar-server/src/main/java/org/sonar/server/computation/duplication/DuplicationRepositoryImpl.java
server/sonar-server/src/main/java/org/sonar/server/computation/duplication/IntegrateCrossProjectDuplications.java
server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueImpl.java
server/sonar-server/src/main/java/org/sonar/server/computation/step/LoadDuplicationsFromReportStep.java
sonar-testing-harness/src/main/java/org/sonar/test/ExceptionCauseMatcher.java

index 8659661d5fccc757cdc679248e0e975a2af517e9..f882391525809c2a30f622c98dd893053bd5ae29 100644 (file)
@@ -39,11 +39,11 @@ public class DuplicationRepositoryImpl implements DuplicationRepository {
   public Iterable<Duplication> getDuplications(Component file) {
     checkFileComponentArgument(file);
 
-    Collection<Duplication> duplications = this.duplications.asMap().get(file.getKey());
-    if (duplications == null) {
+    Collection<Duplication> res = this.duplications.asMap().get(file.getKey());
+    if (res == null) {
       return Collections.emptyList();
     }
-    return duplications;
+    return res;
   }
 
   @Override
index 2b2291a8685033bc79f6dbe59c1f055466ef047e..3eaef29ef450d7208fcb13406902477fdf560658 100644 (file)
@@ -173,7 +173,9 @@ public class IntegrateCrossProjectDuplications {
         LOGGER.warn("Too many duplication references on file {} for block at line {}. Keeping only the first {} references.",
           file.getKey(), originPart.getStartLine(), MAX_CLONE_PART_PER_GROUP);
       }
-      return counter++ <= MAX_CLONE_GROUP_PER_FILE;
+      boolean res = counter <= MAX_CLONE_GROUP_PER_FILE;
+      counter++;
+      return res;
     }
   }
 
index eee80fa2bb29f636f18ed046644609860b62b2cc..0021bbbea034da578e9480038d9bb13fad683d56 100644 (file)
@@ -191,7 +191,7 @@ public class CeQueueImpl implements CeQueue {
     }
   }
 
-  private void updateTaskResult(CeActivityDto activityDto, @Nullable CeTaskResult taskResult) {
+  private static void updateTaskResult(CeActivityDto activityDto, @Nullable CeTaskResult taskResult) {
     if (taskResult != null) {
       Long snapshotId = taskResult.getSnapshotId();
       if (snapshotId != null) {
index 540fc96fa07d27edba47590caaa6517ce9ae5b47..63d0fbcfb6af4f0cbe3bdf8b9cd580afa197da9f 100644 (file)
@@ -70,7 +70,8 @@ public class LoadDuplicationsFromReportStep implements ComputationStep {
           try {
             int idGenerator = 1;
             while (duplications.hasNext()) {
-              loadDuplications(file, duplications.next(), idGenerator++);
+              loadDuplications(file, duplications.next(), idGenerator);
+              idGenerator++;
             }
           } finally {
             duplications.close();
index 803e3527180fa8a8cc7f870592b3b50a4c24894f..14da5daa22d9301c94784e70a5caca9bfc0010f6 100644 (file)
@@ -70,7 +70,10 @@ public class ExceptionCauseMatcher extends TypeSafeMatcher<Throwable> {
     if (expectedMessage == null) {
       return true;
     }
-    return EXPECT_NO_MESSAGE_CONSTANT.equals(expectedMessage) ? item.getMessage() == null : item.getMessage().contains(expectedMessage);
+    if (EXPECT_NO_MESSAGE_CONSTANT.equals(expectedMessage)) {
+      return item.getMessage() == null;
+    }
+    return item.getMessage().contains(expectedMessage);
   }
 
   @Override