Description
When attempting to create an instance of IsoFile using the constructor IsoFile(sourceFile), a NullPointerException occurs while trying to close an InputStream in the PropertyBoxParserImpl initialization.
The issue appears to be related to resource loading in Android environment. Specifically, the following line in PropertyBoxParserImpl fails to load the properties file:
InputStream is = getClass().getResourceAsStream("/isoparser2-default.properties");
This method of resource loading might not work correctly on Android as Android handles resources differently from standard Java applications.
Environment
- Platform: Android
- Android API Level: 35 (Android 15)
- Library versions:
- org.mp4parser:isoparser:1.9.39
- org.mp4parser:muxer:1.9.39
Stack Trace
java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.InputStream.close()' on a null object reference
at org.mp4parser.PropertyBoxParserImpl.<init>(PropertyBoxParserImpl.java:77)
at org.mp4parser.IsoFile.<init>(IsoFile.java:44)
Expected Behavior
The IsoFile constructor should successfully initialize with the provided source file.
Additional Information
The error occurs in the PropertyBoxParserImpl constructor when attempting to close an InputStream that appears to be null. The root cause seems to be that getResourceAsStream() returns null because it cannot locate the properties file in Android's resource system.
Possible Solution
The library might need to be modified to handle resource loading differently on Android platform, perhaps by:
- Including the properties file in a different location in the Android project
- Using Android's AssetManager to load the resource
- Providing an alternative way to initialize the properties
Question
Can the library maintainers confirm if this is a known issue with Android compatibility? Are there any workarounds available for Android implementations?
Description
When attempting to create an instance of
IsoFileusing the constructorIsoFile(sourceFile), aNullPointerExceptionoccurs while trying to close anInputStreamin thePropertyBoxParserImplinitialization.The issue appears to be related to resource loading in Android environment. Specifically, the following line in
PropertyBoxParserImplfails to load the properties file:This method of resource loading might not work correctly on Android as Android handles resources differently from standard Java applications.
Environment
Stack Trace
Expected Behavior
The
IsoFileconstructor should successfully initialize with the provided source file.Additional Information
The error occurs in the
PropertyBoxParserImplconstructor when attempting to close anInputStreamthat appears to be null. The root cause seems to be thatgetResourceAsStream()returns null because it cannot locate the properties file in Android's resource system.Possible Solution
The library might need to be modified to handle resource loading differently on Android platform, perhaps by:
Question
Can the library maintainers confirm if this is a known issue with Android compatibility? Are there any workarounds available for Android implementations?