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

BATIK-1318: NullPointerException in SAXSVGDocumentFactory.resolveEntity() #40

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stanio
Copy link

@stanio stanio commented Oct 12, 2023

Suggested fix for BATIK-1318.

In 2014 the SAXSVGDocumentFactory class along with the dtdids.properties resource have been moved from org.apache.batik.dom.svg to org.apache.batik.anim.dom package:

However, the resources referenced in dtdids.properties are still in org.apache.batik.dom.svg package:

This makes the following Class.getResource() return null and ultimately cause NPE:

String localSystemId =
dtdProps.getProperty(KEY_SYSTEM_ID +
publicId.replace(' ', '_'));
if (localSystemId != null && !"".equals(localSystemId)) {
return new InputSource
(getClass().getResource(localSystemId).toString());

I can see the overall issue has been partially addressed in f2dac46. I suggest further the dtdids.properties should be updated with absolute resource names.

Reference the original resources at their original and present location.
@stanio
Copy link
Author

stanio commented Apr 11, 2024

Now that 04b46fd is checked into the main line, one may need to add (haven't tested it explicitly):

--add-opens org.apache.xmlgraphics.batik.svgdom/org.apache.batik.dom.svg.resources=org.apache.xmlgraphics.batik.anim

when using the --module-path vs. --class-path runtime configuration. This could be further addressed by more appropriate packaging. For example, SAXSVGDocumentFactory (and dtdids.properties) should likely reside in the batik-dom module, where the rest of the referenced resources are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant