Community
Participate
Working Groups
It looks wrong to me that org.eclipse.core.runtime.PlatformObject's getAdapter(Class<T>) leaks org.eclipse.core.runtime.InvalidRegistryObjectException to the callers, I would expect it to return null as javadoc says. I do not have steps to reproduce, just a single Eclipse installation that on every restart fails to restore the editor that was active before shutdown: eclipse.buildId=4.10.0.I20181010-1800 java.version=1.8.0_181 java.vendor=Oracle Corporation BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US Framework arguments: -product org.eclipse.epp.package.committers.product Command-line arguments: -data file://eclipse-workspace/ -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.committers.product org.eclipse.ui Error Wed Nov 07 14:39:09 EET 2018 Unable to initialize part org.eclipse.core.runtime.InvalidRegistryObjectException: Invalid registry object at org.eclipse.core.internal.registry.RegistryObjectManager.basicGetObject(RegistryObjectManager.java:277) at org.eclipse.core.internal.registry.RegistryObjectManager.getObject(RegistryObjectManager.java:267) at org.eclipse.core.internal.registry.ConfigurationElementHandle.getConfigurationElement(ConfigurationElementHandle.java:29) at org.eclipse.core.internal.registry.ConfigurationElementHandle.getChildren(ConfigurationElementHandle.java:53) at org.eclipse.core.internal.adapter.AdapterFactoryProxy.getAdapterNames(AdapterFactoryProxy.java:97) at org.eclipse.core.internal.runtime.AdapterManager.addFactoriesFor(AdapterManager.java:109) at org.eclipse.core.internal.runtime.AdapterManager.getFactories(AdapterManager.java:212) at org.eclipse.core.internal.runtime.AdapterManager.getAdapter(AdapterManager.java:295) at org.eclipse.core.runtime.PlatformObject.getAdapter(PlatformObject.java:71) at org.eclipse.ui.part.FileEditorInput.getAdapter(FileEditorInput.java:242) at org.eclipse.ui.texteditor.DocumentProviderRegistry.getDocumentProvider(DocumentProviderRegistry.java:314) at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.setDocumentProvider(AbstractDecoratedTextEditor.java:1440) at org.eclipse.ui.texteditor.AbstractTextEditor.updateDocumentProvider(AbstractTextEditor.java:4104) at org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput(AbstractTextEditor.java:4159) at org.eclipse.ui.texteditor.StatusTextEditor.doSetInput(StatusTextEditor.java:260) at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.doSetInput(AbstractDecoratedTextEditor.java:1476) Another error log entry: eclipse.buildId=4.10.0.I20181010-1800 java.version=1.8.0_181 java.vendor=Oracle Corporation BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US Framework arguments: -product org.eclipse.epp.package.committers.product Command-line arguments: -data file://eclipse-workspace/ -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.committers.product org.eclipse.ui.workbench Error Wed Nov 07 14:39:09 EET 2018 Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench". org.eclipse.core.runtime.InvalidRegistryObjectException: Invalid registry object at org.eclipse.core.internal.registry.RegistryObjectManager.basicGetObject(RegistryObjectManager.java:277) at org.eclipse.core.internal.registry.RegistryObjectManager.getObject(RegistryObjectManager.java:267) at org.eclipse.core.internal.registry.ConfigurationElementHandle.getConfigurationElement(ConfigurationElementHandle.java:29) at org.eclipse.core.internal.registry.ConfigurationElementHandle.getChildren(ConfigurationElementHandle.java:53) at org.eclipse.core.internal.adapter.AdapterFactoryProxy.getAdapterNames(AdapterFactoryProxy.java:97) at org.eclipse.core.internal.runtime.AdapterManager.addFactoriesFor(AdapterManager.java:109) at org.eclipse.core.internal.runtime.AdapterManager.getFactories(AdapterManager.java:212) at org.eclipse.core.internal.runtime.AdapterManager.getAdapter(AdapterManager.java:295) at org.eclipse.core.runtime.PlatformObject.getAdapter(PlatformObject.java:71) at org.eclipse.ui.part.FileEditorInput.getAdapter(FileEditorInput.java:242) at org.eclipse.core.runtime.Adapters.adapt(Adapters.java:62) at org.eclipse.core.runtime.Adapters.adapt(Adapters.java:110) at org.eclipse.ui.internal.ide.actions.ProjectPropertyDialogAction.getProject(ProjectPropertyDialogAction.java:116) at org.eclipse.ui.internal.ide.actions.ProjectPropertyDialogAction.partActivated(ProjectPropertyDialogAction.java:98)
I'm not sure what could have happened, but it appears the registry cache may be invalid or corrupted. Try starting with -clean.
(In reply to Thomas Watson from comment #1) > I'm not sure what could have happened Actually, I'm not looking for the fix in the registry cache. Is it reasonable to suggest that PlatformObject should catch InvalidRegistryObjectException and just return null, as client might expect according to Javadoc?
(In reply to Mykola Nikishov from comment #2) > (In reply to Thomas Watson from comment #1) > > I'm not sure what could have happened > Actually, I'm not looking for the fix in the registry cache. Is it > reasonable to suggest that PlatformObject should catch > InvalidRegistryObjectException and just return null, as client might expect > according to Javadoc? Yes, this is what I would expect as a client. I would say org.eclipse.core.internal.runtime.AdapterManager.getAdapter(Object, Class<T>) should try/catch/log InvalidRegistryObjectException and return null in that case. I can't imagine every client has to guard the code around this getAdapter() call against invalid registry state.
And here is one more that affects ProblemTreeViewer: eclipse.buildId=4.10.0.I20181031-1800 java.version=1.8.0_191 java.vendor=Oracle Corporation BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US Framework arguments: -product org.eclipse.epp.package.committers.product Command-line arguments: -data file:/eclipse-workspace/ -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.committers.product This is a continuation of log file /eclipse-workspace/.metadata/.bak_0.log Created Time: 2018-12-10 17:43:35.466 org.eclipse.ui Error Mon Dec 10 18:40:19 EET 2018 Unhandled event loop exception org.eclipse.core.runtime.InvalidRegistryObjectException: Invalid registry object at org.eclipse.core.internal.registry.RegistryObjectManager.basicGetObject(RegistryObjectManager.java:277) at org.eclipse.core.internal.registry.RegistryObjectManager.getObject(RegistryObjectManager.java:267) at org.eclipse.core.internal.registry.ConfigurationElementHandle.getConfigurationElement(ConfigurationElementHandle.java:29) at org.eclipse.core.internal.registry.ConfigurationElementHandle.getChildren(ConfigurationElementHandle.java:53) at org.eclipse.core.internal.adapter.AdapterFactoryProxy.getAdapterNames(AdapterFactoryProxy.java:97) at org.eclipse.core.internal.runtime.AdapterManager.addFactoriesFor(AdapterManager.java:109) at org.eclipse.core.internal.runtime.AdapterManager.getFactories(AdapterManager.java:212) at org.eclipse.core.internal.runtime.AdapterManager.getAdapter(AdapterManager.java:295) at org.eclipse.buildship.ui.internal.navigator.BuildFolderViewerFilter.select(BuildFolderViewerFilter.java:34) at org.eclipse.jdt.internal.ui.viewsupport.ProblemTreeViewer.isFiltered(ProblemTreeViewer.java:301) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$PackageExplorerProblemTreeViewer.isFiltered(PackageExplorerPart.java:291) at org.eclipse.jdt.internal.ui.viewsupport.ProblemTreeViewer.containsNonFiltered(ProblemTreeViewer.java:282) at org.eclipse.jdt.internal.ui.viewsupport.ProblemTreeViewer.hasFilteredChildren(ProblemTreeViewer.java:249) at org.eclipse.jdt.internal.ui.viewsupport.ProblemTreeViewer.isExpandable(ProblemTreeViewer.java:237)
I have a situation that creates these errors. Many bundles may declare adapter factory via plugin.xml. If one of those bundles is refreshed before it is started, the adapter registry contains an invalid reference. Any use will result in the registry exceptions. It is often the case that these invalid adapter factories are not even the ones used to adapt an object. But they fail fast just trying to determine what types that accept and produce. I agree that AdapterFactoryProxy.getAdapterNames should be catching InvalidRegistryObjectException, logging it and continuing the search.
#548510 has proposed change.
(In reply to Eric Milles from comment #5) > I have a situation that creates these errors. Many bundles may declare > adapter factory via plugin.xml. If one of those bundles is refreshed before > it is started, the adapter registry contains an invalid reference What du you mean by "bundle is refreshed"?
(In reply to Eric Milles from comment #6) > #548510 has proposed change. Marking this one as dup of Bug 548510 *** This bug has been marked as a duplicate of bug 548510 ***