Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 219056 - [editors] InvalidRegistryObjectException or NPE on editor switch
Summary: [editors] InvalidRegistryObjectException or NPE on editor switch
Status: CLOSED DUPLICATE of bug 299636
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Chris Aniszczyk CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 237739 241004 287973 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-02-15 01:40 EST by Andrey Loskutov CLA
Modified: 2012-09-07 12:53 EDT (History)
9 users (show)

See Also:
curtis.windatt.public: review+
phil_fj12: review?
darin.eclipse: review+


Attachments
mylyn/context/zip (751 bytes, application/octet-stream)
2008-02-15 11:09 EST, Chris Aniszczyk CLA
no flags Details
Protects against NPE (2.20 KB, patch)
2008-05-22 10:39 EDT, Curtis Windatt CLA
no flags Details | Diff
org.eclipse.pde.core.patch (2.13 KB, patch)
2008-05-23 00:04 EDT, Chris Aniszczyk CLA
no flags Details | Diff
mylyn/context/zip (625 bytes, application/octet-stream)
2008-05-25 15:15 EDT, Chris Aniszczyk CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Loskutov CLA 2008-02-15 01:40:39 EST
Build ID: 3.4 M5 I20080207-1530

Steps To Reproduce:
1. Open two different plugin.xml files, one in the "plugin.xml" (plain text view) tab, another one on "Extensions". This two plugin.xml files should contain different contributions
2. Switch from xml editor tab of one editor to the extensions tab of another
3. You see an exception:

org.eclipse.core.runtime.InvalidRegistryObjectException: Invalid registry object
	at org.eclipse.core.internal.registry.RegistryObjectManager.basicGetObject(RegistryObjectManager.java:273)
	at org.eclipse.core.internal.registry.RegistryObjectManager.getObject(RegistryObjectManager.java:263)
	at org.eclipse.core.internal.registry.BaseExtensionHandle.getExtension(BaseExtensionHandle.java:30)
	at org.eclipse.core.internal.registry.BaseExtensionHandle.getUniqueIdentifier(BaseExtensionHandle.java:67)
	at org.eclipse.pde.internal.core.plugin.PluginExtension.getId(PluginExtension.java:186)
	at org.eclipse.pde.internal.core.plugin.PluginExtension.equals(PluginExtension.java:111)
	at org.eclipse.pde.internal.ui.search.ManifestEditorOpener.getAttributeMatch(ManifestEditorOpener.java:100)
	at org.eclipse.pde.internal.ui.search.ManifestEditorOpener.findExactMatch(ManifestEditorOpener.java:46)
	at org.eclipse.pde.internal.ui.search.SearchResult.computeContainedMatches(SearchResult.java:96)
	at org.eclipse.search2.internal.ui.text.EditorAnnotationManager.addAnnotations(EditorAnnotationManager.java:221)
	at org.eclipse.search2.internal.ui.text.EditorAnnotationManager.addSearchResult(EditorAnnotationManager.java:108)
	at org.eclipse.search2.internal.ui.text.EditorAnnotationManager.setSearchResults(EditorAnnotationManager.java:101)
	at org.eclipse.search2.internal.ui.text.WindowAnnotationManager.startHighlighting(WindowAnnotationManager.java:82)
	at org.eclipse.search2.internal.ui.text.WindowAnnotationManager.access$1(WindowAnnotationManager.java:75)
	at org.eclipse.search2.internal.ui.text.WindowAnnotationManager$1.partVisible(WindowAnnotationManager.java:64)
	at org.eclipse.ui.internal.PartListenerList2$7.run(PartListenerList2.java:170)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.runtime.Platform.run(Platform.java:857)
	at org.eclipse.ui.internal.PartListenerList2.fireEvent(PartListenerList2.java:53)
	at org.eclipse.ui.internal.PartListenerList2.firePartVisible(PartListenerList2.java:168)
	at org.eclipse.ui.internal.PartService.firePartVisible(PartService.java:121)
	at org.eclipse.ui.internal.WWinPartService$1.partVisible(WWinPartService.java:60)
	at org.eclipse.ui.internal.PartListenerList2$7.run(PartListenerList2.java:170)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.runtime.Platform.run(Platform.java:857)
	at org.eclipse.ui.internal.PartListenerList2.fireEvent(PartListenerList2.java:53)
	at org.eclipse.ui.internal.PartListenerList2.firePartVisible(PartListenerList2.java:168)
	at org.eclipse.ui.internal.PartService.firePartVisible(PartService.java:121)
	at org.eclipse.ui.internal.WorkbenchPagePartList.firePartVisible(WorkbenchPagePartList.java:67)
	at org.eclipse.ui.internal.PartList.partVisible(PartList.java:269)
	at org.eclipse.ui.internal.PartList.access$2(PartList.java:258)
	at org.eclipse.ui.internal.PartList$1.propertyChanged(PartList.java:44)
	at org.eclipse.ui.internal.WorkbenchPartReference.fireInternalPropertyChange(WorkbenchPartReference.java:374)
	at org.eclipse.ui.internal.WorkbenchPartReference.fireVisibilityChange(WorkbenchPartReference.java:535)
	at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:305)

...


or

java.lang.NullPointerException
at org.eclipse.pde.internal.core.plugin.PluginAttribute.equals(PluginAttribute.java:51)
at org.eclipse.pde.internal.core.plugin.PluginElement.equals(PluginElement.java:83)
at org.eclipse.pde.internal.core.plugin.PluginParent.equals(PluginParent.java:68)
at org.eclipse.pde.internal.core.plugin.PluginExtension.equals(PluginExtension.java:118)
at org.eclipse.pde.internal.ui.search.ManifestEditorOpener.getAttributeMatch(ManifestEditorOpener.java:100)
at org.eclipse.pde.internal.ui.search.ManifestEditorOpener.findExactMatch(ManifestEditorOpener.java:46)
at org.eclipse.pde.internal.ui.search.SearchResult.computeContainedMatches(SearchResult.java:96)
at org.eclipse.search2.internal.ui.text.EditorAnnotationManager.addAnnotations(EditorAnnotationManager.java:221)
at org.eclipse.search2.internal.ui.text.EditorAnnotationManager.addSearchResult(EditorAnnotationManager.java:108)
at org.eclipse.search2.internal.ui.text.EditorAnnotationManager.setSearchResults(EditorAnnotationManager.java:101)
at org.eclipse.search2.internal.ui.text.WindowAnnotationManager.startHighlighting(WindowAnnotationManager.java:82)
at org.eclipse.search2.internal.ui.text.WindowAnnotationManager.access$1(WindowAnnotationManager.java:75)
at org.eclipse.search2.internal.ui.text.WindowAnnotationManager$1.partVisible(WindowAnnotationManager.java:64)
at org.eclipse.ui.internal.PartListenerList2$7.run(PartListenerList2.java:170)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:857)
at org.eclipse.ui.internal.PartListenerList2.fireEvent(PartListenerList2.java:53)
at org.eclipse.ui.internal.PartListenerList2.firePartVisible(PartListenerList2.java:168)
at org.eclipse.ui.internal.PartService.firePartVisible(PartService.java:121)
at org.eclipse.ui.internal.WWinPartService$1.partVisible(WWinPartService.java:60)
at org.eclipse.ui.internal.PartListenerList2$7.run(PartListenerList2.java:170)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:857)
at org.eclipse.ui.internal.PartListenerList2.fireEvent(PartListenerList2.java:53)
at org.eclipse.ui.internal.PartListenerList2.firePartVisible(PartListenerList2.java:168)
at org.eclipse.ui.internal.PartService.firePartVisible(PartService.java:121)
at org.eclipse.ui.internal.WorkbenchPagePartList.firePartVisible(WorkbenchPagePartList.java:67)
at org.eclipse.ui.internal.PartList.partVisible(PartList.java:269)
at org.eclipse.ui.internal.PartList.access$2(PartList.java:258)
at org.eclipse.ui.internal.PartList$1.propertyChanged(PartList.java:44)
at org.eclipse.ui.internal.WorkbenchPartReference.fireInternalPropertyChange(WorkbenchPartReference.java:374)
at org.eclipse.ui.internal.WorkbenchPartReference.fireVisibilityChange(WorkbenchPartReference.java:535)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:305)
at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
Comment 1 Chris Aniszczyk CLA 2008-02-15 11:08:54 EST
Interesting... somehow you got to the point where you were searching extension results for a model that wasn't in PDE's model anymore... I added some saftety checks to ManifestEditorOpener to make sure this doesn't happen.

I wasn't able to reproduce this particular issue so please reopen if this remains an issue in the future.
Comment 2 Chris Aniszczyk CLA 2008-02-15 11:09:09 EST
>20080215
Comment 3 Chris Aniszczyk CLA 2008-02-15 11:09:11 EST
Created attachment 89850 [details]
mylyn/context/zip
Comment 4 Philippe Coucaud CLA 2008-05-21 05:21:32 EDT
Chris,

I still get those exceptions with I20080502-0100 (aka M7). I can reproduce the NPE with the following scenario:

1. create a new plug-in project
2. the manifest editor should open by default, go the extension tab, add an extension for org.eclipse.ui.activities and create a dummy activity. Save.
3. switch to the "plugin.xml" tab, select "org.eclipse.ui.activities", press CTRL-H to open the search dialog, ensure the "Plug-in Search" tab is selected, search for references to this extension point. You should have some matches and at least org.eclipse.equinox.p2.ui.sdk
4. double-click on org.eclipse.equinox.p2.ui.sdk in the search view, a new manifest editor opens.
5. switch to the first manifest editor -> NPE. Then everytime I switch to this editor I get the NPE, however if a clear the search view, the NPE disapears ...
Comment 5 Chris Aniszczyk CLA 2008-05-21 18:41:14 EDT
I tried in I20080516-1333 and I didn't get them :/
Comment 6 Philippe Coucaud CLA 2008-05-22 04:14:31 EDT
Well, I just tried with I20080516-1333 (RC1) and I still get the NPE ...

With the scenario I mentioned (plugin id = "com.foo.bar"), the plugin attributes are compared in PluginElement.equals():

att.fName = "id"
att.fModel = a model (underlying resource = L/com.foo.bar/plugin.xml)
att.fValue = "com.foo.bar.activity1"

tatt.fName = "id"
tatt.fModel = null
tatt.fValue = "com.foo.bar.activity1"

then 'att.equals(tatt) == false' is evaluated and as getModel() returns null an NPE is thrown when executing 'target.getModel().equals(getModel())' ('target' == 'tatt')

Just to clarify the scenario, after step 2) the content of plugin.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
   <extension
         point="org.eclipse.ui.activities">
      <activity
            id="com.foo.bar.activity1"
            name="name">
      </activity>
   </extension>
</plugin>

I can do some more debugging if you tell me where to look.
Comment 7 Chris Aniszczyk CLA 2008-05-22 08:48:56 EDT
reopening to add more safety to at least not get the NPE
Comment 8 Chris Aniszczyk CLA 2008-05-22 08:59:21 EDT
will add the NPE guard
Comment 9 Curtis Windatt CLA 2008-05-22 10:39:54 EDT
Created attachment 101514 [details]
Protects against NPE

Chris is having problems with CVS while travelling.  This is his suggested fix that simply guards against the NPE.
Comment 10 Curtis Windatt CLA 2008-05-22 10:41:18 EDT
Adding reviewers for an RC2 fix.
Comment 11 Chris Aniszczyk CLA 2008-05-22 10:42:11 EDT
+1

Thanks!
Comment 12 Curtis Windatt CLA 2008-05-22 10:43:26 EDT
+1 from me.
Comment 13 Darin Wright CLA 2008-05-22 11:15:12 EDT
+1
Comment 14 Philippe Coucaud CLA 2008-05-22 11:30:42 EDT
Humm, I'm totally unfamiliar with the code and I haven't applied the patch, but the NPE is triggered because 'PluginAttribute.getModel()' returns 'null', so is it correct to test 'PluginElement.getModel()' ? 

Moreover, the problem is not related to 'this.getModel()' but to 'target.getModel()', so I was more expecting a test like 'if (target.getModel() == null) return false' in 'PluginAttribute.equals()' ... 

But once again I'm just looking at the call stack so I may be missing some invariants/properties ...
Comment 15 Chris Aniszczyk CLA 2008-05-22 12:55:45 EDT
(In reply to comment #14)
> Humm, I'm totally unfamiliar with the code and I haven't applied the patch, but
> the NPE is triggered because 'PluginAttribute.getModel()' returns 'null', so is
> it correct to test 'PluginElement.getModel()' ? 

Correct, this is also a possible problem.

The patch will be updated and released once I can commit, currenlty at the e4 summit where SSH is blocked.

Comment 16 Chris Aniszczyk CLA 2008-05-22 22:39:33 EDT
moving to RC3, I investigated this issue today and there's some other pervasive problem that causes this NPE that I need to track down before I put the NPE guard.
Comment 17 Chris Aniszczyk CLA 2008-05-23 00:04:30 EDT
Created attachment 101691 [details]
org.eclipse.pde.core.patch

This NPE was cause by a missing model. The root cause of this is was that we forget to assign our plugin attribute a model when created via the extension editor.
Comment 18 Chris Aniszczyk CLA 2008-05-23 00:05:06 EDT
Please review for our obligatory +1's :)
Comment 19 Philippe Coucaud CLA 2008-05-23 04:28:12 EDT
+1, nothing better than a good root cause analysis :-) 
Comment 20 Curtis Windatt CLA 2008-05-23 08:45:05 EDT
+1 again
Comment 21 Chris Aniszczyk CLA 2008-05-25 15:15:04 EDT
done.

> 20080525
Comment 22 Chris Aniszczyk CLA 2008-05-25 15:15:07 EDT
Created attachment 101900 [details]
mylyn/context/zip
Comment 23 Andrey Loskutov CLA 2008-06-05 17:06:54 EDT
I see it again in RC3 (eclipse.buildId=I20080530-1730), probably exactly the same stack as reported at very beginning...

Use case is to search for extension point references from your project's plugin xml, open some resulting plugin.xml's, close them and switch back to the origin:

org.eclipse.core.runtime.InvalidRegistryObjectException: Invalid registry object
	at org.eclipse.core.internal.registry.RegistryObjectManager.basicGetObject(RegistryObjectManager.java:273)
	at org.eclipse.core.internal.registry.RegistryObjectManager.getObject(RegistryObjectManager.java:263)
	at org.eclipse.core.internal.registry.BaseExtensionHandle.getExtension(BaseExtensionHandle.java:30)
	at org.eclipse.core.internal.registry.BaseExtensionHandle.getUniqueIdentifier(BaseExtensionHandle.java:67)
	at org.eclipse.pde.internal.core.plugin.PluginExtension.getId(PluginExtension.java:186)
	at org.eclipse.pde.internal.core.plugin.PluginExtension.equals(PluginExtension.java:111)
	at org.eclipse.pde.internal.ui.search.ManifestEditorOpener.getAttributeMatch(ManifestEditorOpener.java:134)
	at org.eclipse.pde.internal.ui.search.ManifestEditorOpener.findExactMatch(ManifestEditorOpener.java:51)
	at org.eclipse.pde.internal.ui.search.SearchResult.computeContainedMatches(SearchResult.java:96)
	at org.eclipse.search2.internal.ui.text.EditorAnnotationManager.addAnnotations(EditorAnnotationManager.java:221)
	at org.eclipse.search2.internal.ui.text.EditorAnnotationManager.addSearchResult(EditorAnnotationManager.java:108)
	at org.eclipse.search2.internal.ui.text.EditorAnnotationManager.setSearchResults(EditorAnnotationManager.java:101)
	at org.eclipse.search2.internal.ui.text.WindowAnnotationManager.startHighlighting(WindowAnnotationManager.java:82)
	at org.eclipse.search2.internal.ui.text.WindowAnnotationManager.access$1(WindowAnnotationManager.java:75)
	at org.eclipse.search2.internal.ui.text.WindowAnnotationManager$1.partVisible(WindowAnnotationManager.java:64)
	at org.eclipse.ui.internal.PartListenerList2$7.run(PartListenerList2.java:170)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.runtime.Platform.run(Platform.java:880)
	at org.eclipse.ui.internal.PartListenerList2.fireEvent(PartListenerList2.java:53)
	at org.eclipse.ui.internal.PartListenerList2.firePartVisible(PartListenerList2.java:168)
	at org.eclipse.ui.internal.PartService.firePartVisible(PartService.java:252)
	at org.eclipse.ui.internal.WWinPartService$1.partVisible(WWinPartService.java:60)
	at org.eclipse.ui.internal.PartListenerList2$7.run(PartListenerList2.java:170)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.runtime.Platform.run(Platform.java:880)
	at org.eclipse.ui.internal.PartListenerList2.fireEvent(PartListenerList2.java:53)
	at org.eclipse.ui.internal.PartListenerList2.firePartVisible(PartListenerList2.java:168)
	at org.eclipse.ui.internal.PartService.firePartVisible(PartService.java:252)
	at org.eclipse.ui.internal.WorkbenchPagePartList.firePartVisible(WorkbenchPagePartList.java:67)
	at org.eclipse.ui.internal.PartList.partVisible(PartList.java:269)
	at org.eclipse.ui.internal.PartList.access$2(PartList.java:258)
	at org.eclipse.ui.internal.PartList$1.propertyChanged(PartList.java:44)
	at org.eclipse.ui.internal.WorkbenchPartReference.fireInternalPropertyChange(WorkbenchPartReference.java:374)
	at org.eclipse.ui.internal.WorkbenchPartReference.fireVisibilityChange(WorkbenchPartReference.java:535)
	at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:311)
	at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
Comment 24 Chris Aniszczyk CLA 2008-06-05 17:09:02 EDT
we will have to investigate for 3.4.1 as 3.4 is coming to a close and we're all dying writing documentation :)
Comment 25 Chris Aniszczyk CLA 2008-07-16 12:36:45 EDT
*** Bug 237739 has been marked as a duplicate of this bug. ***
Comment 26 Chris Aniszczyk CLA 2008-07-16 12:37:04 EDT
*** Bug 241004 has been marked as a duplicate of this bug. ***
Comment 27 Darin Wright CLA 2008-08-26 14:46:03 EDT
Moving to 3.5, since there is no fix in hand and investigation was not done in the 3.4.1 time frame.
Comment 28 Will Horn CLA 2008-11-13 14:12:54 EST
I'm not sure what exactly is triggering this in my case, but once it is triggered, it happens every time I open the plug-in editor.  I have not found a way to make it disappear except to restart Eclipse.

It is quite an annoyance and I will try to find a consistent way to reproduce it.

Any hope for 3.4.2?
Comment 29 Chris Aniszczyk CLA 2009-05-09 18:30:47 EDT
moving to RC2 for investigation.

This one has plagued us for awhile but the ability to not reproduce makes it hard to fix.

It's most likely a race condition somewhere if it's still around.
Comment 30 Darin Wright CLA 2009-05-20 11:37:47 EDT
Without a reproduceable case/fix is this really RC2?
Comment 31 Curtis Windatt CLA 2009-05-21 09:57:53 EDT
No plans to work on this for RC2.
Comment 32 Benjamin Cabé CLA 2009-08-28 10:31:24 EDT
*** Bug 287973 has been marked as a duplicate of this bug. ***
Comment 33 Benjamin Cabé CLA 2009-08-28 10:31:53 EDT
We have to try to reproduce using the steps from bug 287973
Comment 34 Curtis Windatt CLA 2012-09-07 12:53:19 EDT
There are many bugs referencing the same InvalidRegistryObjectException with different steps.  They are being merged into Bug 299636.

*** This bug has been marked as a duplicate of bug 299636 ***