]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-19648 Fix NPE when task in progress has no entityUuid
authorEric Giffon <eric.giffon@sonarsource.com>
Wed, 2 Aug 2023 10:06:47 +0000 (12:06 +0200)
committersonartech <sonartech@sonarsource.com>
Fri, 4 Aug 2023 20:04:15 +0000 (20:04 +0000)
server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java

index 4de52967eb51a797df4bce992684621686c1cb60..5cee35d26d79706a694a03d61b51a751f4f61913 100644 (file)
@@ -122,7 +122,7 @@ public class NextPendingTaskPicker {
   private static boolean canRunBranch(PrOrBranchTask task, List<PrOrBranchTask> inProgress) {
     String entityUuid = task.getEntityUuid();
     List<PrOrBranchTask> sameComponentTasks = inProgress.stream()
-      .filter(t -> t.getEntityUuid().equals(entityUuid))
+      .filter(t -> Objects.equals(t.getEntityUuid(), entityUuid))
       .toList();
     //we can peek branch analysis task only if all the other in progress tasks for this component uuid are pull requests
     return sameComponentTasks.stream().map(PrOrBranchTask::getBranchType).allMatch(s -> Objects.equals(s, PULL_REQUEST));
@@ -135,7 +135,8 @@ public class NextPendingTaskPicker {
   private static boolean canRunPr(PrOrBranchTask task, List<PrOrBranchTask> inProgress) {
     // return true unless the same PR is already in progress
     return inProgress.stream()
-      .noneMatch(pr -> pr.getEntityUuid().equals(task.getEntityUuid()) && Objects.equals(pr.getBranchType(), PULL_REQUEST) &&
-        Objects.equals(pr.getComponentUuid(), (task.getComponentUuid())));
+      .noneMatch(pr -> Objects.equals(pr.getEntityUuid(), task.getEntityUuid())
+        && Objects.equals(pr.getBranchType(), PULL_REQUEST)
+        && Objects.equals(pr.getComponentUuid(), task.getComponentUuid()));
   }
 }