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.

Bug 66713 - DataObjectNotFoundException after deleting .java files
Summary: DataObjectNotFoundException after deleting .java files
Status: VERIFIED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Ant Project (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jan Lahoda
URL:
Keywords: RANDOM
: 70093 71041 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-10-13 14:01 UTC by tboerkel
Modified: 2006-01-10 08:12 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
messages.log (101.98 KB, text/plain)
2005-10-13 14:03 UTC, tboerkel
Details
Proposed patch. (3.17 KB, patch)
2006-01-09 13:01 UTC, Jan Lahoda
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description tboerkel 2005-10-13 14:01:54 UTC
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.
Comment 1 tboerkel 2005-10-13 14:03:05 UTC
Created attachment 25919 [details]
messages.log
Comment 2 Tomas Zezula 2005-10-13 15:07:44 UTC
How did you delete them? From the IDE or from command line or other external tool?
Reassigning to ant/project.
Comment 3 tboerkel 2005-10-13 15:20:59 UTC
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).
Comment 4 Tomas Zezula 2005-10-14 08:49:39 UTC
OK, thanks.
Comment 5 Jan Lahoda 2005-12-09 10:17:52 UTC
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.
Comment 6 Jan Lahoda 2005-12-12 18:26:27 UTC
*** Issue 70093 has been marked as a duplicate of this issue. ***
Comment 7 Jesse Glick 2006-01-05 17:17:01 UTC
*** Issue 71041 has been marked as a duplicate of this issue. ***
Comment 8 Jesse Glick 2006-01-05 17:18:34 UTC
It's not so rare (has happened to me too at least once). Consider upgrading to P2.
Comment 9 Jesse Glick 2006-01-07 21:36:56 UTC
Reported on nbdev as well. Needs to be evaluated seriously, definitely fixed in
the trunk soon, and considered for 5.0.
Comment 10 Jan Lahoda 2006-01-08 12:34:48 UTC
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
Comment 11 Jesse Glick 2006-01-08 18:46:11 UTC
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.
Comment 12 Jan Lahoda 2006-01-08 19:11:53 UTC
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).
Comment 13 Jesse Glick 2006-01-08 19:42:30 UTC
Don't know, just trying to guess at the root cause.
Comment 14 Jaromir Uhrik 2006-01-09 10:47:40 UTC
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
Comment 15 Marian Mirilovic 2006-01-09 10:56:08 UTC
Reproduced, as Jara described , it happend during scanning of classpath.

I tried it in NB 5.1 (200601081900) and it works.
Comment 16 Jan Lahoda 2006-01-09 12:36:36 UTC
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).
Comment 17 Marian Mirilovic 2006-01-09 12:51:57 UTC
We played with Enterprise Application and got the same exception.
(open and during Classpath scan delete two files).
Comment 18 Jan Lahoda 2006-01-09 13:01:27 UTC
Created attachment 28314 [details]
Proposed patch.
Comment 19 Jan Lahoda 2006-01-09 15:05:17 UTC
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
Comment 20 Marian Mirilovic 2006-01-10 08:12:35 UTC
verified in NB5.0 RC1 (200601091900)