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

fix:"ClassLoader.getSystemResourceAsStream" NullPointException #456

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

laoLiangLoveProgram
Copy link

Fix: #449

Problem: jdk17, "org.mp4parser.muxer.container.mp4.MovieCreator.build(path)" throw NPE

java.lang.NullPointerException: inStream parameter is null
        at java.base/java.util.Objects.requireNonNull(Objects.java:233)
        at java.base/java.util.Properties.load(Properties.java:407)
        at org.mp4parser.PropertyBoxParserImpl.<init>(PropertyBoxParserImpl.java:52)
        at org.mp4parser.IsoFile.<init>(IsoFile.java:53)
        at org.mp4parser.muxer.container.mp4.MovieCreator.build(MovieCreator.java:54)

And I find in "org/mp4parser/PropertyBoxParserImpl.java:48 " return null

InputStream is = ClassLoader.getSystemResourceAsStream("isoparser2-default.properties"); //return null 

@KimALam
Copy link

KimALam commented Feb 2, 2023

I'm using isoparser 1.9.56 in spring boot server application.
And it is deployed as runnable jar.
In jar, I met the same problem "inStream parameter is null" in the same place.

InputStream is = ClassLoader.getSystemResourceAsStream("isoparser2-default.properties"); //return null

p.s) 1.9.41 does not have this problem. And it's code like this

InputStream is = this.getClass().getResourceAsStream("/isoparser2-default.properties");

@KimALam
Copy link

KimALam commented Feb 6, 2023

@laoLiangLoveProgram
Hello, IaoLiang
Is there any plan for release this fix?

@laoLiangLoveProgram
Copy link
Author

no. I fix this problem, and build a local version to use. I'm not owner, and has no plan to develop this project.

@KimALam
Copy link

KimALam commented Feb 7, 2023

I see and sorry.

@pavhofman
Copy link

I hit the same problem when running the isoparser from a webapp in tomcat. Upon reading about difference between ClassLoader.getSystemResourceAsStream() and this.getClass().getResourceAsStream() (as introduced in 6f8270a#diff-5024c2ff4818b0d1b17a5b32745d08f7b4c0dcf23518c96021b5fc8361fc2f12R48 ) I tried adding absolute path to the isoparser-1.9.56.jar in the webapp's WEB-INF/lib dir to --classpath of java running the tomcat - and it worked. As well as did the version 1.9.41 (e.g. before this commit).

Please is there any reason for the above-linked change in the PropertyBoxParserImpl class?

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.

MovieCreator.build(file) NullPointerException
4 participants