Skip to content

Commit

Permalink
[SCIM-33] fixes NPE while updating groups with delta and PATCH is gro…
Browse files Browse the repository at this point in the history
…up update method (#100)
  • Loading branch information
andrea-patricelli authored Dec 24, 2024
1 parent 78bdfe1 commit c5490af
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -582,13 +582,20 @@ public Set<AttributeDelta> updateDelta(
// only values to add and remove are supported
modifications.stream().
filter(ad -> SCIMAttributeUtils.SCIM_USER_GROUPS.equalsIgnoreCase(ad.getName())).
findFirst().ifPresent(grpsAd -> fillGroupPatches(
findFirst().ifPresent(grmod -> fillGroupPatches(
currentUser,
groupPatches,
CollectionUtil.isEmpty(grpsAd.getValuesToAdd())
? grpsAd.getValuesToReplace().stream().map(String.class::cast).collect(Collectors.toList())
: grpsAd.getValuesToAdd().stream().map(String.class::cast).collect(Collectors.toList()),
grpsAd.getValuesToRemove().stream().map(String.class::cast).collect(Collectors.toList())));
CollectionUtil.isEmpty(grmod.getValuesToAdd())
? CollectionUtil.isEmpty(grmod.getValuesToReplace())
? Collections.emptyList()
: grmod.getValuesToReplace().stream().map(String.class::cast)
.collect(Collectors.toList())
: CollectionUtil.isEmpty(grmod.getValuesToAdd())
? Collections.emptyList()
: grmod.getValuesToAdd().stream().map(String.class::cast).collect(Collectors.toList()),
CollectionUtil.isEmpty(grmod.getValuesToRemove())
? Collections.emptyList()
: grmod.getValuesToRemove().stream().map(String.class::cast).collect(Collectors.toList())));
} else {
LOG.warn("Group update method must be set to PATCH while updating through UPDATE_DELTA");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ protected void checkServiceErrors(final Response response) {
}

if (response.getStatusInfo().getFamily() != Status.Family.SUCCESSFUL) {
SCIMUtils.handleGeneralError("While executing SCIM request");
SCIMUtils.handleGeneralError("While executing SCIM request " + response.getStatus());
}
}

Expand Down

0 comments on commit c5490af

Please sign in to comment.