Ahmed Musallam created BATIK-1215:
-------------------------------------

             Summary: NPE error with invalid d that specifies only path end
                 Key: BATIK-1215
                 URL: https://issues.apache.org/jira/browse/BATIK-1215
             Project: Batik
          Issue Type: Bug
    Affects Versions: 1.9, 1.7.1
            Reporter: Ahmed Musallam


I am not very familiar with batik, but one of the products we use, does use 
batik to read SVG files.

Browsers are typically forgiving with this issue, but seems like batik is 
strict about it, in our SVG there is a path: 

 

{{<path class="st1" d="z"/>}}

 

 

As you can see the d attribute only specifies path end, and understandably 
batik throws the following error:
{quote}
the error can be produced by opening the offending SVG with 
batik-squiggle-1.9.jar or batik-squiggle-1.7.jar 
{quote}



{code:java}
java.lang.NullPointerException
at org.apache.batik.parser.AWTPathProducer.closePath(AWTPathProducer.java:145)
at 
org.apache.batik.dom.svg.SVGAnimatedPathDataSupport.handlePathSegList(SVGAnimatedPathDataSupport.java:64)
at 
org.apache.batik.bridge.SVGPathElementBridge.buildShape(SVGPathElementBridge.java:92)
at 
org.apache.batik.bridge.SVGShapeElementBridge.createGraphicsNode(SVGShapeElementBridge.java:60)
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:213)
at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
at org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:82)
at org.apache.batik.swing.svg.GVTTreeBuilder.run(GVTTreeBuilder.java:96)
{code}

I don't think batik should throw an NPE. Rather, the invalid d attribute should 
be handled by either ignoring the path or throwing a different exception with a 
helpful message.

Thank you for building this awesome library!



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to