eclipse-platform / eclipse.platform.resources

Eclipse Public License 2.0
3 stars 18 forks source link

fix Exception handling to show broken workspace file location #118

Closed jukzi closed 2 years ago

jukzi commented 2 years ago

When during loading of the workspace an "Unknown format" Exception happens the error message did not include any information which file was broken. The Exception is passed as ResourceException which is not an IOException. Now we add the file location for any Exception that happens while loading.

jukzi commented 2 years ago

the affected file was for example .metadata.plugins\org.eclipse.core.resources.root\31.tree

jukzi commented 2 years ago

Exception with patch:

Caused by: org.eclipse.core.internal.resources.ResourceException: Could not read metadata for 'C:\wamas\workspace\w5_14_targetsmall\.metadata\.plugins\org.eclipse.core.resources\.root\31.tree'.
    at org.eclipse.core.internal.resources.SaveManager.restoreTree(SaveManager.java:1044)
    at org.eclipse.core.internal.resources.SaveManager.restore(SaveManager.java:711)
    at org.eclipse.core.internal.resources.SaveManager.startup(SaveManager.java:1584)
    at org.eclipse.core.internal.resources.Workspace.startup(Workspace.java:2541)
    at org.eclipse.core.internal.resources.Workspace.open(Workspace.java:2246)
    at org.eclipse.core.resources.ResourcesPlugin.start(ResourcesPlugin.java:477)
    at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:813)
    at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:1)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:805)
    ... 29 more
Caused by: org.eclipse.core.internal.resources.ResourceException: Problems reading project tree.
    at org.eclipse.core.internal.resources.WorkspaceTreeReader_2.readTree(WorkspaceTreeReader_2.java:132)
    at org.eclipse.core.internal.resources.SaveManager.restoreTree(SaveManager.java:1041)
    ... 38 more
Caused by: java.io.IOException: Unknown format.
    at org.eclipse.core.internal.watson.ElementTreeReader.getReader(ElementTreeReader.java:81)
    at org.eclipse.core.internal.watson.ElementTreeReader.readTree(ElementTreeReader.java:155)
    at org.eclipse.core.internal.watson.ElementTreeReaderImpl_1.readDeltaChain(ElementTreeReaderImpl_1.java:85)
    at org.eclipse.core.internal.watson.ElementTreeReader.readDeltaChain(ElementTreeReader.java:115)
    at org.eclipse.core.internal.resources.WorkspaceTreeReader_1.readTrees(WorkspaceTreeReader_1.java:239)
    at org.eclipse.core.internal.resources.WorkspaceTreeReader_2.readTree(WorkspaceTreeReader_2.java:111)
    ... 39 more
eclipse-releng-bot commented 2 years ago

The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-118/1/

mickaelistria commented 2 years ago

Please push your topic branches to your own fork instead of creating a branch in upstream repo.