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

Handle the situation when context class loader is null #490

Merged
merged 1 commit into from
Dec 6, 2021

Conversation

vti
Copy link
Contributor

@vti vti commented Dec 6, 2021

This fixes the errors when trying to load classpath references, like:

Caused by: java.lang.NullPointerException
        at com.networknt.schema.uri.ClasspathURLStreamHandler$ClassPathURLConnection.getResourceAsStream(ClasspathURLStreamHandler.java:83) ~[amcrm-1.0-SNAPSHOT.jar:?]
        at com.networknt.schema.uri.ClasspathURLStreamHandler$ClassPathURLConnection.getInputStream(ClasspathURLStreamHandler.java:69) ~[amcrm-1.0-SNAPSHOT.jar:?]
        at java.net.URL.openStream(URL.java:1165) ~[?:?]
        at com.networknt.schema.uri.ClasspathURLFetcher.fetch(ClasspathURLFetcher.java:39) ~[amcrm-1.0-SNAPSHOT.jar:?]
        at com.networknt.schema.uri.URISchemeFetcher.fetch(URISchemeFetcher.java:50) ~[amcrm-1.0-SNAPSHOT.jar:?]
        at com.networknt.schema.JsonSchemaFactory.getSchema(JsonSchemaFactory.java:351) ~[amcrm-1.0-SNAPSHOT.jar:?]
        at com.networknt.schema.RefValidator.getRefSchema(RefValidator.java:82) ~[amcrm-1.0-SNAPSHOT.jar:?]
        at com.networknt.schema.RefValidator.<init>(RefValidator.java:45) ~[amcrm-1.0-SNAPSHOT.jar:?]

@vti vti changed the title Handle the situation when context class loaded is null Handle the situation when context class loader is null Dec 6, 2021
This fixes the errors when trying to load classpath references, like:

    Caused by: java.lang.NullPointerException
            at com.networknt.schema.uri.ClasspathURLStreamHandler$ClassPathURLConnection.getResourceAsStream(ClasspathURLStreamHandler.java:83) ~[amcrm-1.0-SNAPSHOT.jar:?]
            at com.networknt.schema.uri.ClasspathURLStreamHandler$ClassPathURLConnection.getInputStream(ClasspathURLStreamHandler.java:69) ~[amcrm-1.0-SNAPSHOT.jar:?]
            at java.net.URL.openStream(URL.java:1165) ~[?:?]
            at com.networknt.schema.uri.ClasspathURLFetcher.fetch(ClasspathURLFetcher.java:39) ~[amcrm-1.0-SNAPSHOT.jar:?]
            at com.networknt.schema.uri.URISchemeFetcher.fetch(URISchemeFetcher.java:50) ~[amcrm-1.0-SNAPSHOT.jar:?]
            at com.networknt.schema.JsonSchemaFactory.getSchema(JsonSchemaFactory.java:351) ~[amcrm-1.0-SNAPSHOT.jar:?]
            at com.networknt.schema.RefValidator.getRefSchema(RefValidator.java:82) ~[amcrm-1.0-SNAPSHOT.jar:?]
            at com.networknt.schema.RefValidator.<init>(RefValidator.java:45) ~[amcrm-1.0-SNAPSHOT.jar:?]
@vti vti force-pushed the nullable-context-class-loader branch from 8051362 to f1b8b21 Compare December 6, 2021 11:53
@stevehu stevehu merged commit 30d4b4b into networknt:master Dec 6, 2021
@stevehu
Copy link
Contributor

stevehu commented Dec 6, 2021

@vti Thanks a lot for your help.

@vti
Copy link
Contributor Author

vti commented Dec 6, 2021

@stevehu you're welcome, thanks for the great library! Hopefully the maven release is not too far way... :)

@vti vti deleted the nullable-context-class-loader branch December 6, 2021 14:36
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

Successfully merging this pull request may close these issues.

2 participants