jasonfagerberg-toast commented on code in PR #694:
URL: https://github.com/apache/directory-scimple/pull/694#discussion_r1873375692
##########
scim-core/src/main/java/org/apache/directory/scim/core/repository/DefaultPatchHandler.java:
##########
@@ -132,10 +132,23 @@ private <T extends ScimResource> void apply(T source,
Map<String, Object> source
// if the attribute has a URN, assume it's an extension that URN does not
match the baseUrn
if (attributeReference.hasUrn() &&
!attributeReference.getUrn().equals(source.getBaseUrn())) {
Schema schema =
this.schemaRegistry.getSchema(attributeReference.getUrn());
- Attribute attribute =
schema.getAttribute(attributeReference.getAttributeName());
-
checkMutability(schema.getAttributeFromPath(attributeReference.getFullAttributeName()));
- patchOperationHandler.applyExtensionValue(source, sourceAsMap, schema,
attribute, valuePathExpression, attributeReference.getUrn(),
patchOperation.getValue());
+ if (schema != null) {
+ Attribute attribute =
schema.getAttribute(attributeReference.getAttributeName());
+
checkMutability(schema.getAttributeFromPath(attributeReference.getFullAttributeName()));
+
+ patchOperationHandler.applyExtensionValue(source, sourceAsMap, schema,
attribute, valuePathExpression, attributeReference.getUrn(),
patchOperation.getValue());
+ } else {
+ // If schema is null, it's either the root of an extension, or an
invalid patch path
+ // It's not possible from the antlr parser to tell the diff between
'this:is:extension:urn' and 'this:is:extension:urn:attribute'
Review Comment:
Yeah I was looking at this too, I think the SCIM
[RFCs](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) ANBF has
this same issue
```
attrPath = [URI ":"] ATTRNAME *1subAttr
; SCIM attribute name
; URI is SCIM "schema" URI
```
its kinda unfortunate but I think this might be the path of least resistance
and path of least hack
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]