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 221653 - Some test donated: the target file of FileObject is wrong if it contains '#'
Summary: Some test donated: the target file of FileObject is wrong if it contains '#'
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 7.0.1
Hardware: PC Windows XP
: P2 normal (vote)
Assignee: Jaroslav Tulach
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-07 14:32 UTC by manu-sogeti
Modified: 2012-12-19 08:53 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
contains the folders where the issue occurs and JunitTest (6.03 KB, application/zip)
2012-11-07 14:32 UTC, manu-sogeti
Details
Project with JUnit test and results in text file (1.36 MB, text/plain)
2012-12-11 12:34 UTC, manu-sogeti
Details

Note You need to log in before you can comment on or make changes to this bug.
Description manu-sogeti 2012-11-07 14:32:12 UTC
Created attachment 127320 [details]
contains the folders where the issue occurs and JunitTest

Hi dear support,

I have an unexpected behavior when i created FileObject for 2 files.

Here are the folders that pose problem:

D:\ManoloSVN\BugsPlones\Plone134\superbugName\ADZ#CT#SLT.label\definition.math
D:\ManoloSVN\BugsPlones\Plone134\superbugName\ADXACT#SLT.label\definition.math

When i'm creating a FileObject for each parent directory all works fine:

1/creating FileObject for : D:\ManoloSVN\BugsPlones\Plone134\superbugName\ADZ#CT#SLT.label =>OK
2/creating FileObject for : D:\ManoloSVN\BugsPlones\Plone134\superbugName\ADXACT#SLT.label => OK


But if you try to create successively FileObject with subfiles as definition.math,
The second FileObject points to the first:

1/creating FileObject for : D:\ManoloSVN\BugsPlones\Plone134\superbugName\ADZ#CT#SLT.label\definition.math => OK
2/creating FileObject for : D:\ManoloSVN\BugsPlones\Plone134\superbugName\ADXACT#SLT.label\definition.math => KO
                ==> Here the target file of FileObject is: D:\ManoloSVN\BugsPlones\Plone134\superbugName\ADZ#CT#SLT.label\definition.math
				==> I expected as target file :D:\ManoloSVN\BugsPlones\Plone134\superbugName\ADXACT#SLT.label\definition.math

If you replace the '#' with '_' in the name of the folder ADXACT#SLT.label all works fine again...

To reproduce the bug, I attached a zip file that contains the folders and files to test, and a JUnitTest file BugFileObject.java.

Thanks for your help.

Best regards

Product Version: NetBeans IDE 7.0.1 (Build 201107282000)
Java: 1.6.0_25; Java HotSpot(TM) Client VM 20.0-b11
System: Windows XP version 5.1 running on x86; Cp1252; fr_FR (nb)
Userdir: D:\Documents and settings\ejacquot\.netbeans\7.0
Comment 1 manu-sogeti 2012-11-07 15:31:31 UTC
Additional information : the hash is the same for this folders

File             : D:\ManoloSVN\BugsPlones\Plone134\superbugName\ADZ#CT#SLT.label
hash1:-1735403051

File             : D:\ManoloSVN\BugsPlones\Plone134\superbugName\ADXACT#SLT.label
hash2:-1735403051

best regards
manu
Comment 2 Jaroslav Tulach 2012-11-22 08:12:28 UTC
The set of sort of useless if it is using hardcoded paths like "D:\\ManoloSVN\\". I know there used to be bug related to hashCode in previous versions of NetBeans, but I believe I fixed it. Why don't you try to run the same test with NetBeans 7.3? It should be much easier for you, when you have the right paths on your disk.

Marking incomplete: I either need information how the test behaves with NetBeans 7.3 or I need a test that I could really invoke.
Comment 3 manu-sogeti 2012-11-27 08:06:26 UTC
Hi Jaroslav ,

Thanks for your help ! I will try the junit test with netbeans 7.3
I tried with previous version of netbeans 7.2.1 but the bug occurs again.

to test the Junit you can create the folder "D:\\ManoloSVN\\BugsPlones\\Plone134\\" on your computer and copy the contents of the zip in this folder before start the test. 
Or you can create your folder, copy the contents of the zip to the new folder and replace the path (with your folder path)in the Junit test.

Thanks for your help i contact you after i will test the junit on netbeans 7.3.

manu
Comment 4 manu-sogeti 2012-12-11 12:34:26 UTC
Created attachment 129202 [details]
Project with JUnit test and results in text file

Hi dear support,

I try my Junit test on Netbeans 7.3 beta but the issue is not resolved.
I attached a new project that contains a new Junit test and the results in
the file TestResults.txt.

The project was be made on netbeans 7.2.1

To RUN the Junit test file BugFileObjectTest.java open the project ProjectBugName
and call the actions "debug file" or "debug test files". With this actions the
test folders under module1 will be found.

With this test you can see that for 2 folders an identical hash code is generated
and when i try to get a child file (with the same name). the method getFileObject()
returns the child file of previous folder !

I saw in netbeans sources that a global map store the FileObjects using like key
the HashCode of files, but this HashCode is not unique.

For my company this issues is critical because if we can't get the good data file, our mathematical 
calculations will be wrong.

Thanks for your help.

manu
Comment 5 manu-sogeti 2012-12-11 12:35:56 UTC
Hi dear support,

I try my Junit test on Netbeans 7.3 beta but the issue is not resolved.
I attached a new project that contains a new Junit test and the results in
the file TestResults.txt.

The project was be made on netbeans 7.2.1

To RUN the Junit test file BugFileObjectTest.java open the project ProjectBugName
and call the actions "debug file" or "debug test files". With this actions the
test folders under module1 will be found.

With this test you can see that for 2 folders an identical hash code is generated
and when i try to get a child file (with the same name). the method getFileObject()
returns the child file of previous folder !

I saw in netbeans sources that a global map store the FileObjects using like key
the HashCode of files, but this HashCode is not unique.

For my company this issues is critical because if we can't get the good data file, our mathematical 
calculations will be wrong.

Thanks for your help.

manu
Comment 6 Jaroslav Tulach 2012-12-11 15:55:34 UTC
The donated "test" is not very polished, but it gives me the idea. Yes, this seems serious enough issue.
Comment 7 manu-sogeti 2012-12-12 08:15:04 UTC
Hi Jaroslav,

Thanks for your answer. 

To debug, i put a breakpoint on the secondary method getFileObject() (at line 83 of JUnit test) and I step into all methods called.
In one of this méhods a global map returns the bad FileObject because 2 HashCodes
are equals for 2 different Files.

Thank you very much for your help.

Best regards.

manu
Comment 8 Jaroslav Tulach 2012-12-12 13:07:45 UTC
Tests that fail on windows:
http://hg.netbeans.org/ergonomics/rev/de0ec293eb99
Comment 9 Jaroslav Tulach 2012-12-13 13:03:04 UTC
ergonomics#a39e478feb40
Comment 10 manu-sogeti 2012-12-13 13:11:48 UTC
Hi Jaroslav,

Have you been able to reproduce the issue? You have a solution? 
if yes, the fix will be integrated in the next version of Netbeans?

Thank you very much.

manu
Comment 11 Quality Engineering 2012-12-17 12:36:15 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/de0ec293eb99
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #221653: Test to emulate the problem
Comment 12 manu-sogeti 2012-12-19 08:53:32 UTC
Hi Jaroslav ,

Thank you very much for your help. 
It works fine !

Best regards.

manu