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 223167

Summary: Test: fo.getChildren() may not contain FO for broken symlinks
Product: platform Reporter: Ondrej Vrabec <ovrabec>
Component: FilesystemsAssignee: Jaroslav Tulach <jtulach>
Status: RESOLVED FIXED    
Severity: normal CC: ovrabec
Priority: P3    
Version: 7.3   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 222841    
Attachments: test
tests still failing

Description Ondrej Vrabec 2012-12-03 11:50:47 UTC
Created attachment 128767 [details]
test

I have a problem implementing the logging of external hg commands (filed as bug #222841). Mercurial does not receive events about .hg/wlock file on Unix/Linux (possibly on Win too, i haven't checked). The file is created by certain hg commands and is a *broken symlink* pointing to non-existent file. IDE filesystem correctly recognizes such a java.io.File was created but does not propagate the event to ProvidedExtensions... IMHO the problem is java.io.File.exists returns false for such a file and FileObjectFactory.issueIfExists -> touchExists uses the return value of this method. Please see the attached test (to be applied on masterfs)
Comment 1 Ondrej Vrabec 2012-12-03 11:51:38 UTC
currently a blocker of #222841 but if you tell me it cannot be fixed i will try to workaround it.
Comment 2 Jaroslav Tulach 2012-12-05 10:53:14 UTC
There seems to be a workaround that you can use:
http://hg.netbeans.org/ergonomics/rev/ee37515e3a9a

On JDK7 I could: use Files.isSymbolicLink, but I am not sure how to make the code work also on JDK6.
Comment 3 Ondrej Vrabec 2012-12-05 13:33:07 UTC
sorry jardo, my fault, i gave this a wrong description. My point was different: my problem is that ProvidedExtensions does not receive events about such files - because FileObject cannot be created for these files in FileObjectFactory.java.
I'll try harder and write a different more descriptive test.
Comment 4 Ondrej Vrabec 2012-12-05 15:13:03 UTC
Created attachment 128902 [details]
tests still failing
Comment 5 Ondrej Vrabec 2012-12-05 15:23:17 UTC
i modified the tests to demonstrate my point
please see the attachment:
1) FileObjTest - true, first time it passes but once you delete the broken link, refresh and create it again, it does not seem to return FileObject for it again
2) ProvidedExtensionsTest.testCreatedDeleteBrokenLinkExternally - fist sequence of create/delete delivers the events fine, but the following sequence of create/delete of the same broken link fails
Comment 6 Jaroslav Tulach 2012-12-06 07:15:56 UTC
FileObject can be created, if you ask parent for getChildren(). Take a look at my test.
Comment 7 Quality Engineering 2012-12-12 02:44:11 UTC
Integrated into 'main-golden', will be available in build *201212120001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/ee37515e3a9a
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #223167: Demonstrating that getParent().getChildren() works and makes the broken symlink available
Comment 8 Jaroslav Tulach 2012-12-14 10:40:16 UTC
ergonomics#5b551493d8cc
Comment 9 Quality Engineering 2012-12-17 12:38:24 UTC
Integrated into 'main-golden', will be available in build *201212170919* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/5b551493d8cc
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #223167: Test: FileUtil.toFileObject() returns null for broken symlinks
#223167: Indicating the issueIfExists that the file has been noticed during listFiles() and thus it exists whatever its exist() state says