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

NullPointerException in SearchRequestBuilder.class #150

Open
suvera opened this issue Sep 4, 2020 · 1 comment
Open

NullPointerException in SearchRequestBuilder.class #150

suvera opened this issue Sep 4, 2020 · 1 comment

Comments

@suvera
Copy link

suvera commented Sep 4, 2020

JAVA: 1.8
scim2sdk: 2.3.5
Jackson: 2.11.1

class: SearchRequestBuilder.java Method: invoke


try {
                JsonParser parser = JsonUtils.getObjectReader().getFactory().createParser(inputStream);

                try {
                    parser.nextToken();
                    boolean stop = false;

                    while(!stop && parser.nextToken() != JsonToken.END_OBJECT) {
                        String field = parser.getCurrentName();
                        parser.nextToken();
                        if (field.equals("schemas")) {
                            parser.skipChildren();

as String field = parser.getCurrentName(); returns NULL, so field NULL.

field.equals() throws error ...

I am checking this with Valid SCIM2 schema , JSON is perfectly valid.

Scim JSON:


[
    {
        "schemas": [
            "urn:ietf:params:scim:schemas:core:2.0:ResourceType"
        ],
        "id": "ResourceType",
        "meta": {
            "resourceType": "ResourceType",

.....rest of json here ...

code throws Error on first { after [


nextToken: START_ARRAY, id: 3, value: null, location: [Source: (org.glassfish.jersey.message.internal.EntityInputStream); line: 1, column: 2], text: null
nextToken: START_OBJECT, id: 1, value: null, location: [Source: (org.glassfish.jersey.message.internal.EntityInputStream); line: 2, column: 6], text: null


Exception in thread "main" java.lang.NullPointerException
	at com.unboundid.scim2.client.requests.SearchRequestBuilder.invoke(SearchRequestBuilder.java:280)
	at com.unboundid.scim2.client.requests.SearchRequestBuilder.invoke(SearchRequestBuilder.java:155)
	at com.unboundid.scim2.client.ScimService.getResourceTypes(ScimService.java:113)


@papegaaij
Copy link

The problem seems to be that the ResourceTypes resource returns a JSON array as top level element and not an object with a Resources property containing the actual resources. This breaks the getResourceTypes method.

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

No branches or pull requests

2 participants