Skip to content

Commit

Permalink
NPE during the release of a lock (#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
mPokornyETM authored Jan 4, 2024
1 parent b7a1b4e commit 3d55a36
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ public static void updateAction(Run<?, ?> build, List<String> resourceNames) {

for (String name : resourceNames) {
LockableResource r = LockableResourcesManager.get().fromName(name);
action.add(new ResourcePOJO(r));
if (r != null) {

Check warning on line 80 in src/main/java/org/jenkins/plugins/lockableresources/actions/LockedResourcesBuildAction.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 80 is only partially covered, one branch is missing
action.add(new ResourcePOJO(r));
} else {
// probably a ephemeral resource has been deleted
action.add(new ResourcePOJO(name, ""));

Check warning on line 84 in src/main/java/org/jenkins/plugins/lockableresources/actions/LockedResourcesBuildAction.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 84 is not covered by tests
}
}
}

Expand All @@ -101,7 +106,11 @@ private void add(ResourcePOJO r) {
@Restricted(NoExternalUse.class)
public static LockedResourcesBuildAction fromResources(Collection<LockableResource> resources) {
List<ResourcePOJO> resPojos = new ArrayList<>();
for (LockableResource r : resources) resPojos.add(new ResourcePOJO(r));
for (LockableResource r : resources) {
if (r != null) {

Check warning on line 110 in src/main/java/org/jenkins/plugins/lockableresources/actions/LockedResourcesBuildAction.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 110 is only partially covered, one branch is missing
resPojos.add(new ResourcePOJO(r));
}
}
return new LockedResourcesBuildAction(resPojos);
}

Expand Down

0 comments on commit 3d55a36

Please sign in to comment.