Bug 542086 - Don't leak InvalidRegistryObjectException from FileEditorInput's getAdapter(Class<T>)
Summary: Don't leak InvalidRegistryObjectException from FileEditorInput's getAdapter(C...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.10   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 540888
Blocks:
  Show dependency tree
 
Reported: 2018-12-04 07:54 EST by Mykola Nikishov CLA
Modified: 2018-12-05 14:32 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mykola Nikishov CLA 2018-12-04 07:54:06 EST
I do not have steps to reproduce, it is a single Eclipse installation
that on every restart fails to restore the editor that was active
before shutdown. In this specific case, the problem is reproducible with these steps:
- open Java editor A
- open Java editor B
- Java editor B is active
- restart
- Java editor B is broken with Invalid registry object
- switch to editor A
- Java editor A is OK

All other editors but the last one are completely functional.

    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)

The cause of this is bug 540888 - PlatformObject's getAdapter(Class<T>) leaks
InvalidRegistryObjectException, which is an PlatformObject's
implementation detail that client should not care about.

FileEditorInput's getAdapter(Class<T>) shold catch InvalidRegistryObjectException and return null instead.
Comment 1 Eclipse Genie CLA 2018-12-04 07:57:34 EST
New Gerrit change created: https://git.eclipse.org/r/133453
Comment 2 Andrey Loskutov CLA 2018-12-05 14:32:42 EST
(In reply to Mykola Nikishov from comment #0)
> The cause of this is bug 540888 - PlatformObject's getAdapter(Class<T>) leaks
> InvalidRegistryObjectException, which is an PlatformObject's
> implementation detail that client should not care about.

Exact, and therefore no client has to deal with that exception in PlatformObject.getAdapter() code. I would argue that this is the super class responsibility to catch and log the broken registry state, and return null instead.

> FileEditorInput's getAdapter(Class<T>) shold catch
> InvalidRegistryObjectException and return null instead.

No, see above.