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 130998 - Duplicate FileObject for the same path
Summary: Duplicate FileObject for the same path
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jiri Skrivanek
URL: http://statistics.netbeans.org/except...
Keywords: RANDOM
: 153061 153471 159828 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-03-25 11:55 UTC by cezariusz
Modified: 2009-10-08 14:59 UTC (History)
8 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 25010


Attachments
log file (343.30 KB, text/plain)
2009-01-20 16:13 UTC, _ tboudreau
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cezariusz 2008-03-25 11:55:06 UTC
Build: NetBeans IDE Dev (Build 200801280931)
VM: Java HotSpot(TM) Client VM, 10.0-b19
OS: Windows 2003, 5.2, x86
User comments: 
STACKTRACE: (first 10 lines)
java.lang.IllegalArgumentException: C:\Data\Data\galileoim\src\java\messages.properties not in 
C:\Data\Data\galileoim\src\java
        at org.netbeans.api.java.classpath.ClassPath$Entry.includes(ClassPath.java:697)
        at org.netbeans.modules.java.source.parsing.SourceFileManager.list(SourceFileManager.java:91)
        at org.netbeans.modules.java.source.parsing.SourceFileManager.list(SourceFileManager.java:64)
        at org.netbeans.modules.java.source.parsing.ProxyFileManager.list(ProxyFileManager.java:141)
        at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:2179)
        at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:1817)
        at com.sun.tools.javac.code.Symbol.complete(Symbol.java:402)
        at com.sun.tools.javac.code.Symbol$PackageSymbol.members(Symbol.java:629)
        at com.sun.tools.javac.comp.Resolve.findType(Resolve.java:975)
        at com.sun.tools.javac.comp.Resolve.findIdent(Resolve.java:1004)


My case:

Product Version: NetBeans IDE 6.1 Beta (Build 200803050202)
Java: 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b05
System: Windows XP version 5.1 running on x86; Cp1250; pl_PL (nb)
Userdir: C:\Documents and Settings\cezariusz.marek\.netbeans\6.1beta
Comment 1 Tomas Zezula 2008-03-25 15:41:58 UTC
Fixed in: 3a48f7ae0243
Comment 2 Exceptions Reporter 2008-11-07 08:37:10 UTC
Reopening - reproduced in NetBeans IDE 6.1 (Build 200805300101)
http://statistics.netbeans.org/exceptions/detail.do?id=137116
Comment 3 Tomas Zezula 2008-11-07 08:49:41 UTC
Probably file systems problem, the FileUtil.getRelativePath(r, file) returned null and both r and file are valid.
Comment 4 Jiri Skrivanek 2008-11-12 09:53:12 UTC
This should never happen. I am not even able to simulate it artificially. Please, if you have a reproducible test case,
share it here.
Comment 5 Jan Lahoda 2008-11-17 15:15:59 UTC
As shown in:
http://statistics.netbeans.org/exceptions/detail.do?id=138842

there are two instances of FileObjects for the same path, both are valid and they are not "equals". The debugging info
was produced by this code:
http://hg.netbeans.org/main/rev/f4b7c9046468

As noted above, there should not be two non-equals instances of FileObjects for the same path. Guessing from similar
recent reports, this is random. So, you will likely need to add more logging. Feel free to use the place in
TreePathHandle that I used for the debugging info.
Comment 6 Jan Lahoda 2008-11-17 15:16:54 UTC
*** Issue 153061 has been marked as a duplicate of this issue. ***
Comment 7 Jan Lahoda 2008-11-20 08:43:48 UTC
*** Issue 153471 has been marked as a duplicate of this issue. ***
Comment 8 Jan Lahoda 2008-11-20 09:40:21 UTC
Please add some logs to debug the problem. Thanks.
Comment 9 Jiri Skrivanek 2008-11-27 08:42:28 UTC
I added some logging but still I am not able to decipher how it could happen. Reproducible test case is highly welcome.

http://hg.netbeans.org/core-main/rev/a6f27a831ada
Comment 10 _ tboudreau 2009-01-19 21:07:18 UTC
FYI, before I got this exception I had refactored and renamed the file I was editing, and an error message (OK dlg, not
exception) was shown then saying that the file I had refactored could not be found (the new path, not the old one).

It could be that something is holding onto stale FileObjects after a refactoring that replaces them.

Comment 11 _ tboudreau 2009-01-20 16:13:38 UTC
Created attachment 76054 [details]
log file
Comment 12 _ tboudreau 2009-01-20 16:20:05 UTC
In the attached log, you will see a bunch of FileNotFoundExceptions.  The problem file was one called PaintAttributes. 
I started with an interface called PaintAttributes, and an implementation in the same package called
PaintAttributesImpl.  I decided the interface was not useful, deleted PaintAttributes (the interface), removed the
"implements PaintAttributes" clause from the top of PaintAttributesImpl, then used Refactor > Rename to rename
PaintAttributesImpl to PaintAttributes.  You will see a FileNotFoundException for PaintAttributes in the log.  

After that you will see an error message logged, which may be connected:
Adding a fold that is identical with another previously added fold from the same FoldManager is not allowed

After that we get the java errors:
SEVERE [org.openide.util.Exceptions]
java.lang.IllegalArgumentException: TreePathHandle
[H:\space\VectorEditor\Model\src\org\netbeans\vectormodel\api\paint\PaintAttributes.java] was not created from
H:\space\VectorEditor\Model\src\org\netbeans\vectormodel\api\paint\PaintAttributes.java
mine: id=25068876, valid=true,
url=file:/H:/space/VectorEditor/Model/src/org/netbeans/vectormodel/api/paint/PaintAttributes.java
remote: id=29566266, valid=true,
url=file:/H:/space/VectorEditor/Model/src/org/netbeans/vectormodel/api/paint/PaintAttributes.java
---------------------------------------------------
Reflection failed: org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory starting from
org.netbeans.StandardModule$OneModuleClassLoader@11c2b67[org.netbeans.modules.java.source] with possible defining
loaders [...]
	at org.netbeans.api.java.source.TreePathHandle$TreeDelegate.resolve(TreePathHandle.java:425)
	at org.netbeans.api.java.source.TreePathHandle.resolve(TreePathHandle.java:142)
Comment 13 Jiri Skrivanek 2009-01-22 14:51:47 UTC
I am afraid I can't reproduce this IllegalArgumentException following described scenario. There is a lot of
FileNotFoundExceptions when you rename package. But if I delete PaintAttributes and then refactor PaintAttributesImpl,
it doesn't thow any exception.
I had to fix debugging messages in TreePathHandle because of ClassNotFoundException (446223312269). If you are able to
reproduce it repeatedly, please, send me error massages from build after changeset 446223312269 is integrated. Also I
would like to know which type of project you used and if is something unusual on your hardware. Thanks.
Comment 14 _ tboudreau 2009-01-22 21:29:38 UTC
> I would like to know which type of project you used and if is something unusual on your hardware.

Nb module project (in suite, not nbsrc).

You have windows & java versions below.  Hardware is
AMD Phenom 64 quad core CPU, 4GB RAM, Nvidia GEForce 9500 graphics card
NetBeans installed on 3 drive Windows NT stripe set;  sources on 4x350Gb drive hardware RAID-0 (Areca).

Don't know what else I could add here.

Comment 15 Jiri Skrivanek 2009-02-06 07:54:52 UTC
I found a case in which invalid FileObject is re-validated and it leads to existence of duplicate FileObject for the
same path. I fixed it. Now it is not possible to get input/output stream of invalid FileObject.

http://hg.netbeans.org/core-main/rev/67d88d1c5230
Comment 16 Quality Engineering 2009-02-06 19:47:32 UTC
Integrated into 'main-golden', will be available in build *200902061401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/67d88d1c5230
User: Jiri Skrivanek <jskrivanek@netbeans.org>
Log: #130998 - suppress getting input/output stream of invalid FileObject. I may lead to re-validation of this FileObject which is prohibited.
Comment 17 Jiri Skrivanek 2009-05-05 12:55:53 UTC
*** Issue 159828 has been marked as a duplicate of this issue. ***
Comment 18 Quality Engineering 2009-05-07 07:58:09 UTC
Integrated into 'main-golden', will be available in build *200905070201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/167e21070a01
User: Jiri Skrivanek <jskrivanek@netbeans.org>
Log: #130998 - Don't set lastModified when already invalidated. It prevents duplicate valid file objects because lastModified field is used in isValid method.