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 139273 Details for
Bug 276373
Incorrect resource comparison with IJavaProject.isOnClasspath(IResource)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
bug_276373.txt (text/plain), 4.78 KB, created by
Jay Arthanareeswaran
on 2009-06-16 05:53:17 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Jay Arthanareeswaran
Created:
2009-06-16 05:53:17 EDT
Size:
4.78 KB
patch
obsolete
>### 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.424 >diff -u -r1.424 JavaProject.java >--- model/org/eclipse/jdt/internal/core/JavaProject.java 23 Apr 2009 15:32:16 -0000 1.424 >+++ model/org/eclipse/jdt/internal/core/JavaProject.java 16 Jun 2009 09:46:25 -0000 >@@ -2171,6 +2171,13 @@ > if (entryPath.equals(exactPath)) { // package fragment roots must match exactly entry pathes (no exclusion there) > return true; > } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=276373 >+ // When a classpath entry is absolute, convert the resource's relative path to a file system path and compare >+ // e.g - /P/lib/variableLib.jar and /home/P/lib/variableLib.jar when compared should return true >+ if (entryPath.isAbsolute() >+ && entryPath.equals(ResourcesPlugin.getWorkspace().getRoot().getLocation().append(exactPath))) { >+ return true; >+ } > if (entryPath.isPrefixOf(path) > && !Util.isExcluded(path, ((ClasspathEntry)entry).fullInclusionPatternChars(), ((ClasspathEntry)entry).fullExclusionPatternChars(), isFolderPath)) { > return true; >#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.200 >diff -u -r1.200 ClasspathTests.java >--- src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 14 May 2009 10:09:36 -0000 1.200 >+++ src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 16 Jun 2009 09:46:31 -0000 >@@ -5863,5 +5863,68 @@ > assertTrue("Inclusion pattern was null", e.getInclusionPatterns() != null); > assertTrue("Exclusion pattern was null", e.getExclusionPatterns() != null); > } >+/** >+ * Test adding jar files with absolute file system path using the following modes and ensure the comparison >+ * with a relative path return true. >+ * 1. Variable Entry >+ * 2. User Library >+ * 3. External Jar file >+ * >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=276373" >+ * @throws Exception >+ */ >+public void testBug276373() throws Exception { >+ File libDir = null; >+ try { >+ IJavaProject proj = this.createJavaProject("P", new String[] {}, "bin"); >+ IPath libPath = proj.getResource().getLocation().append("lib"); >+ JavaCore.setClasspathVariable("MyVar", libPath, null); >+ libDir = new File(libPath.toPortableString()); >+ libDir.mkdirs(); >+ IClasspathEntry[] classpath = new IClasspathEntry[3]; >+ File libJar = new File(libDir, "variableLib.jar"); >+ libJar.createNewFile(); >+ classpath[0] = JavaCore.newVariableEntry(new Path("/MyVar/variableLib.jar"), null, null); > >+ libJar = new File(libDir, "externalLib.jar"); >+ libJar.createNewFile(); >+ classpath[1] = JavaCore.newLibraryEntry(new Path(libJar.getAbsolutePath()), null, null); >+ >+ libJar = new File(libDir, "userLib.jar"); >+ libJar.createNewFile(); >+ >+ ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(JavaCore.USER_LIBRARY_CONTAINER_ID); >+ String libraryName = "TestUserLibrary"; >+ IPath containerPath = new Path(JavaCore.USER_LIBRARY_CONTAINER_ID); >+ UserLibraryClasspathContainer containerSuggestion = new UserLibraryClasspathContainer(libraryName); >+ initializer.requestClasspathContainerUpdate(containerPath.append(libraryName), null, containerSuggestion); >+ >+ IEclipsePreferences preferences = new InstanceScope().getNode(JavaCore.PLUGIN_ID); >+ String propertyName = JavaModelManager.CP_USERLIBRARY_PREFERENCES_PREFIX+"TestUserLibrary"; >+ StringBuffer propertyValue = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<userlibrary systemlibrary=\"false\" version=\"1\">\r\n<archive"); >+ propertyValue.append(" path=\"" + libJar.getAbsolutePath()); >+ propertyValue.append("\"/>\r\n</userlibrary>\r\n"); >+ preferences.put(propertyName, propertyValue.toString()); >+ preferences.flush(); >+ >+ classpath[2] = JavaCore.newContainerEntry(containerSuggestion.getPath()); >+ proj.setRawClasspath(classpath, null); >+ >+ IResource resource = getWorkspaceRoot().getProject("P").getFile("lib/variableLib.jar"); >+ assertTrue(proj.isOnClasspath(resource)); >+ >+ resource = getWorkspaceRoot().getProject("P").getFile("lib/externalLib.jar"); >+ assertTrue(proj.isOnClasspath(resource)); >+ >+ resource = getWorkspaceRoot().getProject("P").getFile("lib/userLib.jar"); >+ assertTrue(proj.isOnClasspath(resource)); >+ } >+ finally { >+ if (libDir != null) { >+ org.eclipse.jdt.core.tests.util.Util.delete(libDir); >+ } >+ this.deleteProject("P"); >+ JavaCore.removeClasspathVariable("MyVar", null); >+ } >+} > }
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 276373
:
138852
|
138853
|
139273
|
139944
|
139945