| Summary: | NPE in SVGWorkspaceImageFigure.refreshFigure | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] Sirius | Reporter: | Stephane Begaudeau <stephane.begaudeau> | ||||||
| Component: | Diagram | Assignee: | Project Inbox <sirius.diagram-inbox> | ||||||
| Status: | CLOSED DUPLICATE | QA Contact: | |||||||
| Severity: | major | ||||||||
| Priority: | P3 | CC: | cedric.brun, cmordant1, laurent.redor, maxime.porhel | ||||||
| Version: | 1.0.0 | Keywords: | triaged | ||||||
| Target Milestone: | 2.0.0 | ||||||||
| Hardware: | Macintosh | ||||||||
| OS: | Mac OS X | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Stephane Begaudeau
This might be related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=439095 Could you try adding a required dependency on apache xerces in your product or bundle ? (In reply to Cedric Brun from comment #1) > This might be related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=439095 > > Could you try adding a required dependency on apache xerces in your product > or bundle ? Apache Xerces is already in my product: org.apache.xerces_2.9.0.v201101211617.jar In the mean time, since I am only using one svg file in my product, I have replaced it with a png. Stéphane, the problematic SVG is "Dart-Designer/bundles/org.obeonetwork.dsl.dart.design/icons/common/empty.svg"? I make a simple project with this svg file. I have not a NPE but an error caused by an invalid SVG file. Steps to reproduce: * Import the project SampleProjectWithSVG * Open the diagram sampleDiagramWithSVG * The editor is opened with this error: "Could not open the editor: invalid.element" org.w3c.dom.DOMException: invalid.element at org.apache.batik.dom.AbstractNode.createDOMException(Unknown Source) at org.apache.batik.dom.svg.SVGDOMImplementation.createElementNS(Unknown Source) at org.apache.batik.dom.svg.SVGOMDocument.createElementNS(Unknown Source) at org.apache.batik.dom.svg.SVGDOMImplementation.createDocument(Unknown Source) at org.apache.batik.dom.util.SAXDocumentFactory.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(Unknown Source) at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(Unknown Source) at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown Source) at org.eclipse.sirius.diagram.ui.tools.api.figure.SVGFigure.loadDocument(SVGFigure.java:90) at org.eclipse.sirius.diagram.ui.tools.api.figure.SVGFigure.setURI(SVGFigure.java:72) at org.eclipse.sirius.diagram.ui.tools.api.figure.SVGFigure.setURI(SVGFigure.java:64) at org.eclipse.sirius.diagram.ui.tools.api.figure.SVGWorkspaceImageFigure.updateImageURI(SVGWorkspaceImageFigure.java:188) at org.eclipse.sirius.diagram.ui.tools.api.figure.SVGWorkspaceImageFigure.flyWeightImage(SVGWorkspaceImageFigure.java:248) at org.eclipse.sirius.diagram.ui.edit.internal.part.AbstractDiagramNodeEditPartRefreshVisualsOperation.refreshWidth(AbstractDiagramNodeEditPartRefreshVisualsOperation.java:183) at org.eclipse.sirius.diagram.ui.edit.internal.part.AbstractDiagramNodeEditPartRefreshVisualsOperation.refreshSize(AbstractDiagramNodeEditPartRefreshVisualsOperation.java:98) at org.eclipse.sirius.diagram.ui.edit.internal.part.DiagramNodeEditPartOperation.internalRefreshVisuals(DiagramNodeEditPartOperation.java:104) at org.eclipse.sirius.diagram.ui.edit.internal.part.DiagramNodeEditPartOperation.refreshVisuals(DiagramNodeEditPartOperation.java:72) at org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramNodeEditPart.refreshVisuals(AbstractDiagramNodeEditPart.java:305) Created attachment 246150 [details]
Project for steps to reproduce (bad version)
(In reply to Laurent Redor from comment #4) > Created attachment 246150 [details] > Project for steps to reproduce (comment 3) The file empty.svg in your example has a size of 57KB while mine has a size of 5KB. If I open your file, this is the beginning of its content: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <!DOCTYPE html> <html lang="en" class=" "> <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object# article: http://ogp.me/ns/article# profile: http://ogp.me/ns/profile#"> <meta charset='utf-8'> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="Content-Language" content="en"> <title>Dart-Designer/empty.svg at v0.4.0 · dartdesigner/Dart-Designer · GitHub</title> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-114.png"> <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114.png"> <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png"> <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png"> <meta property="fb:app_id" content="1401488693436528"> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< It's not my svg file, it's the Github page where my svg file is displayed ^^" Don't consider this [1] to be my svg file, this [2] is the real image... 1: https://github.com/dartdesigner/Dart-Designer/blob/b35c096057ad6e6d6c4e98c10129a1dd22a4aa20/bundles/org.obeonetwork.dsl.dart.design/icons/common/empty.svg 2: https://raw.githubusercontent.com/dartdesigner/Dart-Designer/b35c096057ad6e6d6c4e98c10129a1dd22a4aa20/bundles/org.obeonetwork.dsl.dart.design/icons/common/empty.svg Sorry for this problem, I uploaded a new version of the sample project with the real image. There is no NPE on Linux. I will try on Mac. Created attachment 246154 [details] Project with SVG image for steps to reproduce (comment 3) Not reproduce with the simple project even on Mac. Stephane asked to nilsdoehring to try to reproduce the problem with the simple project on https://github.com/dartdesigner/Dart-Designer/issues/72 Waiting for returns *** Bug 440478 has been marked as a duplicate of this bug. *** In the meantime we could at least, make sure this failure revealed with an "ImageNotFound" image + logging an error to state that Batik could not be instantiated for some reason instead of an NPE. This issue seems to be the NPE which came with the SAX2 Driver not found exception corrected in Bug 439095. There is no more work to do: the correction done on 439095 will allow to retrieve the SAX2 driver, and the case were the transposer was null are now handled Note that if an image is not found, we already load some not found (svg) image. Cedric proposed to display the IageNotFound figure, if we want to do this in this SAX2 driver not found (if the provided correction on 439095 + the corrected NPEs are not sufficient), it will require to display the PNG version of the ImageNotFound (batik will not be able to load the SVG version, as there is no SAX2 driver found) and this will require to change the type of figure: from SVGWorkspaceImageFigure to WorkspaceImageFigure. Well that was more of a workaround proposition if we could not fix the issue itself. Now that https://bugs.eclipse.org/bugs/show_bug.cgi?id=439095 is fixed and considering what you just said, it might not be worth it. The NPE as been corrected by commit afbfffda43118dc4dc244f64b5eaa97df8a093c0 (see https://git.eclipse.org/r/#/c/35319/3) *** This bug has been marked as a duplicate of bug 439095 *** Already corrected in Sirius 2.0 |