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 on empy dependencies #85

Closed
jmfernandez opened this issue May 27, 2017 · 2 comments
Closed

NullPointerException on empy dependencies #85

jmfernandez opened this issue May 27, 2017 · 2 comments

Comments

@jmfernandez
Copy link

When a JSON Schema has an empty dependencies hash, like next:

{
  "type": "object",
  "properties": {
    "foo": {
      "type":"string"
    }
  },
  "dependencies": {}
}

SchemaLoader.load fires next NullPointerException for previous schema:

        at java.util.Arrays.stream(Arrays.java:5004)
        at org.everit.json.schema.loader.ObjectSchemaLoader.addDependencies(ObjectSchemaLoader.java:85)
        at org.everit.json.schema.loader.ObjectSchemaLoader.lambda$load$2(ObjectSchemaLoader.java:59)
        at org.everit.json.schema.loader.LoadingState.ifPresent(LoadingState.java:56)
        at org.everit.json.schema.loader.ObjectSchemaLoader.load(ObjectSchemaLoader.java:59)
        at org.everit.json.schema.loader.SchemaLoader.buildObjectSchema(SchemaLoader.java:324)
        at org.everit.json.schema.loader.SchemaLoader.loadForExplicitType(SchemaLoader.java:317)
        at org.everit.json.schema.loader.SchemaLoader.loadForType(SchemaLoader.java:335)
        at org.everit.json.schema.loader.SchemaLoader.lambda$load$0(SchemaLoader.java:292)
        at java.util.Optional.orElseGet(Optional.java:267)
        at org.everit.json.schema.loader.SchemaLoader.load(SchemaLoader.java:288)
        at org.everit.json.schema.loader.SchemaLoader.load(SchemaLoader.java:178)
        at org.everit.json.schema.loader.SchemaLoader.load(SchemaLoader.java:163)

despite being a valid JSON Schema. I have got this issue while testing version 1.5.1 , obtained from a Maven repository.

@erosb
Copy link
Contributor

erosb commented May 27, 2017

Thanks for reporting it. I could reproduce it with version 1.5.1 , but I couldn't with latest master revision. So you can wait for the next release with the fix, or use the current HEAD, by using this dependency:

<dependency>
        <groupId>com.github.everit-org.json-schema</groupId>
        <artifactId>org.everit.json.schema</artifactId>
        <version>dc383ce65bf5a7b97b699763f8441aa278dfb365</version>
 </dependency>

erosb added a commit that referenced this issue May 28, 2017
@erosb erosb closed this as completed May 28, 2017
@erosb
Copy link
Contributor

erosb commented Jul 21, 2017

Hello @jmfernandez , I released the new version yesterday.

Links:

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