[jira] [Commented] (BATIK-1125) Rasterizer 1.8 fails with base64 embedded png

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (BATIK-1125) Rasterizer 1.8 fails with base64 embedded png

JIRA jira@apache.org

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

Erich Schubert commented on BATIK-1125:
---------------------------------------

[~ssteiner1] the bug exists several times on JIRA already (e.g. this one, and BATIK-1111). No use in re-reporting it again.

It consists actually of three bugs. 1) the Maven packages don't include the _new_ codecs because they detected the _old_ JDK when the package was compiled - that is the one already fixed, and just needs new packages to be published 2) the _old_ codecs that were included aren't in the service file, which is https://github.com/apache/batik/pull/5/commits/3f274d6e8c123ce69e10f7e359b21dad36392775 pull request 5. and 3) the registry will fail to update its cache if you don't add codecs in the correct (descending) priority, making the service loader mechanism pointless, pull request 4, https://github.com/apache/batik/pull/4/commits/374ea662953ab2eda78433cd952d781dd2d9396e
Maybe because of this registry bug, someone disabled the "old" codecs: the came first, have lower priority, and then the new ImageIO codecs will not be used because of this bug.

No, I don't have a test case for you, because it requires additional codecs, service files, etc.
Essentially, you'd need to add a new image format. Depending on your classpath, it may work, may not work, or the old codecs may no longer work...

You can just read the code that you currently have:
https://github.com/apache/batik/blob/b4d0b214c73f890d7d6c9b5da726c0c00d37c08f/batik-awt-util/src/main/java/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java#L281
Now assume, I first register PNG with priority 100. Then I next register JPEG with priority 10. It will return in line 281, without resetting the cache in 285/286, so it will not know that a JPEG codec was added!

It's just 15 lines of existing Batik code to read...

> Rasterizer 1.8 fails with base64 embedded png
> ---------------------------------------------
>
>                 Key: BATIK-1125
>                 URL: https://issues.apache.org/jira/browse/BATIK-1125
>             Project: Batik
>          Issue Type: Bug
>          Components: SVG Rasterizer
>    Affects Versions: 1.8
>         Environment: Linux centOS 6.6 (final)
> java version "1.7.0_79"
> OpenJDK Runtime Environment (rhel-2.5.5.3.el6_6-x86_64 u79-b14)
> OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
> AND
> Linux Ubunu 14.04.2
> java version "1.7.0_79"
> OpenJDK Runtime Environment (IcedTea 2.5.5) (7u79-2.5.5-0ubuntu0.14.04.2)
> OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
>            Reporter: Matthew Wimmer
>
> when calling batik-renderer-1.8.jar from the command-line SVGs with base64 embedded png images that previously rendered fine with batik 1.7.1 on the same system(s) do not render correctly and fail with the following error:
> Converting DEBUG.svg to /obfuscatedpath/DEBUG.png ... org.apache.batik.bridge.BridgeException: file:/obfuscatedpath/DEBU$
> The URI "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAACc4AAAnOCAYAAACYykaSAAAABHNCSVQICAgIfAhkiAAAIABJREFU eJzs3Xt0U/ed9/v3BnMxF9syGBMDBouAwZirDIQ7DTJJm6QN6YgmJdO0nY4409PVzprz9DFr+qyu tn90zJqcaee$
> on element <image> can't be opened because:
> URL data in unsupported format or corrupt
>         at org.apache.batik.bridge.UserAgentAdapter.getBrokenLinkDocument(Unknown Source)
>         at org.apache.batik.bridge.SVGImageElementBridge.createRasterImageNode(Unknown Source)
>         at org.apache.batik.bridge.SVGImageElementBridge.createImageGraphicsNode(Unknown Source)
>         at org.apache.batik.bridge.SVGImageElementBridge.buildImageGraphicsNode(Unknown Source)
>         at org.apache.batik.bridge.SVGImageElementBridge.createGraphicsNode(Unknown Source)
>         at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
>         at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
>         at org.apache.batik.bridge.GVTBuilder.build(Unknown Source)
>         at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
>         at org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown Source)
>         at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source)
>         at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
>         at org.apache.batik.apps.rasterizer.SVGConverter.transcode(Unknown Source)
>         at org.apache.batik.apps.rasterizer.SVGConverter.execute(Unknown Source)
>         at org.apache.batik.apps.rasterizer.Main.execute(Unknown Source)
>         at org.apache.batik.apps.rasterizer.Main.main(Unknown Source)
> org.apache.batik.transcoder.TranscoderException: null
> Enclosed Exception:
> file:/obfuscatedpath/DEBUG.svg:0
> The URI "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAACc4AAAnOCAYAAACYykaSAAAABHNCSVQICAgIfAhkiAAAIABJREFU eJzs3Xt0U/ed9/v3BnMxF9syGBMDBouAwZirDIQ7DTJJm6QN6YgmJdO0nY4409PVzprz9DFr+qyu tn90zJqcaee...
> on element <image> can't be opened because:
> URL data in unsupported format or corrupt
>         at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
>         at org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown Source)
>         at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source)
>         at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
>         at org.apache.batik.apps.rasterizer.SVGConverter.transcode(Unknown Source)
>         at org.apache.batik.apps.rasterizer.SVGConverter.execute(Unknown Source)
>         at org.apache.batik.apps.rasterizer.Main.execute(Unknown Source)
>         at org.apache.batik.apps.rasterizer.Main.main(Unknown Source)
> ... error (SVGConverter.error.while.rasterizing.file)
> Based on some google searching of this issue I attempted to put the batik-codecs-1.8.jar file in my -classpath with no resolution.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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