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

ArrayIndexOutOfBoundsException when loading SVG #24

Closed
narutoDev opened this issue Jan 30, 2022 · 2 comments
Closed

ArrayIndexOutOfBoundsException when loading SVG #24

narutoDev opened this issue Jan 30, 2022 · 2 comments

Comments

@narutoDev
Copy link

narutoDev commented Jan 30, 2022

When loading the attached SVG file I get the following stacktrace:

Jan 30, 2022 10:32:56 AM com.github.weisj.jsvg.parser.SVGLoader load WARNING: Could not load SVG java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at com.github.weisj.jsvg/com.github.weisj.jsvg.parser.AttributeNode.preprocessAttributes(AttributeNode.java:77) at com.github.weisj.jsvg/com.github.weisj.jsvg.parser.AttributeNode.<init>(AttributeNode.java:60) at com.github.weisj.jsvg/com.github.weisj.jsvg.parser.SVGLoader$SVGLoadHandler.startElement(SVGLoader.java:232) at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:518) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:374) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2725) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:541) at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888) at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824) at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224) at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635) at com.github.weisj.jsvg/com.github.weisj.jsvg.parser.SVGLoader.load(SVGLoader.java:136) at com.github.weisj.jsvg/com.github.weisj.jsvg.parser.SVGLoader.load(SVGLoader.java:124) at Encryption/crypttool.util.SVGIcon.<init>(SVGIcon.java:23) at Encryption/crypttool.gui.MainFrame.<clinit>(MainFrame.java:138) at Encryption/crypttool.Crypttool.main(Crypttool.java:41)

The file gets displayed perfectly fine in my browser. I tried to load another SVG file, which worked. Is there an issue with my svg file, or is it a bug in your library? Any potential workarounds?

The svg file causing the error:
password

@narutoDev
Copy link
Author

Because I'm not sure how to attach the svg file, without it getting displayed as a preview, here is the code for the svg: https://pastebin.com/BEP1pEBk

@weisJ
Copy link
Owner

weisJ commented Jan 30, 2022

The issue seems to be the empty style tag <g style="">. Removing the style attribute should fix it.

@weisJ weisJ closed this as completed in 840ffea Jan 30, 2022
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

No branches or pull requests

2 participants