### Eclipse Workspace Patch 1.0 #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.202 diff -u -r1.202 ClasspathTests.java --- src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 8 Jul 2009 07:12:22 -0000 1.202 +++ src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 3 Aug 2009 03:10:08 -0000 @@ -5938,5 +5938,38 @@ JavaCore.removeClasspathVariable("MyVar", null); } } +/** + * @bug 248661:Axis2: Missing required libraries in Axis 2 WS Client Projects + * @test that a variable classpath entry that is mappped to a folder/jar with external path (but still + * inside the project folder) can be validated using both system absolute path and relative path. + * + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=248661" + */ +public void testBug248661() throws Exception { + IFolder folder = null; + try { + IJavaProject proj = this.createJavaProject("P", new String[] {}, "bin"); + IPath folderPath = proj.getResource().getFullPath().append("classes"); + folder = createFolder(folderPath); + assertNotNull(folder); + IClasspathEntry[] classpath = new IClasspathEntry[1]; + classpath[0] = JavaCore.newVariableEntry(folderPath, null, null); + setClasspath(proj, classpath); + + IClasspathEntry cpe = JavaCore.newLibraryEntry(folder.getFullPath(), null, null); + IJavaModelStatus status = JavaConventions.validateClasspathEntry(proj, cpe, true); + assertEquals(IJavaModelStatus.OK, status.getCode()); + + cpe = JavaCore.newLibraryEntry(folder.getLocation(), null, null); + status = JavaConventions.validateClasspathEntry(proj, cpe, true); + assertEquals(IJavaModelStatus.OK, status.getCode()); + } + finally{ + if (folder != null) { + org.eclipse.jdt.core.tests.util.Util.delete(folder); + } + this.deleteProject("P"); + } +} } #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/internal/core/ClasspathEntry.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java,v retrieving revision 1.117 diff -u -r1.117 ClasspathEntry.java --- model/org/eclipse/jdt/internal/core/ClasspathEntry.java 21 Apr 2009 04:39:55 -0000 1.117 +++ model/org/eclipse/jdt/internal/core/ClasspathEntry.java 3 Aug 2009 03:10:54 -0000 @@ -1960,6 +1960,12 @@ private static IJavaModelStatus validateLibraryEntry(IPath path, IJavaProject project, String container, IPath sourceAttachment, String entryPathMsg) { if (path.isAbsolute() && !path.isEmpty()) { Object target = JavaModel.getTarget(path, true); + if (target == null) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=248661 + IPath workspaceRoot = ResourcesPlugin.getWorkspace().getRoot().getLocation(); + if (workspaceRoot.isPrefixOf(path)) { + target = JavaModel.getTarget(path.makeRelativeTo(workspaceRoot).makeAbsolute(), true); + } + } if (target != null && !JavaCore.IGNORE.equals(project.getOption(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, true))) { long projectTargetJDK = CompilerOptions.versionToJdkLevel(project.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true)); long libraryJDK = Util.getJdkLevel(target);