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 115233 Details for
Bug 250946
Bogus jar file is added to the project build path
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix and regression test
250946.txt (text/plain), 8.57 KB, created by
Jerome Lanneluc
on 2008-10-16 05:18:28 EDT
(
hide
)
Description:
Proposed fix and regression test
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2008-10-16 05:18:28 EDT
Size:
8.57 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#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.106 >diff -u -r1.106 ClasspathEntry.java >--- model/org/eclipse/jdt/internal/core/ClasspathEntry.java 13 Oct 2008 10:34:40 -0000 1.106 >+++ model/org/eclipse/jdt/internal/core/ClasspathEntry.java 16 Oct 2008 09:17:18 -0000 >@@ -1727,10 +1727,10 @@ > * @param project the given java project > * @param entry the given classpath entry > * @param checkSourceAttachment a flag to determine if source attachment should be checked >- * @param recurseInContainers flag indicating whether validation should be applied to container entries recursively >+ * @param referredByContainer flag indicating whether the given entry is referred by a classpath container > * @return a java model status describing the problem related to this classpath entry if any, a status object with code <code>IStatus.OK</code> if the entry is fine > */ >- public static IJavaModelStatus validateClasspathEntry(IJavaProject project, IClasspathEntry entry, boolean checkSourceAttachment, boolean recurseInContainers){ >+ public static IJavaModelStatus validateClasspathEntry(IJavaProject project, IClasspathEntry entry, boolean checkSourceAttachment, boolean referredByContainer){ > > IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); > IPath path = entry.getPath(); >@@ -1782,11 +1782,9 @@ > if (description == null) description = path.makeRelative().toString(); > return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CP_CONTAINER_ENTRY, project, path); > } >- if (recurseInContainers) { >- IJavaModelStatus containerEntryStatus = validateClasspathEntry(project, containerEntry, checkSourceAttachment, recurseInContainers); >- if (!containerEntryStatus.isOK()){ >- return containerEntryStatus; >- } >+ IJavaModelStatus containerEntryStatus = validateClasspathEntry(project, containerEntry, checkSourceAttachment, true/*referred by container*/); >+ if (!containerEntryStatus.isOK()){ >+ return containerEntryStatus; > } > } > } >@@ -1813,7 +1811,7 @@ > } > > // get validation status >- IJavaModelStatus status = validateClasspathEntry(project, entry, checkSourceAttachment, recurseInContainers); >+ IJavaModelStatus status = validateClasspathEntry(project, entry, checkSourceAttachment, false/*not referred by container*/); > if (!status.isOK()) return status; > > // return deprecation status if any >@@ -1836,8 +1834,11 @@ > for (int i = 0, length = chainedJars.length; i < length; i++) { > IPath chainedJar = chainedJars[i]; > IJavaModelStatus status = validateLibraryEntry(chainedJar, project, null/*don't check source attachment*/, null/*force computing of entryPathMsg*/); >- if (!status.isOK()) >+ if (!status.isOK()) { >+ if (referredByContainer && status.getCode() == IJavaModelStatusConstants.INVALID_CLASSPATH) >+ continue; // ignore this entry (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=250946 ) > return status; >+ } > } > > IJavaModelStatus status = validateLibraryEntry(path, project, checkSourceAttachment ? entry.getSourceAttachmentPath() : null, entryPathMsg); >Index: model/org/eclipse/jdt/internal/core/ClasspathValidation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathValidation.java,v >retrieving revision 1.2 >diff -u -r1.2 ClasspathValidation.java >--- model/org/eclipse/jdt/internal/core/ClasspathValidation.java 27 Jun 2008 16:03:51 -0000 1.2 >+++ model/org/eclipse/jdt/internal/core/ClasspathValidation.java 16 Oct 2008 09:17:18 -0000 >@@ -66,7 +66,7 @@ > > if (rawClasspath != JavaProject.INVALID_CLASSPATH && outputLocation != null) { > for (int i = 0; i < rawClasspath.length; i++) { >- status = ClasspathEntry.validateClasspathEntry(this.project, rawClasspath[i], false/*src attach*/, true /*recurse in container*/); >+ status = ClasspathEntry.validateClasspathEntry(this.project, rawClasspath[i], false/*src attach*/, false /*not referred by a container*/); > if (!status.isOK()) { > if (status.getCode() == IJavaModelStatusConstants.INVALID_CLASSPATH && ((ClasspathEntry) rawClasspath[i]).isOptional()) > continue; // ignore this entry >Index: model/org/eclipse/jdt/core/JavaConventions.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaConventions.java,v >retrieving revision 1.120 >diff -u -r1.120 JavaConventions.java >--- model/org/eclipse/jdt/core/JavaConventions.java 27 Jun 2008 16:04:01 -0000 1.120 >+++ model/org/eclipse/jdt/core/JavaConventions.java 16 Oct 2008 09:17:17 -0000 >@@ -605,12 +605,12 @@ > * > * @param project the given java project > * @param entry the given classpath entry >- * @param checkSourceAttachment a flag to determine if source attachement should be checked >+ * @param checkSourceAttachment a flag to determine if source attachment should be checked > * @return a java model status describing the problem related to this classpath entry if any, a status object with code <code>IStatus.OK</code> if the entry is fine > * @since 2.0 > */ > public static IJavaModelStatus validateClasspathEntry(IJavaProject project, IClasspathEntry entry, boolean checkSourceAttachment){ >- IJavaModelStatus status = ClasspathEntry.validateClasspathEntry(project, entry, checkSourceAttachment, true/*recurse in container*/); >+ IJavaModelStatus status = ClasspathEntry.validateClasspathEntry(project, entry, checkSourceAttachment, false/*not referred by container*/); > if (status.getCode() == IJavaModelStatusConstants.INVALID_CLASSPATH && ((ClasspathEntry) entry).isOptional()) > return JavaModelStatus.VERIFIED_OK; > return status; >#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.189 >diff -u -r1.189 ClasspathTests.java >--- src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 13 Oct 2008 10:34:37 -0000 1.189 >+++ src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 16 Oct 2008 09:17:20 -0000 >@@ -3340,6 +3340,32 @@ > } > } > /* >+ * Ensures that no marker is created for incorrect extra libraries in the Class-Path: clause of an external jar referenced by a container >+ * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=250946 ) >+ */ >+public void testExtraLibraries14() throws Exception { >+ try { >+ Util.createJar( >+ new String[0], >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n" + >+ "Class-Path: nonExisting.jar\n", >+ }, >+ getExternalResourcePath("lib1.jar"), >+ JavaCore.VERSION_1_4); >+ ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P", getExternalResourcePath("lib1.jar")})); >+ IJavaProject p = createJavaProject("P", new String[0], new String[] {"org.eclipse.jdt.core.tests.model.TEST_CONTAINER"}, ""); >+ assertMarkers( >+ "Unexpected markers", >+ "", >+ p); >+ } finally { >+ deleteProject("P"); >+ deleteExternalResource("lib1.jar"); >+ } >+} >+/* > * Ensures that a marker is removed if adding an internal jar that is on the classpath in another project > * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=213723 ) > */ >Index: src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java,v >retrieving revision 1.224 >diff -u -r1.224 AbstractJavaModelTests.java >--- src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java 9 Oct 2008 11:55:20 -0000 1.224 >+++ src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java 16 Oct 2008 09:17:19 -0000 >@@ -1756,8 +1756,8 @@ > return new File(getExternalPath(), relativePath); > } > >- protected String getExternalResourcePath(String name) { >- return getExternalPath() + name; >+ protected String getExternalResourcePath(String relativePath) { >+ return getExternalPath() + relativePath; > } > > /**
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 250946
: 115233