You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Michael Glass <Mi...@gmx.de> on 2008/05/08 12:02:05 UTC

ClassCastException while loading image

Hello all,

I just ran into rather strange problems during FO processing, causing the exception shown below. My research (web searching, FAQ & mail archive etc.) turned up blank.

----------------------------

Started: "D:\Java\jre1.6.0_06\bin\java"
... lengthy OxygenXML 9.0.0 eclipse plugin commandline ... org.apache.fop.cli.Main -fo D:\Tools\e33\xml-test\figures.xml_xslt -pdf D:\Tools\e33\xml-test\figures.pdf
08.05.2008 09:30:01 org.apache.fop.image.ImageIOImage loadBitmap
SCHWERWIEGEND: Error while loading image: [B cannot be cast to [S
java.lang.ClassCastException: [B cannot be cast to [S
	at sun.awt.image.ShortInterleavedRaster.getDataElements(Unknown Source)
	at org.apache.fop.image.ImageIOImage.loadBitmap(ImageIOImage.java:174)
	at org.apache.fop.image.ImageIOImage.loadDimensions(ImageIOImage.java:68)
	at org.apache.fop.image.AbstractFopImage.load(AbstractFopImage.java:161)
	at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:75)
	at org.apache.fop.fo.FObj.processNode(FObj.java:125)
	at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:320)
	at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:185)
	at net.sf.saxon.event.ContentHandlerProxy.startContent(ContentHandlerProxy.java:343)
...
-----------------------------------

What I did and what happened:

Two png images are to be included into a pdf. Exceptions occur, finally resulting in a null image. PDF is generated, can be viewed, but one image is missing. There's just empty space of correct dimensions in the document.

Circumstances:

Both images are fetched from a web server. Both are available by URL in a browser and both can be opened by an image editor program, meaning the files themselves seem to be ok. Loading the images from remote by a small java awt test application (using ImageIO) works fine. Both images were created by conversion to png (ImageMagick), one using a wmf as source the other having an emf as source. Both images share the same filename but are from different paths/URLs.

Java 1.6.0_06
fop.jar: Implementation-Version: 0.94 (OxygenXML 9.0.0 eclipse plugin)

fop.jar: Implementation-Version: 0.20.4 works just fine (XMLmind FO converter 3.1 without VM))

What happened? Any ideas? Upon request I'll gladly provide both images, the minimal fo source and the pdf result.

Best regards and thanks in advance,

Michael Glass
-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

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


Re: ClassCastException while loading image

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Smells like some class obfuscation gone wrong. Please run FOP outside of
OxygenXML with FOP's own command-line to see if the same thing occurs
there. Otherwise, no better idea, yet.

On 08.05.2008 12:02:05 Michael Glass wrote:
> Hello all,
> 
> I just ran into rather strange problems during FO processing, causing the exception shown below. My research (web searching, FAQ & mail archive etc.) turned up blank.
> 
> ----------------------------
> 
> Started: "D:\Java\jre1.6.0_06\bin\java"
> ... lengthy OxygenXML 9.0.0 eclipse plugin commandline ... org.apache.fop.cli.Main -fo D:\Tools\e33\xml-test\figures.xml_xslt -pdf D:\Tools\e33\xml-test\figures.pdf
> 08.05.2008 09:30:01 org.apache.fop.image.ImageIOImage loadBitmap
> SCHWERWIEGEND: Error while loading image: [B cannot be cast to [S
> java.lang.ClassCastException: [B cannot be cast to [S
> 	at sun.awt.image.ShortInterleavedRaster.getDataElements(Unknown Source)
> 	at org.apache.fop.image.ImageIOImage.loadBitmap(ImageIOImage.java:174)
> 	at org.apache.fop.image.ImageIOImage.loadDimensions(ImageIOImage.java:68)
> 	at org.apache.fop.image.AbstractFopImage.load(AbstractFopImage.java:161)
> 	at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:75)
> 	at org.apache.fop.fo.FObj.processNode(FObj.java:125)
> 	at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:320)
> 	at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:185)
> 	at net.sf.saxon.event.ContentHandlerProxy.startContent(ContentHandlerProxy.java:343)
> ...
> -----------------------------------
> 
> What I did and what happened:
> 
> Two png images are to be included into a pdf. Exceptions occur, finally resulting in a null image. PDF is generated, can be viewed, but one image is missing. There's just empty space of correct dimensions in the document.
> 
> Circumstances:
> 
> Both images are fetched from a web server. Both are available by URL in a browser and both can be opened by an image editor program, meaning the files themselves seem to be ok. Loading the images from remote by a small java awt test application (using ImageIO) works fine. Both images were created by conversion to png (ImageMagick), one using a wmf as source the other having an emf as source. Both images share the same filename but are from different paths/URLs.
> 
> Java 1.6.0_06
> fop.jar: Implementation-Version: 0.94 (OxygenXML 9.0.0 eclipse plugin)
> 
> fop.jar: Implementation-Version: 0.20.4 works just fine (XMLmind FO converter 3.1 without VM))
> 
> What happened? Any ideas? Upon request I'll gladly provide both images, the minimal fo source and the pdf result.
> 
> Best regards and thanks in advance,
> 
> Michael Glass



Jeremias Maerki


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