This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I deleted several new .java files (they were created from external tool and NB just recognized them when I expanded the package in file explorer) and got a DataObjectNotFoundException. Attaching messages.log. Using NB 5.0 Beta, JDK 5.0_04.
Created attachment 25919 [details] messages.log
How did you delete them? From the IDE or from command line or other external tool? Reassigning to ant/project.
I added the files with an external tool, but deleted them in the IDE by marking them and hitting DEL key. I should mention, that this project is under source control (Subversion profile).
OK, thanks.
Looking at the code, this seems like a rare race-condition (it is caused by calling DataObject.find for an invalid (deleted) FileObject, and the FileObject may become invalid at any time, AFAIK). I do not see any solution except quietly swalow the DataObjectNotFound exception.
*** Issue 70093 has been marked as a duplicate of this issue. ***
*** Issue 71041 has been marked as a duplicate of this issue. ***
It's not so rare (has happened to me too at least once). Consider upgrading to P2.
Reported on nbdev as well. Needs to be evaluated seriously, definitely fixed in the trunk soon, and considered for 5.0.
Well, I would rather not fix this on 5.0 - not sure what can be the side-effects of the patch, and as we cannot reproduce the problem we cannot test it. BTW: on nbdev, there were two DONFE (the first one from org.netbeans.modules.javacore.JMManager.getDataObject). On trunk, I made to code to "quietly" (INFORMATIONAL log) swallow the exception. Lets see if it will have some side-effects: Checking in test/unit/src/org/netbeans/spi/project/support/ant/GlobFileBuiltQueryTest.java; /cvs/ant/project/test/unit/src/org/netbeans/spi/project/support/ant/GlobFileBuiltQueryTest.java,v <-- GlobFileBuiltQueryTest.java new revision: 1.12; previous revision: 1.11 done Checking in src/org/netbeans/spi/project/support/ant/GlobFileBuiltQuery.java; /cvs/ant/project/src/org/netbeans/spi/project/support/ant/GlobFileBuiltQuery.java,v <-- GlobFileBuiltQuery.java new revision: 1.11; previous revision: 1.10 done
Patch looks fine to me. Don't foresee any problems from it, but who can know. The root problem might need to be fixed in JavaNode - seems it asks for status on a file which has been deleted - but on the other hand there would always be a possible race condition since a file can be deleted at any time and there is no global mutex for file operations.
Well, I looked at the JavaNode and I guess it tries not pass invalid FOs into the query (I did some simple experiments, but do not fully understand the implementation of SemiPersistentElement.isValid(), so I am not sure).
Don't know, just trying to guess at the root cause.
According to discussion with Marek and Milan there is probably connection with deleting while scanning project classpath is in progress. So I have reproduced this issue by following steps: 1.Run IDE with clean userdir 2.Open existing project 3.Delete form file while scanning project classpath is in progress 4.The org.openide.loaders.DataObjectNotFoundException exception appears
Reproduced, as Jara described , it happend during scanning of classpath. I tried it in NB 5.1 (200601081900) and it works.
I was wrong with my guess regarding JavaNode&isValid check. The JavaNode asks the FileBuiltQuery on two places, one definitely is not guarded by FO.isValid, one maybe is (I checked only the latter one previously). Sorry. The steps above seem not to be 100% reliable. The following changes make the reproduction much more reliable for me: 2a) open a package where are at least 3 form files (and no other files, for simplicity). Let none of them is compiled. 3) One of the form files will get the uncompiled badge. During classpath scanning, delete the other form files (which do not have the uncompiled badge).
We played with Enterprise Application and got the same exception. (open and during Classpath scan delete two files).
Created attachment 28314 [details] Proposed patch.
Fixed on the release50 branch too: Checking in src/org/netbeans/spi/project/support/ant/GlobFileBuiltQuery.java; /cvs/ant/project/src/org/netbeans/spi/project/support/ant/GlobFileBuiltQuery.java,v <-- GlobFileBuiltQuery.java new revision: 1.10.76.1; previous revision: 1.10 done
verified in NB5.0 RC1 (200601091900)