diff options
author | Eric Giffon <eric.giffon@sonarsource.com> | 2023-08-02 12:06:47 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-08-04 20:04:15 +0000 |
commit | 932150f352021fd893fd72f275406254da94be44 (patch) | |
tree | 45cb5693f5ccd08ce31d732cf607e069d19793c1 /server/sonar-ce | |
parent | 6365d7447e159d3cc255e381b67894f3827bcd6c (diff) | |
download | sonarqube-932150f352021fd893fd72f275406254da94be44.tar.gz sonarqube-932150f352021fd893fd72f275406254da94be44.zip |
SONAR-19648 Fix NPE when task in progress has no entityUuid
Diffstat (limited to 'server/sonar-ce')
-rw-r--r-- | server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java | 7 |
1 files changed, 4 insertions, 3 deletions
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<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())); } } |