HEAD - bug 154984
diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html
index 20bb889..39438d6 100644
--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html
+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html
@@ -101,7 +101,9 @@
 </ul>
 
 <h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=102473">102473</a>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=154984">154984</a>
+Jars in library not recognized sometimes.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=102473">102473</a>
 code assist: parameter names not harvested from debug info in class files
 
 <a name="v_742"></a>
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/UserLibraryManager.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/UserLibraryManager.java
index 0aaab72..d538048 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/UserLibraryManager.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/UserLibraryManager.java
@@ -41,7 +41,8 @@
 	public final static String CP_USERLIBRARY_PREFERENCES_PREFIX = JavaCore.PLUGIN_ID+".userLibrary."; //$NON-NLS-1$
 	public final static String CP_ENTRY_IGNORE = "##<cp entry ignore>##"; //$NON-NLS-1$
 
-	private static Map userLibraries;
+	private static Map UserLibraries;
+	private static ThreadLocal InitializingLibraries = new ThreadLocal();
 	private static final boolean logProblems= false;
 	private static IEclipsePreferences.IPreferenceChangeListener listener= new IEclipsePreferences.IPreferenceChangeListener() {
 
@@ -122,32 +123,40 @@
 	}
 	
 	static Map getLibraryMap() {
-		if (userLibraries == null) {
-			userLibraries= new HashMap();
-			// load variables and containers from preferences into cache
-			IEclipsePreferences instancePreferences = JavaModelManager.getJavaModelManager().getInstancePreferences();
-			instancePreferences.addPreferenceChangeListener(listener);
-
-			// only get variable from preferences not set to their default
+		if (UserLibraries == null) {
+			HashMap libraries = (HashMap) InitializingLibraries.get();
+			if (libraries != null)
+				return libraries;
 			try {
-				String[] propertyNames = instancePreferences.keys();
-				for (int i = 0; i < propertyNames.length; i++) {
-					String propertyName = propertyNames[i];
-					if (propertyName.startsWith(CP_USERLIBRARY_PREFERENCES_PREFIX)) {
-						try {
-							String propertyValue = instancePreferences.get(propertyName, null);
-							if (propertyValue != null)
-								recreatePersistedUserLibraryEntry(propertyName,propertyValue, false, false);
-						} catch (JavaModelException e) {
-							// won't happen: no rebinding
+				InitializingLibraries.set(libraries = new HashMap());
+				// load variables and containers from preferences into cache
+				IEclipsePreferences instancePreferences = JavaModelManager.getJavaModelManager().getInstancePreferences();
+				instancePreferences.addPreferenceChangeListener(listener);
+	
+				// only get variable from preferences not set to their default
+				try {
+					String[] propertyNames = instancePreferences.keys();
+					for (int i = 0; i < propertyNames.length; i++) {
+						String propertyName = propertyNames[i];
+						if (propertyName.startsWith(CP_USERLIBRARY_PREFERENCES_PREFIX)) {
+							try {
+								String propertyValue = instancePreferences.get(propertyName, null);
+								if (propertyValue != null)
+									recreatePersistedUserLibraryEntry(propertyName,propertyValue, false, false);
+							} catch (JavaModelException e) {
+								// won't happen: no rebinding
+							}
 						}
 					}
+				} catch (BackingStoreException e) {
+					// nothing to do in this case
 				}
-			} catch (BackingStoreException e) {
-				// nothing to do in this case
+				UserLibraries = libraries;
+			} finally {
+				InitializingLibraries.set(null);
 			}
 		}
-		return userLibraries;
+		return UserLibraries;
 	}
 	
 	static void recreatePersistedUserLibraryEntry(String propertyName, String savedString, boolean save, boolean rebind) throws JavaModelException {