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

Bug 352709

Summary: invalid image provider id crashes diagram editor
Product: [Modeling] Graphiti Reporter: Michael Keppler <michael.keppler>
Component: CoreAssignee: Michael Wenz <michael.wenz>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: michael.wenz
Version: 0.8.0Flags: michael.wenz: juno+
Target Milestone: 0.9.0   
Hardware: All   
OS: All   
Whiteboard: Juno M1 theme_bugs Indigo SR1
Attachments:
Description Flags
Patch for the fix none

Description Michael Keppler CLA 2011-07-21 04:34:55 EDT
If the ID of an image provider is invalid, the diagram editor can't be instantiated at all.

I suggest to
* log a runtime error or write to the console if an image provider can't be created (for easier debugging)
* catch the situation that an image provider is null and to create the diagram editor nonetheless (for more robustness).
Comment 1 Michael Wenz CLA 2011-07-21 05:14:47 EDT
Currently a not meaningfull NPE is thrown in this case:
java.lang.NullPointerException
	at org.eclipse.gef.ui.parts.GraphicalEditor.getCommandStack(GraphicalEditor.java:252)
	at org.eclipse.gef.ui.parts.GraphicalEditor.init(GraphicalEditor.java:347)
	at org.eclipse.graphiti.ui.internal.editor.DiagramEditorInternal.init(DiagramEditorInternal.java:1093)
	at org.eclipse.ui.internal.EditorManager.createSite(EditorManager.java:828)

Should target for Juno and for Indigo SR1
Comment 2 Michael Wenz CLA 2011-07-21 07:16:22 EDT
I have created a fix for this and checked it in into head. Now an invalid image provider does not prevent the editor from opening. Instead an IllegalArgumentException is logged.
Also created a JUnit plugin test in org.eclipse.graphiti.bot.tests.ExtensionManagerTest#testCreateDiagramTypeProvider
Comment 3 Michael Wenz CLA 2011-07-21 07:26:36 EDT
Created attachment 200077 [details]
Patch for the fix
Comment 4 Michael Wenz CLA 2011-07-21 07:27:57 EDT
I have also downported the fix to Indigo SR1 (Graphiti 0.8)
Comment 5 Michael Wenz CLA 2012-04-11 10:24:14 EDT
Bookkeeping: Set target release
Comment 6 Michael Wenz CLA 2012-06-28 10:35:05 EDT
Part of Graphiti 0.9.0 (Eclipse Juno)