### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/internal/core/JavaProject.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java,v retrieving revision 1.395 diff -u -r1.395 JavaProject.java --- model/org/eclipse/jdt/internal/core/JavaProject.java 26 Feb 2008 10:11:46 -0000 1.395 +++ model/org/eclipse/jdt/internal/core/JavaProject.java 27 Feb 2008 16:40:35 -0000 @@ -279,10 +279,14 @@ } } - // keep device only if it was specified (this is because File.getCanonicalPath() converts '/lib/classed.zip' to 'd:/lib/classes/zip') + // keep device only if it was specified (this is because File.getCanonicalPath() converts '/lib/classes.zip' to 'd:/lib/classes/zip') if (externalPath.getDevice() == null) { result = result.setDevice(null); } + // keep trailing separator only if it was specified (this is because File.getCanonicalPath() converts 'd:/lib/classes/' to 'd:/lib/classes') + if (externalPath.hasTrailingSeparator()) { + result = result.addTrailingSeparator(); + } // if (JavaModelManager.VERBOSE) { // System.out.println("JAVA MODEL - Canonical path is " + result.toString()); // } #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.169 diff -u -r1.169 ClasspathTests.java --- src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 26 Feb 2008 10:11:58 -0000 1.169 +++ src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 27 Feb 2008 16:40:36 -0000 @@ -696,11 +696,11 @@ this.deleteProject("P"); } } -/** - * Test that a classpath entry for an external jar is externalized +/* + * Ensure that a classpath entry for an external jar is externalized * properly. */ -public void testClasspathExternalize() throws CoreException { +public void testExternalize1() throws CoreException { // was testClasspathExternalize try { IJavaProject project= this.createJavaProject("P", new String[] {}, new String[] {getExternalJCLPathString()}, ""); IClasspathEntry[] classpath= project.getRawClasspath(); @@ -725,6 +725,15 @@ this.deleteProject("P"); } } +/* + * Ensures that a classpath entry for an external library is externalized properly. + * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=220542 ) + */ +public void testExternalize2() throws CoreException { + String externalLibPath = getExternalFolderPath("externalLib") + File.separator; + IClasspathEntry entry = JavaCore.newLibraryEntry(new Path(externalLibPath), null, null); + assertEquals("Unexpected external path", externalLibPath, entry.getPath().toOSString()); +} /** * Move a root and ensure the classpath is not updated (i.e. entry not renamed). */