xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joel Uckelman <uckel...@nomic.net>
Subject SVG which renders in 1.7 fails in 1.8pre
Date Thu, 04 Oct 2012 22:34:54 GMT
I'm investigating switching from Batik 1.7 to a nightly 1.8 build
because 1.7 fails catastrophically when used with Java 7 to load SVG
containing <image> elements which reference JPEGs. (This is apparently
due to Batik 1.7 using com.sun.image.codec.jpeg.TruncatedFileException,
which no longer exists in Java 7, so one ends up with a
NoClassDefFoundError.) This is a growing problem for us because our
users are starting to use Java 7 now.

I have some SVG files which reside in a JAR and are rendered to
BufferedImages using a custom subclass of SVGAbstractTranscoder which
I wrote (it's nearly the same as ImageTranscoder, except it doesn't
write the image to a file). When I use the Batik 1.7 JARs, all SVG---
both SVG containing <image> elements and SVG without <image> elements---
renders correctly. When I use the Batik JARs built with the the 12-09-25
1.8pre source, SVG without <image> elements renders correctly, but
rendering the SVG with <image> elements fails with an exception. (I've
trimmed the bottom of the stack trace, as that's my code which is
calling custom transcoder, so not relevant, as well as a ton of base64
in the URI.)

org.apache.batik.bridge.BridgeException: jar:file:/home/uckelman/projects/VASSAL/mods/Here_I_Stand_2.3.vmod!/images/Ottoman_hand.svg:0
The URI "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAAA0CAYA
...
m/8Dgk9CDmp9DwIAAAAASUVORK5CYII= "
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.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 VASSAL.tools.image.svg.SVGRenderer$Rasterizer.transcode(SVGRenderer.java:224)
  at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source)
  at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
  at VASSAL.tools.image.svg.SVGRenderer.render(SVGRenderer.java:133)


I extracted the same SVG file above from the JAR and tried opening it
using Squiggle from 1.8pre, and found that Squiggle was able to render
it. I also tried the URI

  jar:file:/home/uckelman/projects/VASSAL/mods/Here_I_Stand_2.3.vmod!/images/Ottoman_hand.svg

with "Open Location", and Squiggle was able to render that, too. This
makes it clear that the SVG file is fine and that 1.8pre can render it.

Can anyone tell me what changed between 1.7 and 1.8pre that could be
causing the failure I'm seeing?

The code for my renderer is here:

http://vassalengine.svn.sourceforge.net/viewvc/vassalengine/VASSAL-src/trunk/src/VASSAL/tools/image/svg/SVGRenderer.java?view=markup&pathrev=8398

-- 
J.

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


Mime
View raw message