Bug 466379 - ResourceException in Resource.checkExists (334)
Summary: ResourceException in Resource.checkExists (334)
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.8.2   Edit
Hardware: All All
: P3 normal with 4 votes (vote)
Target Milestone: 4.7.1   Edit
Assignee: Karsten Thoms CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 444551 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-05-05 02:39 EDT by EPP Error Reports CLA
Modified: 2017-08-22 06:36 EDT (History)
16 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description EPP Error Reports CLA 2015-05-05 02:39:49 EDT
The following incident was reported via the automated error reporting:


    code:                   10,001
    plugin:                 org.eclipse.jdt.ui_3.11.0.v20150316-2042
    message:                HIDDEN
    fingerprint:            a54154eb
    exception class:        org.eclipse.core.internal.resources.ResourceException
    exception message:      HIDDEN
    number of children:     1
    
    org.eclipse.core.internal.resources.ResourceException: HIDDEN
    at org.eclipse.core.internal.resources.Resource.checkExists(Resource.java:334)
    at org.eclipse.core.internal.resources.Resource.checkAccessible(Resource.java:208)
    at org.eclipse.core.internal.resources.Resource.findMaxProblemSeverity(Resource.java:1017)
    at org.eclipse.jdt.ui.ProblemsLabelDecorator.getPackageErrorTicksFromMarkers(ProblemsLabelDecorator.java:337)
    at org.eclipse.jdt.ui.ProblemsLabelDecorator.computeAdornmentFlags(ProblemsLabelDecorator.java:212)
    at org.eclipse.jdt.ui.ProblemsLabelDecorator.decorateImage(ProblemsLabelDecorator.java:170)
    at org.eclipse.jdt.internal.ui.viewsupport.JavaUILabelProvider.decorateImage(JavaUILabelProvider.java:134)
    at org.eclipse.jdt.internal.ui.viewsupport.JavaUILabelProvider.getImage(JavaUILabelProvider.java:149)
    at org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.getImage(DelegatingStyledCellLabelProvider.java:195)
    at org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider.getImage(DecoratingStyledCellLabelProvider.java:173)
    at org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.update(DelegatingStyledCellLabelProvider.java:121)
    at org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider.update(DecoratingStyledCellLabelProvider.java:136)
    at org.eclipse.jdt.internal.ui.javaeditor.breadcrumb.BreadcrumbViewer.doUpdateItem(BreadcrumbViewer.java:384)
    at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:473)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:173)
    at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:2176)
    at org.eclipse.jface.viewers.StructuredViewer.internalUpdate(StructuredViewer.java:2159)
    at org.eclipse.jface.viewers.StructuredViewer.update(StructuredViewer.java:2097)
    at org.eclipse.jface.viewers.StructuredViewer.update(StructuredViewer.java:2041)
    at org.eclipse.jface.viewers.StructuredViewer.handleLabelProviderChanged(StructuredViewer.java:1208)
    at org.eclipse.jdt.internal.ui.javaeditor.JavaEditorBreadcrumb$ProblemBreadcrumbViewer.handleLabelProviderChanged(JavaEditorBreadcrumb.java:181)
    at org.eclipse.jface.viewers.ContentViewer$1.labelProviderChanged(ContentViewer.java:99)
    at org.eclipse.jface.viewers.BaseLabelProvider$1.run(BaseLabelProvider.java:72)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:173)
    at org.eclipse.jface.viewers.BaseLabelProvider.fireLabelProviderChanged(BaseLabelProvider.java:69)
    at org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider$1.labelProviderChanged(DecoratingStyledCellLabelProvider.java:78)
    at org.eclipse.ui.internal.decorators.DecoratorManager$1.run(DecoratorManager.java:446)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.decorators.DecoratorManager.fireListener(DecoratorManager.java:443)
    at org.eclipse.ui.internal.decorators.DecorationScheduler$3.runInUIThread(DecorationScheduler.java:536)
    at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:97)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4147)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3764)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1112)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:993)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:654)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:598)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
   

---   

      code:                   368
      plugin:                 org.eclipse.core.resources_3.9.100.v20150313-1707
      message:                HIDDEN
      fingerprint:            00000000
      number of children:     0
    
    
   
  

General Information:

    reported-by:      Ben
    anonymous-id:     54d24c62-b98a-423d-9bb3-47b621c7b59d
    eclipse-build-id: 4.5.0.I20150320-0800
    eclipse-product:  org.eclipse.epp.package.dsl.product
    operating system: Windows7 6.1.0 (x86_64) - win32
    jre-version:      1.8.0_40-b25

The following plug-ins were present on the execution stack (*):
    1. org.eclipse.core.databinding.observable_1.4.1.v20150311-0218
    2. org.eclipse.core.databinding_1.4.100.v20150311-0216
    3. org.eclipse.core.resources_3.9.100.v20150313-1707
    4. org.eclipse.core.runtime_3.11.0.v20150316-1241
    5. org.eclipse.e4.ui.workbench_1.3.0.v20150316-1403
    6. org.eclipse.e4.ui.workbench.swt_0.12.100.v20150316-1403
    7. org.eclipse.equinox.app_1.3.200.v20130910-1609
    8. org.eclipse.equinox.launcher_1.3.0.v20140415-2008
    9. org.eclipse.jdt.ui_3.11.0.v20150316-2042
    10. org.eclipse.jdt_3.11.0.v20150320-0800
    11. org.eclipse.jface_3.11.0.v20150313-1544
    12. org.eclipse.swt_3.104.0.v20150319-1901
    13. org.eclipse.ui_3.107.0.v20150315-0703
    14. org.eclipse.ui.ide.application_1.0.600.v20150315-1254
    15. org.eclipse.ui.ide_3.11.0.v20150309-2044

Please note that:
* Messages, stacktraces, and nested status objects may be shortened.
* Bug fields like status, resolution, and whiteboard are sent
  back to reporters.
* The list of present bundles and their respective versions was
  calculated by package naming heuristics. This may or may not reflect reality.

Other Resources:
* Report: https://dev.eclipse.org/recommenders/committers/confess/#/problems/5524013ee4b026254ee01c8e  
* Manual: https://dev.eclipse.org/recommenders/community/confess/#/guide


Thank you for your assistance.
Your friendly error-reports-inbox.
Comment 1 Alexander Heavens CLA 2016-08-14 10:38:26 EDT
Background:

1. Created new Java class in my Eclipse project, added some text to it, saved.1.
2. Used "git stash" from bash command line to stash this new class away for a while.
3. Back to Eclipse, "yes" when prompted to close the now non-existent new class.
4. Warning pop-up prompts me to send this error report.
Comment 2 Heiko Selber CLA 2017-02-06 11:18:11 EST
This error occurs whenever I delete a file on disk, which is currently open in Eclipse.

The editor is simply closed and the file content is lost. There is no way to recover the contents of the file.

I would expect a popup message asking whether to keep or discard the content of the file, but I assume that the exception prevents this popup.

The error is NOT only related to Java, it affects also C++ files, properties files or shell scripts etc.

Version: Neon.2 Release (4.6.2)
Build id: 20161208-0600
Comment 3 Dani Megert CLA 2017-04-13 10:30:56 EDT
(In reply to Heiko Selber from comment #2)
> This error occurs whenever I delete a file on disk, which is currently open
> in Eclipse.
> 
> The editor is simply closed and the file content is lost. There is no way to
> recover the contents of the file.

Sure. You deleted it. If you want to avoid this, you can disable the "Refresh *" option on the General > Workspace preference page. 


> I would expect a popup message asking whether to keep or discard the content
> of the file, but I assume that the exception prevents this popup.

This does happen if the editor is dirty.
Comment 4 Dani Megert CLA 2017-04-13 10:31:43 EDT
I can't reproduce using I20170412-2000.
Comment 5 Heiko Selber CLA 2017-04-18 04:14:03 EDT
(In reply to Dani Megert from comment #3)
> (In reply to Heiko Selber from comment #2)
> > This error occurs whenever I delete a file on disk, which is currently open
> > in Eclipse.

The exception doesn't occur with Neon.3, but the behavior is still the same.

> > 
> > The editor is simply closed and the file content is lost. There is no way to
> > recover the contents of the file.
> 
> Sure. You deleted it. If you want to avoid this, you can disable the
> "Refresh *" option on the General > Workspace preference page. 

I can't accept this. AN EDITOR WINDOW SHOULD NEVER SIMPLY VANISH if the underlying file is deleted. (In this case, because a coworker's shell script went berserk.)

BTW: When I disable the "Refresh on access" option (I guess this is what you meant) Eclipse behaves a bit strange:

It asks me whether I want to save the file, but when I confirm, it tells me that the file is already there (which it isn't). Very confusing. Or confused.

> > I would expect a popup message asking whether to keep or discard the content
> > of the file, but I assume that the exception prevents this popup.
> 
> This does happen if the editor is dirty.

So when I save my changes in order to make them permanent, they are less permanent than if I don't. That's counter-intuitive.
Comment 6 Bjoern Martin CLA 2017-04-18 04:37:37 EDT
I agree with the last commenter. Eclipse should thrive to become a better IDE. And this includes usability improvements. "Works for me" is not good enough when there are comprehensible objections to the IDE's current behavior. It should stay open.
Comment 7 Joerg Schoenfisch CLA 2017-04-27 07:59:05 EDT
The exception happened for me after refactoring a package name. I'm on version Neon.3 Release (4.6.3), Build id: 20170314-1500

It's not easily reproducible. It seems the best way to do it is either having multiple editors with members of that package open and/or having one that is not saved and gets automatically saved during the refactoring.
Comment 8 Nathan Ridge CLA 2017-05-06 23:45:02 EDT
I'm seeing this with Neon.3 as well.
Comment 9 Dani Megert CLA 2017-05-07 12:19:11 EDT
(In reply to Nathan Ridge from comment #8)
> I'm seeing this with Neon.3 as well.

Can you provide steps?
Comment 10 Nathan Ridge CLA 2017-05-07 17:45:11 EDT
(In reply to Dani Megert from comment #9)
> (In reply to Nathan Ridge from comment #8)
> > I'm seeing this with Neon.3 as well.
> 
> Can you provide steps?

In my case, it happened while using "git" on the command line to check out a different revision of my project that didn't have a particular file. The file was open in Eclipse when I ran the command, and when I switched back to Eclipse I got the exception.
Comment 11 Andrey Loskutov CLA 2017-05-09 06:53:48 EDT
(In reply to Nathan Ridge from comment #10)
> (In reply to Dani Megert from comment #9)
> > (In reply to Nathan Ridge from comment #8)
> > > I'm seeing this with Neon.3 as well.
> > 
> > Can you provide steps?
> 
> In my case, it happened while using "git" on the command line to check out a
> different revision of my project that didn't have a particular file. The
> file was open in Eclipse when I ran the command, and when I switched back to
> Eclipse I got the exception.

Reading through different comments here I have no clue if they are all talking about same problem, and also I have no clue which problem we are discussing here.

I would recommend to open a new bug with appropriate title, steps to reproduce and error log attached.
Comment 12 Christoph S CLA 2017-05-31 10:56:25 EDT
I can reproduce this in neon.3 with git, too.
I have some files open which only exist in a branch.
Then I use git bash to change to other branch where the files do not yet exist and I get the error
Comment 13 Dani Megert CLA 2017-05-31 11:40:38 EDT
(In reply to Christoph S from comment #12)
> I can reproduce this in neon.3 with git, too.
> I have some files open which only exist in a branch.
> Then I use git bash to change to other branch where the files do not yet
> exist and I get the error

If you can provide steps based on http://download.eclipse.org/eclipse/downloads/drops4/I20170531-0800/ or newer, then please reopen this bug.
Comment 14 Joerg Schoenfisch CLA 2017-06-07 11:33:21 EDT
I could reproduce this in this version:
Version: Oxygen Release Candidate 2 (4.7.0 RC2)
Build id: 20170601-1219

Seems to be related to version control. Those are the steps to reproduce:
1) Create a new project
2) Create some package
3) Create some class in that package
4) Share the project to Mercurial and commit all files
5) Try to delete the package
   => ResourceException
Additionally, the "src" folder is also gone if there is nothing else in there.

I could only reproduce it when sharing the project in a Mercurial repository (just locally, no remote involved). Sharing with Git did not produce the exception.
The MercurialEclipse version is 2.3.0.201704011407, which should be the latest stable.
Comment 15 Joerg Schoenfisch CLA 2017-06-07 11:50:30 EDT
There is an issue in the MercurialEclipse bug tracker that seems to document exactly this behaviour: https://bitbucket.org/mercurialeclipse/main/issues/436/deleting-java-package-causes-exception
Comment 16 Dennis Hendriks CLA 2017-06-08 02:46:47 EDT
In the comments I see a lot of 'Git' mentions. Now the issue is closed as NOT_ECLIPSE, due to another Mercurial issue that exists? Seems this issue also affects Git? So perhaps it is not Git or Mercurial specific but more general?
Comment 17 Dani Megert CLA 2017-06-08 04:10:57 EDT
(In reply to Dennis Hendriks from comment #16)
> In the comments I see a lot of 'Git' mentions. Now the issue is closed as
> NOT_ECLIPSE, due to another Mercurial issue that exists? Seems this issue
> also affects Git?

Sorry, you're of course right.

So far I could not reproduce with EGit. If we get reproducible steps using 
http://download.eclipse.org/eclipse/downloads/drops4/S-4.7RC3-201705312000/ plus latest EGit, we can reopen the bug and investigate.
Comment 18 Joerg Schoenfisch CLA 2017-06-08 04:48:35 EDT
I gave it some more try with git and was able to partially produce the exception there
1) Create some project, commit it
2) Create branch "test", add a file and commit it
3) Edit the file only in "test" but do not save it; keep the editor dirty
4) Switch to master branch
5) Exception is reported via error reporting and the error log, but I do not get a dialog (conversely to hg)
6) When clicking the editor, I'm asked whether I want to save or close the editor

So in the case of git, the exception seems to be handled gracefully (Close/Save?), but still gets logged and reported in the background.
I'm not 100% sure if git is really involve here, as the beaviour looks similar when I just delete the dirty file from command line.
Comment 19 Dani Megert CLA 2017-06-08 06:09:34 EDT
(In reply to Joerg Schoenfisch from comment #18)
> I'm not 100% sure if git is really involve here, as the beaviour looks
> similar when I just delete the dirty file from command line.

Do you get errors logged when doing that?
Comment 20 Dennis Hendriks CLA 2017-06-08 06:17:12 EDT
(In reply to Joerg Schoenfisch from comment #18)
> 5) Exception is reported via error reporting and the error log, but I do not
> get a dialog (conversely to hg)

That means it crashed, and it shouldn't crash IMHO.
Comment 21 Joerg Schoenfisch CLA 2017-06-08 08:54:21 EDT
(In reply to Dani Megert from comment #19)
> (In reply to Joerg Schoenfisch from comment #18)
> > I'm not 100% sure if git is really involve here, as the beaviour looks
> > similar when I just delete the dirty file from command line.
> 
> Do you get errors logged when doing that?

Yes, also logs to the error log and triggers automated error reporting. Close/Save? dialog pops up, no error dialog.
Comment 22 Dani Megert CLA 2017-06-09 10:01:00 EDT
(In reply to Joerg Schoenfisch from comment #21)
> (In reply to Dani Megert from comment #19)
> > (In reply to Joerg Schoenfisch from comment #18)
> > > I'm not 100% sure if git is really involve here, as the beaviour looks
> > > similar when I just delete the dirty file from command line.
> > 
> > Do you get errors logged when doing that?
> 
> Yes, also logs to the error log and triggers automated error reporting.
> Close/Save? dialog pops up, no error dialog.

Thanks! I can reproduce this. It's a regression compared to 4.6.

Steps:
1. Download http://download.eclipse.org/eclipse/downloads/drops4/I20170608-0530/download.php?dropFile=eclipse-SDK-I20170608-0530-win32-x86_64.zip
2. Start with new workspace
3. Paste "class A {}" into the 'Package Explorer'
4. Make the file dirty
5. Delete 'A.java' on the command line
6. Switch back to Eclipse
==> exception logged
Comment 23 Eclipse Genie CLA 2017-07-06 22:18:19 EDT
New Gerrit change created: https://git.eclipse.org/r/100885
Comment 24 Eclipse Genie CLA 2017-07-11 00:47:46 EDT
New Gerrit change created: https://git.eclipse.org/r/101023
Comment 25 Dani Megert CLA 2017-07-13 10:31:43 EDT
(In reply to Eclipse Genie from comment #23)
> New Gerrit change created: https://git.eclipse.org/r/100885

Thanks for the proposed patch. Can you please explain what caused the regression? Maybe there's a deeper problem and I want to avoid just fixing client code.
Comment 26 Karsten Thoms CLA 2017-07-17 06:53:08 EDT
I have abandoned https://git.eclipse.org/r/100885 and it was replaced by https://git.eclipse.org/r/101023.

The steps to reproduce was like you described.

The client code was only fixed due to feedback on #100885, where I tried to propose a change to Resource which was not comapatible with the methods' contract. Since the method findMaxProblemSeverity can throw a CoreException on intermediate resource deletion according the contract documented in IResource#findMaxProblemSeverity the problem *has* to be fixed in client code.
Comment 27 Dani Megert CLA 2017-07-17 09:52:19 EDT
(In reply to Karsten Thoms from comment #26)
> I have abandoned https://git.eclipse.org/r/100885 and it was replaced by
> https://git.eclipse.org/r/101023.
> 
> The steps to reproduce was like you described.
> 
> The client code was only fixed due to feedback on #100885, where I tried to
> propose a change to Resource which was not comapatible with the methods'
> contract. Since the method findMaxProblemSeverity can throw a CoreException
> on intermediate resource deletion according the contract documented in
> IResource#findMaxProblemSeverity the problem *has* to be fixed in client
> code.

This does not answer my question: What caused the regression?
Comment 28 Andrey Loskutov CLA 2017-08-02 03:53:55 EDT
(In reply to Dani Megert from comment #27)
> (In reply to Karsten Thoms from comment #26)
> > The client code was only fixed due to feedback on #100885, where I tried to
> > propose a change to Resource which was not comapatible with the methods'
> > contract. Since the method findMaxProblemSeverity can throw a CoreException
> > on intermediate resource deletion according the contract documented in
> > IResource#findMaxProblemSeverity the problem *has* to be fixed in client
> > code.
> 
> This does not answer my question: What caused the regression?

We see same issue time to time on 3.8.2 in our automated tests, it was "always" the case. Here the stack from 3.8.2:

org.eclipse.core.internal.resources.Resource.checkExists(Resource.java:341)
 at org.eclipse.core.internal.resources.Resource.checkAccessible(Resource.java:215)
 at org.eclipse.core.internal.resources.Project.checkAccessible(Project.java:147)
 at org.eclipse.core.internal.resources.Resource.findMaxProblemSeverity(Resource.java:1051)
 at org.eclipse.jdt.ui.ProblemsLabelDecorator.getErrorTicksFromMarkers(ProblemsLabelDecorator.java:294)
 at org.eclipse.jdt.ui.ProblemsLabelDecorator.computeAdornmentFlags(ProblemsLabelDecorator.java:195)
 at org.eclipse.jdt.internal.ui.viewsupport.TreeHierarchyLayoutProblemsDecorator.computeAdornmentFlags(TreeHierarchyLayoutProblemsDecorator.java:70)
 at org.eclipse.jdt.internal.ui.packageview.PackageExplorerProblemsDecorator.computeAdornmentFlags(PackageExplorerProblemsDecorator.java:35)
 at org.eclipse.jdt.ui.ProblemsLabelDecorator.decorateImage(ProblemsLabelDecorator.java:170)
Comment 29 Noopur Gupta CLA 2017-08-02 04:50:30 EDT
(In reply to Andrey Loskutov from comment #28)
> (In reply to Dani Megert from comment #27)
> > This does not answer my question: What caused the regression?
> 
> We see same issue time to time on 3.8.2 in our automated tests, it was
> "always" the case. 

Thanks, Andrey. We'll have a look at https://git.eclipse.org/r/#/c/101023 for 4.8 M2.
Comment 32 Dani Megert CLA 2017-08-22 06:36:40 EDT
*** Bug 444551 has been marked as a duplicate of this bug. ***