Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 352709 - invalid image provider id crashes diagram editor
Summary: invalid image provider id crashes diagram editor
Status: CLOSED FIXED
Alias: None
Product: Graphiti
Classification: Modeling
Component: Core (show other bugs)
Version: 0.8.0   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: 0.9.0   Edit
Assignee: Michael Wenz CLA
QA Contact:
URL:
Whiteboard: Juno M1 theme_bugs Indigo SR1
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-21 04:34 EDT by Michael Keppler CLA
Modified: 2012-06-28 10:35 EDT (History)
1 user (show)

See Also:
michael.wenz: juno+


Attachments
Patch for the fix (9.11 KB, patch)
2011-07-21 07:26 EDT, Michael Wenz CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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)