sannies / mp4parser

A Java API to read, write and create MP4 files
Apache License 2.0
2.74k stars 563 forks source link

fix:"ClassLoader.getSystemResourceAsStream" NullPointException #456

Open laoLiangLoveProgram opened 1 year ago

laoLiangLoveProgram commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

laoLiangLoveProgram commented 1 year ago

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 commented 1 year ago

I see and sorry.