You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by "Ashish Chopra (Jira)" <ji...@apache.org> on 2020/08/31 12:51:00 UTC

[jira] [Commented] (BATIK-1163) DOMException: "The "opacity" property does not support dimension values"

    [ https://issues.apache.org/jira/browse/BATIK-1163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17187705#comment-17187705 ] 

Ashish Chopra commented on BATIK-1163:
--------------------------------------

hi folks at [~batik-dev@xmlgraphics.apache.org], is there a chance of addressing this issue in upcoming near future? Thanks!

\cc: [~haraldk76]

> DOMException: "The "opacity" property does not support dimension values"
> ------------------------------------------------------------------------
>
>                 Key: BATIK-1163
>                 URL: https://issues.apache.org/jira/browse/BATIK-1163
>             Project: Batik
>          Issue Type: Bug
>    Affects Versions: 1.8
>         Environment: Using Batik 1.8 dependencies from Maven Central.
> Reproduced on Windows, using Java 1.8 (likely not relevant in this case).
>            Reporter: Harald Kuhr
>            Priority: Major
>         Attachments: Lynparza_PARPinhibition.svg
>
>
> One of the users of my library, TwelveMonkeys ImageIO reported an issue, trying to read certain SVG files (my project uses the rasterizer to convert SVG to BufferedImage, through the javax.imageio API). See the issue here for details: https://github.com/haraldk/TwelveMonkeys/issues/299
> I tracked it down to an internal DOMException, with the message  "The "opacity" property does not support dimension values". 
> The "offending" values in the CSS were:
>     opacity:9.090909e-002
> Manually changing the values to:
>     opacity: 0.09090909
> ...I was able to read/display the SVG using the library/Batik, everything seemingly okay.
> I can open the original SVG in question in both IE and Chrome without issues (as far as I can see, there might be internal warnings not displayed to me as an end user). Not sure whether this is a spec/leniency issue, or if this is a Batik bug, but would be happy if you could look into it.
> The stack trace I see in my application is this:
> java.lang.NullPointerException
> 	at org.apache.batik.css.engine.CSSEngine.parseStyleSheet(Unknown Source)
> 	at org.apache.batik.css.engine.CSSEngine.parseStyleSheet(Unknown Source)
> 	at org.apache.batik.anim.dom.SVGOMStyleElement.getCSSStyleSheet(Unknown Source)
> 	at org.apache.batik.css.engine.CSSEngine.getStyleSheetNodes(Unknown Source)
> 	at org.apache.batik.css.engine.CSSEngine.getCascadedStyleMap(Unknown Source)
> 	at org.apache.batik.css.engine.CSSEngine.getComputedStyle(Unknown Source)
> 	at org.apache.batik.bridge.CSSUtilities.getComputedStyle(Unknown Source)
> 	at org.apache.batik.bridge.CSSUtilities.convertVisibility(Unknown Source)
> 	at org.apache.batik.bridge.SVGSVGElementBridge.createGraphicsNode(Unknown Source)
> 	at org.apache.batik.bridge.GVTBuilder.build(Unknown Source)
> 	at com.twelvemonkeys.imageio.plugins.svg.SVGImageReader$Rasterizer.transcode(SVGImageReader.java:307)
> 	at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source)
> 	at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
> 	at com.twelvemonkeys.imageio.plugins.svg.SVGImageReader$Rasterizer.init(SVGImageReader.java:547)
> 	at com.twelvemonkeys.imageio.plugins.svg.SVGImageReader$Rasterizer.getDefaultWidth(SVGImageReader.java:560)
> 	at com.twelvemonkeys.imageio.plugins.svg.SVGImageReader.getWidth(SVGImageReader.java:227)
> 	at com.twelvemonkeys.imageio.plugins.svg.SVGImageReader.read(SVGImageReader.java:129)
> 	at javax.imageio.ImageReader.read(ImageReader.java:940)
> 	at com.twelvemonkeys.imageio.plugins.svg.SVGImageReaderTest.testFoo(SVGImageReaderTest.java:154)
> However, as mentioned, there seems to be an internal exception thrown (and caught again), inside the CSSEngine/parseStyleSheet() method. I believe this is the cause, and the NPE just happens after, for some reason. The following stack trace is never shown in my application, but created by invoking its printStackTrace() method from the debugger:
> org.w3c.dom.DOMException: The "opacity" property does not support dimension values.
> 	at org.apache.batik.css.engine.value.AbstractValueFactory.createInvalidLexicalUnitDOMException(Unknown Source)
> 	at org.apache.batik.css.engine.value.svg.OpacityManager.createValue(Unknown Source)
> 	at org.apache.batik.css.engine.CSSEngine$StyleSheetDocumentHandler.property(Unknown Source)
> 	at org.apache.batik.css.parser.Parser.parseStyleDeclaration(Unknown Source)
> 	at org.apache.batik.css.parser.Parser.parseRuleSet(Unknown Source)
> 	at org.apache.batik.css.parser.Parser.parseStyleSheet(Unknown Source)
> 	at org.apache.batik.css.engine.CSSEngine.parseStyleSheet(Unknown Source)
> 	at org.apache.batik.css.engine.CSSEngine.parseStyleSheet(Unknown Source)
> 	at org.apache.batik.css.engine.CSSEngine.parseStyleSheet(Unknown Source)
> 	at org.apache.batik.anim.dom.SVGOMStyleElement.getCSSStyleSheet(Unknown Source)
> 	at org.apache.batik.css.engine.CSSEngine.getStyleSheetNodes(Unknown Source)
> 	at org.apache.batik.css.engine.CSSEngine.getCascadedStyleMap(Unknown Source)
> 	at org.apache.batik.css.engine.CSSEngine.getComputedStyle(Unknown Source)
> 	at org.apache.batik.bridge.CSSUtilities.getComputedStyle(Unknown Source)
> 	at org.apache.batik.bridge.CSSUtilities.convertVisibility(Unknown Source)
> 	at org.apache.batik.bridge.SVGSVGElementBridge.createGraphicsNode(Unknown Source)
> 	at org.apache.batik.bridge.GVTBuilder.build(Unknown Source)
> 	at com.twelvemonkeys.imageio.plugins.svg.SVGImageReader$Rasterizer.transcode(SVGImageReader.java:307)
> 	at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source)
> 	at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
> 	at com.twelvemonkeys.imageio.plugins.svg.SVGImageReader$Rasterizer.init(SVGImageReader.java:547)
> 	at com.twelvemonkeys.imageio.plugins.svg.SVGImageReader$Rasterizer.getDefaultWidth(SVGImageReader.java:560)
> 	at com.twelvemonkeys.imageio.plugins.svg.SVGImageReader.getWidth(SVGImageReader.java:227)
> 	at com.twelvemonkeys.imageio.plugins.svg.SVGImageReader.read(SVGImageReader.java:129)
> 	at javax.imageio.ImageReader.read(ImageReader.java:940)
> 	at com.twelvemonkeys.imageio.plugins.svg.SVGImageReaderTest.testFoo(SVGImageReaderTest.java:154)
> Unfortunately the JARs from Maven central have debug info stripped out, so I don't have line numbers, and it's quite hard to follow what's happening in the debugger. It's probably easier for you, if you have classes with debug information available.  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org