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 119358 Details for
Bug 232816
[buildpath] Misleading problem text for missing jar in user library
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch with fix and test
patch.txt (text/plain), 11.74 KB, created by
Srikanth Sankaran
on 2008-12-03 04:01:30 EST
(
hide
)
Description:
Patch with fix and test
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2008-12-03 04:01:30 EST
Size:
11.74 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.builder >Index: src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java,v >retrieving revision 1.51 >diff -u -r1.51 BuildpathTests.java >--- src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java 9 Oct 2008 11:55:22 -0000 1.51 >+++ src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java 3 Dec 2008 06:00:59 -0000 >@@ -17,6 +17,7 @@ > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.*; > import org.eclipse.core.runtime.preferences.IEclipsePreferences; >+import org.eclipse.core.runtime.preferences.InstanceScope; > import org.eclipse.jdt.core.*; > import org.eclipse.jdt.core.compiler.CategorizedProblem; > import org.eclipse.jdt.core.tests.util.AbstractCompilerTest; >@@ -54,6 +55,45 @@ > return jdkLevelProblem.toString(); > } > >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=232816, mention container name in diagnostic, >+// so the connection is more obvious in error messages. >+public void testInaccessibleUserLibrary() throws Exception { >+ >+ // Create new user library "SomeUserLibrary" >+ ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(JavaCore.USER_LIBRARY_CONTAINER_ID); >+ String libraryName = "SomeUserLibrary"; >+ IPath containerPath = new Path(JavaCore.USER_LIBRARY_CONTAINER_ID); >+ UserLibraryClasspathContainer containerSuggestion = new UserLibraryClasspathContainer(libraryName); >+ initializer.requestClasspathContainerUpdate(containerPath.append(libraryName), null, containerSuggestion); >+ >+ // Create java project >+ IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ >+ >+ // Modify user library >+ IEclipsePreferences preferences = new InstanceScope().getNode(JavaCore.PLUGIN_ID); >+ String propertyName = JavaModelManager.CP_USERLIBRARY_PREFERENCES_PREFIX+"SomeUserLibrary"; >+ StringBuffer propertyValue = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<userlibrary systemlibrary=\"false\" version=\"1\">\r\n<archive"); >+ //String jarFullPath = getWorkspaceRoot().getLocation().append(jarFile.getFullPath()).toString(); >+ propertyValue.append(" path=\"" + "c:\\non\\existent\\bogus\\library.jar"); >+ propertyValue.append("\"/>\r\n</userlibrary>\r\n"); >+ preferences.put(propertyName, propertyValue.toString()); >+ preferences.flush(); >+ >+ >+ IClasspathEntry[] entries = env.getJavaProject(projectPath).getRawClasspath(); >+ int length = entries.length; >+ System.arraycopy(entries, 0, entries = new IClasspathEntry[length+1], 0, length); >+ entries[length] = JavaCore.newContainerEntry(containerSuggestion.getPath()); >+ env.getJavaProject(projectPath).setRawClasspath(entries, null); >+ >+ expectingOnlySpecificProblemsFor(projectPath, >+ new Problem[] { >+ new Problem("Build path", "Project 'Project' is missing required library: 'C:\\non\\existent\\bogus\\library.jar' (contained in 'SomeUserLibrary')", projectPath, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR) //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ ); >+ >+} >+ > public void testClasspathFileChange() throws JavaModelException { > // create project with src folder, and alternate unused src2 folder > IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ >#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.193 >diff -u -r1.193 ClasspathTests.java >--- src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 28 Oct 2008 21:25:36 -0000 1.193 >+++ src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 3 Dec 2008 06:01:06 -0000 >@@ -2341,7 +2341,7 @@ > setClasspath(p, new IClasspathEntry[] {JavaCore.newContainerEntry(new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER"))}); > assertMarkers( > "Unexpected markers", >- "Project \'P\' is missing required library: \'"+ getExternalPath() + "nonExisting.jar\'", >+ "Project \'P\' is missing required library: \'"+ getExternalPath() + "nonExisting.jar\' (contained in 'Test container')", > p); > } finally { > 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.109 >diff -u -r1.109 ClasspathEntry.java >--- model/org/eclipse/jdt/internal/core/ClasspathEntry.java 28 Oct 2008 21:25:29 -0000 1.109 >+++ model/org/eclipse/jdt/internal/core/ClasspathEntry.java 3 Dec 2008 06:01:24 -0000 >@@ -1745,6 +1745,10 @@ > * @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 referredByContainer){ >+ return validateClasspathEntry(project, entry, null, checkSourceAttachment, referredByContainer); >+ } >+ >+ private static IJavaModelStatus validateClasspathEntry(IJavaProject project, IClasspathEntry entry, IClasspathContainer entryContainer, boolean checkSourceAttachment, boolean referredByContainer){ > > IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); > IPath path = entry.getPath(); >@@ -1796,7 +1800,7 @@ > if (description == null) description = path.makeRelative().toString(); > return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CP_CONTAINER_ENTRY, project, path); > } >- IJavaModelStatus containerEntryStatus = validateClasspathEntry(project, containerEntry, checkSourceAttachment, true/*referred by container*/); >+ IJavaModelStatus containerEntryStatus = validateClasspathEntry(project, containerEntry, container, checkSourceAttachment, true/*referred by container*/); > if (!containerEntryStatus.isOK()){ > return containerEntryStatus; > } >@@ -1825,7 +1829,7 @@ > } > > // get validation status >- IJavaModelStatus status = validateClasspathEntry(project, entry, checkSourceAttachment, false/*not referred by container*/); >+ IJavaModelStatus status = validateClasspathEntry(project, entry, null, checkSourceAttachment, false/*not referred by container*/); > if (!status.isOK()) return status; > > // return deprecation status if any >@@ -1846,8 +1850,8 @@ > // do not validate entries from Class-Path: in manifest > // (these entries are considered optional since the user cannot act on them) > // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=252392 >- >- IJavaModelStatus status = validateLibraryEntry(path, project, checkSourceAttachment ? entry.getSourceAttachmentPath() : null, entryPathMsg); >+ String containerName = entryContainer != null ? entryContainer.getDescription() : null; >+ IJavaModelStatus status = validateLibraryEntry(path, project, containerName, checkSourceAttachment ? entry.getSourceAttachmentPath() : null, entryPathMsg); > if (!status.isOK()) > return status; > break; >@@ -1916,7 +1920,9 @@ > return JavaModelStatus.VERIFIED_OK; > } > >- private static IJavaModelStatus validateLibraryEntry(IPath path, IJavaProject project, IPath sourceAttachment, String entryPathMsg) { >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=232816, now we have the facility to include a container >+ // name in diagnostics. >+ private static IJavaModelStatus validateLibraryEntry(IPath path, IJavaProject project, String containerName, IPath sourceAttachment, String entryPathMsg) { > if (path.isAbsolute() && !path.isEmpty()) { > Object target = JavaModel.getTarget(path, true); > if (target != null && !JavaCore.IGNORE.equals(project.getOption(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, true))) { >@@ -1955,11 +1961,19 @@ > } else { > boolean isExternal = path.getDevice() != null || !ResourcesPlugin.getWorkspace().getRoot().getProject(path.segment(0)).exists(); > if (isExternal) { >- return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundLibrary, new String[] {path.toOSString(), project.getElementName()})); >+ if (containerName != null) { >+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundLibraryInContainer, new String[] {path.toOSString(), containerName, project.getElementName()})); >+ } else { >+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundLibrary, new String[] {path.toOSString(), project.getElementName()})); >+ } > } else { > if (entryPathMsg == null) > entryPathMsg = project.getElementName().equals(path.segment(0)) ? path.removeFirstSegments(1).makeRelative().toString() : path.toString(); >- return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundLibrary, new String[] {entryPathMsg, project.getElementName()})); >+ if (containerName != null) { >+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundLibraryInContainer, new String[] {entryPathMsg, containerName, project.getElementName()})); >+ } else { >+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundLibrary, new String[] {entryPathMsg, project.getElementName()})); >+ } > } > } > } else { >Index: model/org/eclipse/jdt/internal/core/util/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties,v >retrieving revision 1.73 >diff -u -r1.73 messages.properties >--- model/org/eclipse/jdt/internal/core/util/messages.properties 10 Oct 2008 07:28:57 -0000 1.73 >+++ model/org/eclipse/jdt/internal/core/util/messages.properties 3 Dec 2008 06:01:25 -0000 >@@ -155,6 +155,7 @@ > classpath_mustEndWithSlash = End exclusion filter ''{0}'' with / to fully exclude ''{1}'' > classpath_unboundContainerPath = Unbound classpath container: ''{0}'' in project ''{1}'' > classpath_unboundLibrary = Project ''{1}'' is missing required library: ''{0}'' >+classpath_unboundLibraryInContainer = Project ''{2}'' is missing required library: ''{0}'' (contained in ''{1}'') > classpath_unboundProject = Project ''{1}'' is missing required Java project: ''{0}'' > classpath_settingOutputLocationProgress = Setting output location for: ''{0}'' > classpath_settingProgress = Setting classpath for: {0} >Index: model/org/eclipse/jdt/internal/core/util/Messages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java,v >retrieving revision 1.24 >diff -u -r1.24 Messages.java >--- model/org/eclipse/jdt/internal/core/util/Messages.java 10 Oct 2008 07:28:57 -0000 1.24 >+++ model/org/eclipse/jdt/internal/core/util/Messages.java 3 Dec 2008 06:01:25 -0000 >@@ -159,6 +159,7 @@ > public static String classpath_mustEndWithSlash; > public static String classpath_unboundContainerPath; > public static String classpath_unboundLibrary; >+ public static String classpath_unboundLibraryInContainer; > public static String classpath_unboundProject; > public static String classpath_settingOutputLocationProgress; > public static String classpath_settingProgress;
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 232816
:
119358
|
119607
|
119748