Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 162789 Details for
Bug 305122
FUP of 302949
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed Patch
patch_305122.txt (text/plain), 5.55 KB, created by
Jay Arthanareeswaran
on 2010-03-23 13:05:15 EDT
(
hide
)
Description:
Proposed Patch
Filename:
MIME Type:
Creator:
Jay Arthanareeswaran
Created:
2010-03-23 13:05:15 EDT
Size:
5.55 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/JavaModelManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java,v >retrieving revision 1.445 >diff -u -r1.445 JavaModelManager.java >--- model/org/eclipse/jdt/internal/core/JavaModelManager.java 2 Mar 2010 06:46:01 -0000 1.445 >+++ model/org/eclipse/jdt/internal/core/JavaModelManager.java 23 Mar 2010 15:12:07 -0000 >@@ -1552,9 +1552,8 @@ > } > > public void addNonChainingJar(IPath path) { >- if (this.nonChainingJars == null) >- return; >- this.nonChainingJars.add(path); >+ if (this.nonChainingJars != null) >+ this.nonChainingJars.add(path); > } > > /** >@@ -2922,7 +2921,7 @@ > } > > private Set loadNonChainingJarsCache() { >- Set nonChainingJarsCache = Collections.synchronizedSet(new HashSet()); >+ Set nonChainingJarsCache = new HashSet(); > File nonChainingJarsFile = getNonChainingJarsFile(); > DataInputStream in = null; > try { >@@ -2944,7 +2943,7 @@ > } > } > } >- return nonChainingJarsCache; >+ return Collections.synchronizedSet(nonChainingJarsCache); > } > > private File getNonChainingJarsFile() { >@@ -2952,9 +2951,12 @@ > } > > private Set getNonChainingJarsCache() throws CoreException { >- if (this.nonChainingJars != null) >+ // Even if there is one entry in the cache, just return it. It may not be >+ // the complete cache, but avoid going through all the projects to populate the cache. >+ if (this.nonChainingJars != null && this.nonChainingJars.size() > 0) { > return this.nonChainingJars; >- Set result = Collections.synchronizedSet(new HashSet()); >+ } >+ Set result = new HashSet(); > IJavaProject[] projects = getJavaModel().getJavaProjects(); > for (int i = 0, length = projects.length; i < length; i++) { > IJavaProject javaProject = projects[i]; >@@ -2969,7 +2971,8 @@ > } > } > } >- return result; >+ this.nonChainingJars = Collections.synchronizedSet(result); >+ return this.nonChainingJars; > } > > public void loadVariablesAndContainers() throws CoreException { >@@ -3648,6 +3651,7 @@ > info.forgetExternalTimestampsAndIndexes(); > } > } >+ resetNonChainingJarsCache(); > } > > /* >@@ -3690,7 +3694,8 @@ > } > > public void resetNonChainingJarsCache() { >- this.nonChainingJars = null; >+ if (this.nonChainingJars != null) >+ this.nonChainingJars.clear(); > } > > /* >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/ClasspathTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java,v >retrieving revision 1.209 >diff -u -r1.209 ClasspathTests.java >--- src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 4 Mar 2010 10:11:58 -0000 1.209 >+++ src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 23 Mar 2010 15:12:14 -0000 >@@ -6579,5 +6579,67 @@ > this.deleteProject("P"); > } > } >+/** >+ * @bug 302949: FUP of 302949 >+ * Test that >+ * 1) non-chaining jars are cached during classpath resolution and can be retrieved later on >+ * 2) A full save (after resetting the non chaining jars cache) caches the non-chaining jars information >+ * 3) when a project is deleted, the non-chaining jar cache is reset. >+ * >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=305122" >+ * @throws Exception >+ */ >+public void testBug305122() throws Exception { >+ try { >+ >+ IJavaProject proj = this.createJavaProject("P", new String[] {}, "bin"); >+ IClasspathEntry[] classpath = new IClasspathEntry[2]; >+ >+ addLibrary(proj, "nonchaining.jar", null, new String[0], >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n", >+ }, >+ JavaCore.VERSION_1_4); >+ addLibrary(proj, "chaining.jar", null, new String[0], >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n" + >+ "Class-Path: chained.jar\n", >+ }, >+ JavaCore.VERSION_1_4); >+ >+ classpath[0] = JavaCore.newLibraryEntry(new Path("/P/nonchaining.jar"), null, null); >+ classpath[1] = JavaCore.newLibraryEntry(new Path("/P/chaining.jar"), null, null); >+ createFile("/P/chained.jar", ""); >+ >+ proj.setRawClasspath(classpath, null); >+ waitForAutoBuild(); >+ JavaModelManager manager = JavaModelManager.getJavaModelManager(); >+ assertTrue("Non chaining Jar", manager.isNonChainingJar(classpath[0].getPath())); >+ assertFalse("Chaining Jar", manager.isNonChainingJar(classpath[1].getPath())); >+ >+ ((JavaProject)proj).resetResolvedClasspath(); >+ proj.getResolvedClasspath(true); >+ manager = JavaModelManager.getJavaModelManager(); >+ assertTrue("Non chaining Jar", manager.isNonChainingJar(classpath[0].getPath())); >+ assertFalse("Chaining Jar", manager.isNonChainingJar(classpath[1].getPath())); >+ >+ ((JavaProject)proj).resetResolvedClasspath(); >+ IWorkspace workspace = ResourcesPlugin.getWorkspace(); >+ workspace.save(true, null); >+ assertTrue("Non chaining Jar", manager.isNonChainingJar(classpath[0].getPath())); >+ assertFalse("Chaining Jar", manager.isNonChainingJar(classpath[1].getPath())); >+ >+ this.deleteProject("P"); >+ assertFalse("Chaining Jar", manager.isNonChainingJar(classpath[0].getPath())); >+ assertFalse("Chaining Jar", manager.isNonChainingJar(classpath[1].getPath())); >+ >+ } finally { >+ IProject proj = this.getProject("P"); >+ if ( proj != null && proj.exists()) >+ this.deleteProject("P"); >+ } >+} > > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 305122
: 162789