[jira] [Updated] (BATIK-1215) NPE error with invalid d that specifies only path end

"Ahmed Musallam (JIRA)" <[email protected]>
Newsgroups gmane.text.xml.batik.devel
Message-ID <[email protected]>
     [ https://issues.apache.org/jira/browse/BATIK-1215?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ahmed Musallam updated BATIK-1215:
----------------------------------
    Description: 
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.

Here is the documentation for svg path data BNF: https://www.w3.org/TR/SVG/paths.html#PathDataBNF

Thank you for building this awesome library!

  was:
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!


> 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.7.1, 1.9
>            Reporter: Ahmed Musallam
>            Priority: Major
>
> 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.
> Here is the documentation for svg path data BNF: https://www.w3.org/TR/SVG/paths.html#PathDataBNF
> Thank you for building this awesome library!



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.