Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 370500 - NPE in ContentTypeDecorator for UML files
Summary: NPE in ContentTypeDecorator for UML files
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: 3.8 M6   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 371346 373174 (view as bug list)
Depends on:
Blocks: 251776 370864
  Show dependency tree
 
Reported: 2012-02-02 17:15 EST by Ed Willink CLA
Modified: 2012-03-03 17:21 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2012-02-02 17:15:24 EST
For 4.2M5 I get

java.lang.NullPointerException
	at org.eclipse.ui.internal.ide.ContentTypeDecorator.decorate(ContentTypeDecorator.java:52)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorDefinition.decorate(LightweightDecoratorDefinition.java:269)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorManager$LightweightRunnable.run(LightweightDecoratorManager.java:81)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.decorate(LightweightDecoratorManager.java:365)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.getDecorations(LightweightDecoratorManager.java:347)
	at org.eclipse.ui.internal.decorators.DecorationScheduler$1.ensureResultCached(DecorationScheduler.java:371)
	at org.eclipse.ui.internal.decorators.DecorationScheduler$1.run(DecorationScheduler.java:331)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

when the file is a UML file. MDT/UML2 is installed so that there is a UML Model Editor available, but the icon backs off to the (Windows Vista) system where StarUML is available.

(The icon back off was present in 3.8M4 too and did not appear right there.)
Comment 1 Remy Suen CLA 2012-02-03 08:10:23 EST
This is new code added for bug 251776.
Comment 2 Dani Megert CLA 2012-02-03 09:20:15 EST
Ed, did you play around with the new 'editorAssocitaionOverride'? If not, the code should not pass line 52.
Comment 3 Ed Willink CLA 2012-02-03 09:32:46 EST
I wasn't conscious of doing anything. I was just debugging my own problem and my NPE breakpoint stopped in your code. Then I saw that it was on the console log too.

The UML file type is non-trivial since it now has at least four different content types for different namespaces. I don't see any file association elements in uml2.uml/plugin.xml or uml2.uml.editor/plugin.xml.

As I indicated in my final comment, I don't think that the UML content icon was being correctly detected in 3.8M4 either. In both 3.8M4 and 4.2M5 I see a Windows tool icon, although the Open Editor pull down offers me an (Eclipse) UML Editor option.

I suspect a simple null guard will hide the message and restore the status quo. One day you can perhaps improve an icon.
Comment 4 Dani Megert CLA 2012-02-03 09:35:49 EST
Fixed in R3_development: 5434bb309a41cdffe2752c29a6f5fa35dd1556ba
Fixed in master: 5eff455b45bc433967c3d7c5ef520fa231ce29ec
Comment 5 Dani Megert CLA 2012-02-03 09:37:08 EST
(In reply to comment #3)
I asked because the NPE happens in a code branch where you should not end up, if you didn't try out the new 'editorAssocitaionOverride' extension point.

If you have time I'd appreciate if you could debug it again and see why

    if (hasEditorAssociationOverrides()) {

returns true and then causes the NPE.
Comment 6 Ed Willink CLA 2012-02-03 09:54:43 EST
The following derives from Xtext

<fragment>
 <extension
       point="org.eclipse.ui.ide.editorAssociationOverride">
    <editorAssociationOverride
          class="org.eclipse.xtext.common.types.shared.SharedCommonTypesExecutableExtensionFactory:org.eclipse.xtext.common.types.shared.jdt38.OriginalEditorSelector"
          id="xtext.common.types.originalEditorSelector">
    </editorAssociationOverride>
 </extension>
</fragment>

and is the sole override.
Comment 7 Dani Megert CLA 2012-02-03 10:01:28 EST
Wow, they are fast adopters! Thanks for checking Ed.
Comment 8 Remy Suen CLA 2012-02-13 06:37:42 EST
*** Bug 371346 has been marked as a duplicate of this bug. ***
Comment 9 Remy Suen CLA 2012-03-03 17:21:44 EST
*** Bug 373174 has been marked as a duplicate of this bug. ***