Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 319925

Summary: User libraries - jars not found upon save
Product: [Eclipse Project] JDT Reporter: kfranic
Component: CoreAssignee: Jay Arthanareeswaran <jarthana>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, markus.kell.r
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug
Attachments:
Description Flags
Video of complete process, project none

Description kfranic CLA 2010-07-14 17:26:04 EDT
Build Identifier: Version: 3.5.2 Build id: M20100211-1343

I have a big user library with jars in Project dir. Structure is as follows:
workspace/Project/jars/<different directories with sub-directories containing jars>

I use Eclipse UI to add the Jar to User library and for the most part it works, jars are found and classpath is extended.
However on few occasions, I include jar to library using GUI, close the preferences window, open it again and the jars that I've added are listed with red x sign and tag missing.
Jars in mention are completely readable and writable as are all directories in the tree.
If I export this library I can notice that for the OK libraries path being displayed is forward slash "/", where on jars Eclipse can't access this path is listed with backslash "\", example:
OK   ->        <archive path="/Project/jars/dir_1/dir2/dir3/jar.jar"/>
NOTOK->        <archive path="\Project\jars\dir_2\subdir1\subdir2\subdir3\jar_x.jar"/>

Note that I did not manually modify this library - pure Eclipse Export.
I've watched what is being accessed using Sysinternals tools and Eclipse in NOTOK case is serching for DISK:\Project\jars\dir_2\subdir1\subdir2\subdir3\jar_x.jar

If I modify the path marked as NOTOK to include forward slashes, import it, export it again, I get the same behaviour.

Only thing that apparently works is to define library with full path starting with disk root.

Reproducible: Always

Steps to Reproduce:
1.Check details.
Comment 1 Ayushman Jain CLA 2010-07-15 03:53:20 EDT
Jay, please investigate. Thanks!
Comment 2 Jay Arthanareeswaran CLA 2010-07-15 05:22:56 EDT
I am unable to reproduce this bug with eclipse 3.6. I would like to ask few questions:

1. Do you notice anything common about the affected JAR files at all? Like they all are in a particular folder, they are different from the good one in a particular way etc.?
2. Are the same JAR files failing and OK Jars working fine all the time?
3. Is it possible to try this with Eclipse 3.6 release?

And finally, is it possible to attach the project with the affected JAR files (one or two will do)?
Comment 3 kfranic CLA 2010-07-15 15:30:11 EDT
Created attachment 174437 [details]
Video of complete process, project

Video of complete process
Project
Comment 4 kfranic CLA 2010-07-15 15:31:56 EDT
>1. Do you notice anything common about the affected JAR files at all? Like they
>all are in a particular folder, they are different from the good one in a
>particular way etc.?
Nothing in particular.

>2. Are the same JAR files failing and OK Jars working fine all the time?
I have not seen a pattern.

>3. Is it possible to try this with Eclipse 3.6 release?
Yep. Same behaviour.

>And finally, is it possible to attach the project with the affected JAR files
>(one or two will do)?
Attached+some more.
Comment 5 Jay Arthanareeswaran CLA 2010-07-19 04:13:52 EDT
Thanks for all the details. Can I ask you to try one more thing - can you try having the jar files from a location outside the workspace and see if that makes a difference? My guess is that it will.

Markus, the issue seems to be around the backslashes instead '/' when a resource is selected from within the workspace and this seem to happen only in Windows 7. Have you come across this kind of problem earlier?
Comment 6 kfranic CLA 2010-07-19 10:46:27 EDT
(In reply to comment #5)
> Thanks for all the details. Can I ask you to try one more thing - can you try
> having the jar files from a location outside the workspace and see if that
> makes a difference? My guess is that it will.
> 
> Markus, the issue seems to be around the backslashes instead '/' when a
> resource is selected from within the workspace and this seem to happen only in
> Windows 7. Have you come across this kind of problem earlier?

Firstly, this does not happen only on Windows 7, I can see it also on my PC at work which has Windows XP.

Secondly, I do not see this problem when jars are referenced with absolute paths.
Comment 7 Jay Arthanareeswaran CLA 2010-07-19 10:52:11 EDT
(In reply to comment #6)
> Firstly, this does not happen only on Windows 7, I can see it also on my PC at
> work which has Windows XP.
> 
> Secondly, I do not see this problem when jars are referenced with absolute
> paths.

Ah, I assumed it was a Windows 7 only problem because I was not able to reproduce the bug on Windows XP - even with the projects/libraries you gave me. The immediate thing I noticed on my machine was the forward slashes instead of the backward ones. I will give it one more shot and if I can't reproduce the problem, you might have to help me with more questions or perhaps access to the machine where the bug occurs. But we will keep that as a last resort.
Comment 8 kfranic CLA 2010-07-27 15:31:22 EDT
(In reply to comment #7)
> Ah, I assumed it was a Windows 7 only problem because I was not able to
> reproduce the bug on Windows XP - even with the projects/libraries you gave me.
> The immediate thing I noticed on my machine was the forward slashes instead of
> the backward ones. I will give it one more shot and if I can't reproduce the
> problem, you might have to help me with more questions or perhaps access to the
> machine where the bug occurs. But we will keep that as a last resort.

I'm open to questions.
But the access, I'm not sure, but we can talk options.
Comment 9 Jay Arthanareeswaran CLA 2010-07-28 03:55:01 EDT
Finally, I am able to reproduce the bug. From the video, I observe that the nested folders are created, jar is copied (note that all this inside the project) and immediately the user library is created using the newly added Jar. When the jar is added to the library, there is no error in the dialog. However, when we close the dialog and reopen again, we see the error.

When the project is refreshed, the error goes away. Investigating further.
Comment 10 Jay Arthanareeswaran CLA 2010-07-28 05:39:44 EDT
On further investigation, this appears to be a non-bug. After fix to bug 133191, whenever possible, user libraries paths are stored as relative to the workspace. And because we just added a resource (JAR) and yet to refresh the workspace, the workspace tree doesn't yet contain the JAR - i.e. ElementTree.includes(IPath) returns false. But once a refresh is done, everything is normal.

Markus can confirm this and then I will close this bug.
Comment 11 kfranic CLA 2010-07-29 06:42:41 EDT
(In reply to comment #10)
> On further investigation, this appears to be a non-bug. After fix to bug
> 133191, whenever possible, user libraries paths are stored as relative to the
> workspace. And because we just added a resource (JAR) and yet to refresh the
> workspace, the workspace tree doesn't yet contain the JAR - i.e.
> ElementTree.includes(IPath) returns false. But once a refresh is done,
> everything is normal.
> 
> Markus can confirm this and then I will close this bug.

I can confirm that when I refresh folder holding jars, it works in my case also.

But IMHO this is a bug, it may be minor bug, but inconvenient one.
If you add something via dialog and Eclipse includes it with relative path, it should be available, this way, as I see it, one of the functionality is partially broken....
Comment 12 Eclipse Genie CLA 2018-12-19 15:11:33 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.