From: Eric Giffon Date: Wed, 2 Aug 2023 10:06:47 +0000 (+0200) Subject: SONAR-19648 Fix NPE when task in progress has no entityUuid X-Git-Tag: 10.2.0.77647~256 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=932150f352021fd893fd72f275406254da94be44;p=sonarqube.git SONAR-19648 Fix NPE when task in progress has no entityUuid --- diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java b/server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java index 4de52967eb5..5cee35d26d7 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java @@ -122,7 +122,7 @@ public class NextPendingTaskPicker { private static boolean canRunBranch(PrOrBranchTask task, List inProgress) { String entityUuid = task.getEntityUuid(); List 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 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())); } }