Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema class attributeRequiredMap.get(attrToSearchFor); returning null #65

Closed
zsiryani opened this issue Jun 16, 2022 · 5 comments
Closed
Labels

Comments

@zsiryani
Copy link

Hello, I have a case where attributeRequiredMap.get(attrToSearchFor); is returning null in the Boolean isRequired like the following Image

image

I was wondering if the isRequired can be converted into a primitive boolean in order not to have NPE, the following is the content of the map

image

Also current attrToSearchFor value is urn:scim:schemas:extension:workspace:1 the closest value in the map is urn:scim:schemas:extension:workspace:1.0 I suspect that is this something related to the construction of attrToSearchFor using the stringJoiner.

Thank you

@galovics
Copy link
Member

Hi @zaidsir,
Thanks for reporting these issues. I'll take a look when I have the time unless you have a PR prepared. ;-)

@lavanya2290
Copy link

lavanya2290 commented Jun 16, 2022

The same works in 2.2.0 verions It handles NPE. Like making use of Optional.ofNullable.
class name: Schema

public Set<String> getRequiredAttributeNames() {
        Collection<SchemaAttribute> schemaAttrs = schemaAttributes;
        if (CollectionUtils.isEmpty(schemaAttrs)) {
            schemaAttrs = Optional.ofNullable(schema).map(Schema::getSchemaAttributes).orElse(Collections.emptySet());
        }
        return internalGetAttributeData(schemaAttrs, "", SchemaAttribute::isRequired)
            .stream()
            .filter(p -> BooleanUtils.isTrue(p.getRight()))
            .map(Pair::getLeft)
            .collect(toSet());
    }

versus new method in 2.3.0 causes issues i.e. NPE.
Example we can have a variable annotated with
public static final String SCHEMA = "urn:abc:def:abc:abc:1.0";

@zsiryani
Copy link
Author

Hello @galovics, a simple pull request created. Please review it

@galovics
Copy link
Member

Just for reference, the PR is here: #66

@galovics
Copy link
Member

@zaidsir the other issue, with the complex dotted attribute name is fixed with this PR: #84

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants