Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 338380

Summary: SaveAsImage(PNG,PDF,SVG format) doesn't work when mulitple
Product: [Modeling] GMF-Runtime Reporter: Liangfei Su <suliangfei>
Component: GeneralAssignee: Project Inbox <gmf-runtime-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: charleszq, pierre-charles.david, suliangfei, Unripe, webmaster
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
screenshot
none
the log none

Description Liangfei Su CLA 2011-02-28 04:40:51 EST
Build Identifier: M20100909-0800

Start the eclipse with GMF installed also with orbit extracted to dropins/ directory. 
1. Create a geoshape plugin according to the examples wizard.
2. Debug a eclipse instance.
3. Create a geoshape diagram instance.
4. Try to "Save As Image", choose the format of PNG/SVG/PDF. An NoClassDefFoundError will be thrown. See attached screenshot.

If i remove the "duplicated" org.apache.batik.ext.awt_1.7.0.v200903091627.jar that come from orbit.zip, and restart eclipse, the saveAsImage action would work.

So it looks like to me that the coexists of uncompatible org.apache.batik.ext.awt it's the cause of the issue. But in the manifest of org.apache.batik.transcoder_1.6.0(which is the caller of org.apache.batik.ext.awt in this case), the require version is given like this:
org.apache.batik.ext.awt;version="[1.6.0,1.7.0)"
So i suppose a coexist of two version of org.apache.batik.ext.awt should not cause such a problem. Should this be a problem of GMF runtime, or a problem of bundle loading?

Test on GMF version: 1.4.1



Reproducible: Always

Steps to Reproduce:
1. Create a geoshape plugin according to the examples wizard.
2. Debug a eclipse instance.
3. Create a geoshape diagram instance.
4. Try to "Save As Image", choose the format of PNG/SVG/PDF. An NoClassDefFoundError will be thrown. See attached screenshot.
Comment 1 Liangfei Su CLA 2011-02-28 04:41:47 EST
Created attachment 189922 [details]
screenshot
Comment 2 Liangfei Su CLA 2011-02-28 04:42:11 EST
Created attachment 189923 [details]
the log
Comment 3 Charles CLA 2011-09-19 05:05:23 EDT
while trying on Eclipse 3.7 with GMF 1.4.1, png and svg work fine, but PDF will report the following exception:

java.lang.ClassCastException: org.eclipse.gmf.runtime.draw2d.ui.render.internal.image.ImageRenderedImage cannot be cast to org.eclipse.gmf.runtime.draw2d.ui.render.awt.internal.svg.SVGImage
	at org.eclipse.gmf.runtime.diagram.ui.render.util.CopyToImageUtil.saveToOutputStream(CopyToImageUtil.java:529)
	at org.eclipse.gmf.runtime.diagram.ui.render.util.CopyToImageUtil.saveToFile(CopyToImageUtil.java:513)
	at org.eclipse.gmf.runtime.diagram.ui.render.util.CopyToImageUtil.copyToImage(CopyToImageUtil.java:378)
	at org.eclipse.gmf.runtime.diagram.ui.render.util.CopyToImageUtil.copyToImage(CopyToImageUtil.java:305)
	at org.eclipse.gmf.runtime.diagram.ui.render.actions.CopyToImageAction$1.run(CopyToImageAction.java:260)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
Comment 4 Kevin Mising name CLA 2011-10-20 07:50:55 EDT
We are having the same problem here.

> while trying on Eclipse 3.7 with GMF 1.4.1, png and svg work fine, but PDF will
> report the following exception:
> 
> java.lang.ClassCastException:
> org.eclipse.gmf.runtime.draw2d.ui.render.internal.image.ImageRenderedImage
> cannot be cast to
> org.eclipse.gmf.runtime.draw2d.ui.render.awt.internal.svg.SVGImage
>     at
> org.eclipse.gmf.runtime.diagram.ui.render.util.CopyToImageUtil.saveToOutputStream(CopyToImageUtil.java:529)
>     at
> org.eclipse.gmf.runtime.diagram.ui.render.util.CopyToImageUtil.saveToFile(CopyToImageUtil.java:513)
>     at
> org.eclipse.gmf.runtime.diagram.ui.render.util.CopyToImageUtil.copyToImage(CopyToImageUtil.java:378)
>     at
> org.eclipse.gmf.runtime.diagram.ui.render.util.CopyToImageUtil.copyToImage(CopyToImageUtil.java:305)
>     at
> org.eclipse.gmf.runtime.diagram.ui.render.actions.CopyToImageAction$1.run(CopyToImageAction.java:260)
>     at
> org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
>     at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
Comment 5 Mariot Chauvin CLA 2011-10-25 04:39:32 EDT
*** Bug 361888 has been marked as a duplicate of this bug. ***
Comment 6 Svenja Wendler CLA 2018-01-11 06:00:53 EST
Hello I currently also face this problem. Are there any news on this bug?
Comment 7 Pierre-Charles David CLA 2018-01-12 04:35:45 EST
(In reply to Svenja Wendler from comment #6)
> Hello I currently also face this problem. Are there any news on this bug?

Hi. I'm in the process of updating the Batik version used by GMF Runtime (for completely different reasons), so I'll keep this scenario in mind and try to have a look. I can't make any guarantee though, as we have limited resources to put into GMF and a large part has already been consumed by the Batik upgrade.