Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mdt-papyrus.dev] Diagrams with SVG in latest photon broken

On 01/06/2018 10:53, Ansgar Radermacher wrote:

there are multiple SVG issue which are partly already resolved. I understand that photon will revert to batik 1.6, but here's the info anyway:


Thanks for the summary.

1. SVGs are not displayed: instead of displaying an SVG, we observe a "println" output that is coming from the DefaultGraphics2D (which is a sample implementation). The reason is that class AbstractGraphicsNode demands a copy in case of clipping (which is always used in case of Papyrus). It uses the following code g2d = (Graphics2D)g2d.create(); The current g2d is the GMF runtime Graphics2DToGraphicsAdaptor. This class should overload the create operation inherited from DefaultGraphics2D. Since it does not, a new DefaultGraphics2D is created instead. The fix is therefore to overload this class. Quentin has already created a patch: https://git.eclipse.org/r/#/c/123759/

The patch is postponed until we get around to actually upgrading GMF Runtime to Batik 1.9 or later. I've added the corresponding bugzilla (#535342) to the next GMF Runtime version (1.13.0, not idea yet when this will be released).


2. "File-> Save as image" file fails with an NPE in case of SVG. The reason is that no (batik) ImageWriter (batik.ext-awt) is registered for "image/png". This is due to a missing dependency from batik.util to batik.codec, as proposed in https://bz.apache.org/bugzilla/show_bug.cgi?id=44682 and https://stackoverflow.com/questions/16138850/batik-svggraphics2d-nullpointerexception-when-drawing-image. Batik.util contains a class "Service" which looks up registered services, but does not "see" the batik.codec image writers due to the missing dependency. However, this solution is not possible (at least not on Eclipse level), since batik.codec also depends on batik.util, i.e. would introduce a dependency cycle. A workaround is to register image/png, image/jpeg, ... manually in GMF.

I've had to do a similar workaround on Sirius (https://git.eclipse.org/r/c/122769/1/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/ui/provider/DiagramUIPlugin.java), but then got busy with the other Batik packaging issues and never got around to move the workaround directly in GMF. Sorry about that.  Ansgar, if you create the corresponding ticket in GMF, you can put it directly in 1.13.0 as Target Milestone.


3. Hangs on startup on "non-clean" workspaces. Might be an installation problem on my machine, caused by exception below.

MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.e4.ui.workbench.swt".
!STACK 0
java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "org.apache.batik.dom.AbstractDocument.createEvent(Ljava/lang/String;)Lorg/w3c/dom/events/Event;" the class loader (instance of org/eclipse/osgi/internal/loader/EquinoxClassLoader) of the current class, org/apache/batik/anim/dom/SVGOMDocument, and the class loader (instance of <bootloader>) for interface org/w3c/dom/events/DocumentEvent have different Class objects for the type org/w3c/dom/events/Event used in the signature     at org.apache.batik.anim.dom.SVGDOMImplementation.createDocument(SVGDOMImplementation.java:139)     at org.apache.batik.dom.util.SAXDocumentFactory.startElement(SAXDocumentFactory.java:641)     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
...

This is the main issue for which I have no fix or workaround and which caused the decision to revert to Batik 1.6 for Photon. It's not just you, BIRT was the first to see it, and we could also reproduce it with Sirius.

The only good news regarding this one is that the new Batik 1.10 *may* have made changes on their side that would fix that (as part of changes to by compatible with java 9 & 10). See https://bugs.eclipse.org/bugs/show_bug.cgi?id=522740#c85.



Back to the top