Bug 183117

Summary: User Library Lost
Product: [Eclipse Project] JDT Reporter: Carlo Luib-Finetti <cluibfinetti>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: bugzilla, david_audel, etiennel, griff, gvgriffin, jerome_lanneluc, tmowlem
Version: 3.3   
Target Milestone: 3.3.1   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Attachments:
Description Flags
Log from eclipse when running on java 1.5
none
Log from eclipse when running on java 1.6
none
Extended Eclipse log when running on java 1.5
none
jdt preferences
none
Corresponding code patch
none
Slightly improved patch none

Description Carlo Luib-Finetti CLA 2007-04-19 03:07:00 EDT
Using Eclipse 3.3M6, I sometimes get this error: a Java user defined library becomes unknown to Eclipse. This phenomen shows up every now and then after closing a project, using another project and then reopening the first project. Suddenly Eclipse sees unknown types because it lost the userlibrary from where they are imported.

I noticed that the library still is defined in ./metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs. So i just moved the line with the missing userlibrary to another place in the file, restartet Eclipse and did a clean on the project - and voilĂ , the userlibrary is known again to Eclipse.

Switching back to Eclipse 3.3M5, where i never had this error before, showed me someday, that it exists there also.
Comment 1 Jerome Lanneluc CLA 2007-04-19 06:25:16 EDT
Would you have detailed steps to reproduce this problem ? There is not enough information in this bug report for us to understand the problem.
Comment 2 Carlo Luib-Finetti CLA 2007-04-20 03:48:42 EDT
Well, I didn't find a way to reproduce this bug. It only shows occasionally. Sometimes it shows up when I restart Eclipse, sometimes it is when closing one project and open another. I do switch projects about 10 times a day and restart Eclipse maybe 2 or 3 times a day; the erronoues behaviour manifests itself 2 or 3 times a week.
Comment 3 Etienne Lacombe CLA 2007-05-13 22:08:00 EDT
*** Bug 185809 has been marked as a duplicate of this bug. ***
Comment 4 Jerome Lanneluc CLA 2007-05-14 11:20:34 EDT
If unable to find steps to reproduce, could you please enable some tracing as follows to help us understand what's going on ?
1. Create a .options file with the following content:
# Turn on debug tracing for org.eclipse.jdt.core plugin
org.eclipse.jdt.core/debug=true
# Reports classpath variable initialization, and classpath container resolution
org.eclipse.jdt.core/debug/cpresolution=true
2. Start eclipse with the following command:
eclipse.exe -debug <path to your .options file> -vm <path to java.exe>
e.g. eclipse.exe -debug c:\temp\.options -vm c:\jdk1.5.0\bin\java.exe
=> this should open a DOS console
3. Ensure that the DOS console buffer size is as big as possible 
(Properties > Layout > Screen Buffer Size > set width and height to 9999)
4. When the problem occurs, copy/paste the content of the DOS console into a
file, and attach the file to this bug
Comment 5 Walter Harley CLA 2007-05-24 15:29:07 EDT
I wonder if this is a duplicate of bug 154984 ?
Comment 6 Olivier Thomann CLA 2007-05-24 16:07:12 EDT
Doesn't seem to be the case since it happens with M6 and 154984 has been fixed for M6.
Comment 7 Piotr Zielniok CLA 2007-08-16 05:06:32 EDT
I've also encountered this problem on eclipse 3.3. I had added new user library with some jars and after few restarts user library has just disappeared. I have other user libraries defined and they behave ok. Only this one user library always disappear.
My friend also complain about disappearing user libraries.
Comment 8 Jerome Lanneluc CLA 2007-08-16 05:17:33 EDT
(In reply to comment #7)
> I've also encountered this problem on eclipse 3.3. I had added new user library
> with some jars and after few restarts user library has just disappeared. I have
> other user libraries defined and they behave ok. Only this one user library
> always disappear.
> My friend also complain about disappearing user libraries.
> 
Please see comment 4
Comment 9 Piotr Zielniok CLA 2007-08-17 05:02:25 EDT
Additional info.
When I am running eclipse on java 1.5.0_12 few of my user libraries are unavailable (invisible), but when Im running eclipse on java 1.6.0_02 libraries are visible.
Comment 10 Piotr Zielniok CLA 2007-08-17 05:21:04 EDT
Created attachment 76284 [details]
Log from eclipse when running on java 1.5

Log from eclipse when running on java 1.5
Comment 11 Piotr Zielniok CLA 2007-08-17 05:21:59 EDT
Created attachment 76285 [details]
Log from eclipse when running on java 1.6

Log from eclipse when running on java 1.6
Comment 12 Piotr Zielniok CLA 2007-08-17 05:38:22 EDT
Comment to Logs:

I have defined 9 user libraries.

On java 5 I can see only 4 user libraries: 
 - Axis1.4
 - TMobileRAN
 - spring
 - hibernate_anotations

On java 6 I can see all 9 user libraries.
Comment 13 Jerome Lanneluc CLA 2007-08-17 07:50:29 EDT
Thanks for the feedback Piotr. The trace from comment 10 shows that some user libraries are not initialized when they should. 

To further investigate, I improved the tracing again. Could you please replace your existing org.eclipse.jdt.core.*.jar (in the plugins directory) with the one posted at http://www.eclipse.org/jdt/core/r3.3/index.php#UPDATES ?

Then please attach the new trace you get to this bug report. Thanks.
Comment 14 Piotr Zielniok CLA 2007-08-17 10:41:38 EDT
Created attachment 76306 [details]
Extended Eclipse log when running on java 1.5

I attached log from new jdt (extended logs).
This time 3 user libraries are not visible:
 - hibernate_core
 - hibernateCore
 - TestHibernateCore

These libraries contains exactly the same jars.
Comment 15 Jerome Lanneluc CLA 2007-08-17 11:35:45 EDT
Thanks again. Now can you please attach ./metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs to this bug ?
Comment 16 Piotr Zielniok CLA 2007-08-17 11:47:12 EDT
Created attachment 76312 [details]
jdt preferences

Here it is.
Comment 17 Jerome Lanneluc CLA 2007-08-21 11:29:30 EDT
I have rewritten the user library manager to make it simpler and thus avoiding a potential concurrency problem.

Could you please try the patch at http://www.eclipse.org/jdt/core/patches/org.eclipse.jdt.core_3.3.1.z20070821-1711.jar and let me know if this fixes the problem ? Thanks.
Comment 18 Jerome Lanneluc CLA 2007-08-23 09:39:19 EDT
Created attachment 76767 [details]
Corresponding code patch

Waiting on feedback from user before committing the patch.
Comment 19 Jerome Lanneluc CLA 2007-08-23 10:16:45 EDT
Created attachment 76771 [details]
Slightly improved patch
Comment 20 Piotr Zielniok CLA 2007-08-23 12:08:26 EDT
For me patch resolve the problem.
I haven't used 'slightly improved patch'.
Comment 21 Jerome Lanneluc CLA 2007-08-24 08:57:45 EDT
Thanks for the feedback. Patch released for 3.3.1 in R3_3_maintenance.

The corresponding update can be found at http://www.eclipse.org/jdt/core/r3.3/index.php#UPDATES.

The temporary patch from comment 17 has been removed.
Comment 22 Jerome Lanneluc CLA 2007-08-24 09:00:44 EDT
Patch released for 3.4M2 in HEAD.
Comment 23 David Audel CLA 2007-09-03 07:47:24 EDT
Verified by user.
Comment 24 Jerome Lanneluc CLA 2007-09-05 04:37:15 EDT
*** Bug 202241 has been marked as a duplicate of this bug. ***
Comment 25 Jerome Lanneluc CLA 2007-11-13 07:13:02 EST
*** Bug 159452 has been marked as a duplicate of this bug. ***
Comment 26 Jerome Lanneluc CLA 2007-12-05 03:38:31 EST
*** Bug 211897 has been marked as a duplicate of this bug. ***