centsol / androidsvg

Automatically exported from code.google.com/p/androidsvg
0 stars 0 forks source link

NullPointerException in 1.2.2-beta1 when parsing SVG document #59

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Parse a SVG document (from a String, but I don't think this matters)
2. Receive a NullPointerException
3.

What is the expected output? What do you see instead?
Version 1.2.1 parses this same SVG document fine. On version 1.2.2-beta1 (with 
the same exact SVG), I get a NPE;
java.lang.NullPointerException
at com.caverock.androidsvg.SVGParser.parseFont(SVGParser.java:3253)
at com.caverock.androidsvg.SVGParser.processStyleProperty(SVGParser.java:2478)
at com.caverock.androidsvg.SVGParser.parseAttributesStyle(SVGParser.java:2363)
at com.caverock.androidsvg.SVGParser.text(SVGParser.java:1238)
at com.caverock.androidsvg.SVGParser.startElement(SVGParser.java:470)
at org.apache.harmony.xml.ExpatParser.startElement(ExpatParser.java:143)
at org.apache.harmony.xml.ExpatParser.appendBytes(Native Method)
at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:513)
at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:474)
at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:316)
at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:279)
at com.caverock.androidsvg.SVGParser.parse(SVGParser.java:394)
at com.caverock.androidsvg.SVG.getFromString(SVG.java:158)

What version of the product are you using? On what operating system?
1.2.2-beta1 on Android (I tried this on 4.4.4 and 5.1).

Please provide any additional information below.
The SVG document is not publicly available, but I can get you the String for it 
if required.

Original issue reported on code.google.com by m...@marcbernstein.info on 30 Apr 2015 at 7:53

GoogleCodeExporter commented 8 years ago
From what I can tell in reading the code, it appears that 
initialiseFontWeightKeywordsMap() is not being called before the parseFont call.

Original comment by m...@marcbernstein.info on 30 Apr 2015 at 7:54

GoogleCodeExporter commented 8 years ago
Are you able to provide a sample SVG that reproduces the problem?

That code has been refactored somewhat in my local copy, so it may have been 
fixed already anyway.

Original comment by paul.leb...@gmail.com on 1 May 2015 at 2:26

GoogleCodeExporter commented 8 years ago
You bet! I'll capture one of the failing documents today and attach it to this 
issue. Thanks for looking into it, I appreciate it.

Original comment by m...@marcbernstein.info on 1 May 2015 at 5:45

GoogleCodeExporter commented 8 years ago
Hi Paul, here are a couple of documents that are both failing with the same 
stack trace on 1.2.2-beta-1. Thanks again for checking it out!

Original comment by m...@marcbernstein.info on 1 May 2015 at 9:09

Attachments: