Community
Participate
Working Groups
I have a project with two linked folders defined like this: <linkedResources> <link> <name>aaaaaaaA</name> <type>2</type> <location>C:/somewhere/a</location> </link> <link> <name>aaaaaaaA/b</name> <type>2</type> <location>C:/somewhere/b</location> </link> </linkedResources> Linked folders should be created in order exactly as in .project file. But when importing a project, when .project file is read, link entries are stored in HashMap and their order is not preserved. Now when aaaaaaaA/b link is created, it requires it's parent to exist and consequently aaaaaaaA directory is created. Following that aaaaaaaA link is ignored. Workaround: not use nested folders Proposed solution: take order information into account when reading .project file
Possibly related to bug 177148
(In reply to comment #1) > Possibly related to bug 177148 > John you're right, but I created this one to narrow down the issue. Now i am working on a patch for it and would be happy if it also fix bug 177148 but i am not sure if it really be that easy.
Created attachment 61792 [details] sort links before synchronizing them with with filesystem when reconciling links, sort them first so nested links will never be created before their parents
Assigning to myself to review patch
Jacek, I like this solution. It has minimal impact on the code, and nicely inserts the fix in the exact place it is needed. It is important in the resources component that all fixes be accompanied by an automated JUnit test. This ensures the same bug doesn't slip back in in the future. I have written a test for this, and I will attach it here for your reference. The only other minor change is that I found the new PathLengthComparator class to be unnecessary. I have instead made LinkDescription implement Comparable and put the comparison code there. Also, I changed the sort slightly so that it's a real topological sort. It has the same effect in this case and similar performance, but I prefer a logical sort implementation because it may be useful in the future (sorting paths based on their string representation creates an unusual sort order). Thank you for the patch. I am running the entire test suite now, and will release when I verify that all tests pass.
Created attachment 62276 [details] Updated patch
Created attachment 62277 [details] Test case
All tests pass. Fix released.