XFC exception with OpenJDK for SVG because of batik expecting com/sun/image/codec/jpeg/TruncatedFileException

David Clunie <[email protected]> Fri, 06 Feb 2015 17:42:30 -0500
Newsgroups gmane.text.xml.xfc.general
Message-ID <[email protected]>
Hi Hussein

I happened to run XFC on an OpenJDK Java 9 (build 1.9.0-ea-b48) and for some
files it threw an exception from batik:

Exception in thread "main" java.lang.NoClassDefFoundError: 
com/sun/image/codec/jpeg/TruncatedFileException
	at 
org.apache.batik.ext.awt.image.codec.jpeg.JPEGRegistryEntry.handleStream(Unknown 
Source)
	at org.apache.batik.ext.awt.image.spi.ImageTagRegistry.readURL(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.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.XMLAbstractTranscoder.transcode(Unknown 
Source)
	at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown 
Source)
	at 
com.xmlmind.xfc_ext.SVGGraphicFactory.createGraphic(SVGGraphicFactory.java:84)
...

I assume that batik is naughty and depends on a com/sun package, and
perhaps there is a more recent version that doesn't.

This was with xfc_pro_java-5_0_0.

A quick Google revealed:

http://www.stichlberger.com/software/workaround-for-batiks-noclassdeffounderrorclassnotfoundexception-truncatedfileexception/

David

--
XMLmind FO Converter Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xfc-support