diff options
5 files changed, 13 insertions, 7 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/duplication/DuplicationRepositoryImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/duplication/DuplicationRepositoryImpl.java index 8659661d5fc..f8823915258 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/duplication/DuplicationRepositoryImpl.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/duplication/DuplicationRepositoryImpl.java @@ -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 diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/duplication/IntegrateCrossProjectDuplications.java b/server/sonar-server/src/main/java/org/sonar/server/computation/duplication/IntegrateCrossProjectDuplications.java index 2b2291a8685..3eaef29ef45 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/duplication/IntegrateCrossProjectDuplications.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/duplication/IntegrateCrossProjectDuplications.java @@ -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; } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueImpl.java index eee80fa2bb2..0021bbbea03 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueImpl.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueImpl.java @@ -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) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/LoadDuplicationsFromReportStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/LoadDuplicationsFromReportStep.java index 540fc96fa07..63d0fbcfb6a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/LoadDuplicationsFromReportStep.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/LoadDuplicationsFromReportStep.java @@ -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(); diff --git a/sonar-testing-harness/src/main/java/org/sonar/test/ExceptionCauseMatcher.java b/sonar-testing-harness/src/main/java/org/sonar/test/ExceptionCauseMatcher.java index 803e3527180..14da5daa22d 100644 --- a/sonar-testing-harness/src/main/java/org/sonar/test/ExceptionCauseMatcher.java +++ b/sonar-testing-harness/src/main/java/org/sonar/test/ExceptionCauseMatcher.java @@ -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 |