Skip to content

Commit a931137

Browse files
committed
Fix deserialization of GenericScimResource.
Jackson 3 enabled the DeserializationFeature.FAIL_ON_TRAILING_TOKENS setting by default. This caused problems for the custom deserializer since extra JSON data can be present if a GenericScimResource is embedded within a list response. As a result, this commit updates the deserializer to address this edge case. This also includes a nullability annotation correction and minor test cleanup. Reviewer: dougbulkley Reviewer: vyhhuang JiraIssue: DS-51507
1 parent f5fc763 commit a931137

4 files changed

Lines changed: 122 additions & 78 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](https://semver.org/).
44

55
## 6.0.1 - TBD
6+
Fixed an issue with deserializing a GenericScimResource object when it was embedded within a list
7+
response.
68

79
## 6.0.0 - 2026-May-11
810
The UnboundID SCIM SDK has been updated to use version 3 of the Jackson library (this release ships

scim2-sdk-common/src/main/java/com/unboundid/scim2/common/types/GroupResource.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
name="Group", description = "Group")
9494
public class GroupResource extends BaseScimResource
9595
{
96-
@NotNull
96+
@Nullable
9797
@Attribute(description = "A human-readable name for the Group.",
9898
isRequired = true,
9999
isCaseExact = false,
@@ -115,7 +115,7 @@ public class GroupResource extends BaseScimResource
115115
*
116116
* @return The name of the Group, suitable for display to end-users.
117117
*/
118-
@NotNull
118+
@Nullable
119119
public String getDisplayName()
120120
{
121121
return displayName;
@@ -129,7 +129,7 @@ public String getDisplayName()
129129
* @return This object.
130130
*/
131131
@NotNull
132-
public GroupResource setDisplayName(@NotNull final String displayName)
132+
public GroupResource setDisplayName(@Nullable final String displayName)
133133
{
134134
this.displayName = displayName;
135135
return this;

scim2-sdk-common/src/main/java/com/unboundid/scim2/common/utils/GenericScimObjectDeserializer.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434

3535
import com.unboundid.scim2.common.GenericScimResource;
3636
import com.unboundid.scim2.common.annotations.NotNull;
37-
import com.unboundid.scim2.common.annotations.Nullable;
3837
import com.unboundid.scim2.common.exceptions.runtime.ScimDeserializeException;
3938
import tools.jackson.core.JacksonException;
4039
import tools.jackson.core.JsonParser;
@@ -55,19 +54,18 @@ public class GenericScimObjectDeserializer
5554
@Override
5655
@NotNull
5756
public GenericScimResource deserialize(
58-
@NotNull final JsonParser jp,
59-
@Nullable final DeserializationContext ctxt)
57+
@NotNull final JsonParser p,
58+
@NotNull final DeserializationContext ctxt)
6059
{
6160
try
6261
{
63-
ObjectNode node = JsonUtils.getObjectReader()
64-
.forType(ObjectNode.class).readValue(jp);
62+
ObjectNode node = ctxt.readValue(p, ObjectNode.class);
6563
return new GenericScimResource(node);
6664
}
6765
catch (JacksonException e)
6866
{
6967
throw new ScimDeserializeException(
70-
"Cannot convert a non-object JSON to a GenericScimResource.", e);
68+
"Failed to convert a JSON to an ObjectNode.", e);
7169
}
7270
}
7371
}

0 commit comments

Comments
 (0)