Skip to content

Commit c098dce

Browse files
committed
Fix ClasspathEntry.validateLibraryContents() not reporting broken link
Commit 5450463 added checks for classpath entries, but the check was incomplete. It is possible to set classpath with broken library link without any error. Removed extra check for Messages.status_IOException in the ClasspathEntry.validateLibraryContents(). Any exception during validation of a library is a problem of that library.
1 parent 0eb7ed3 commit c098dce

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7266,7 +7266,12 @@ public void testBug540904() throws CoreException, IOException {
72667266
addLibraryEntry(p2, file.getFullPath(), false);
72677267
getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, null);
72687268
IMarker[] markers = p2.getProject().findMarkers(null, true, IResource.DEPTH_INFINITE);
7269-
assertMarkers("Unexpected markers", "", markers);
7269+
assertMarkers(
7270+
"Should see one marker for missing jar",
7271+
"""
7272+
Archive for required library: 'link.jar' in project 'Bug540904' cannot be read or is not a valid ZIP file
7273+
The project cannot be built until build path errors are resolved""",
7274+
markers);
72707275
} finally {
72717276
this.deleteProject("Bug540904");
72727277
}

org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2548,11 +2548,9 @@ private static IJavaModelStatus validateLibraryContents(IPath path, IJavaProject
25482548
try {
25492549
manager.verifyArchiveContent(path);
25502550
} catch (CoreException e) {
2551-
if (e.getStatus().getMessage() == Messages.status_IOException) {
2552-
return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(
2553-
Messages.classpath_archiveReadError,
2554-
new String[] {entryPathMsg, project.getElementName()}));
2555-
}
2551+
return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(
2552+
Messages.classpath_archiveReadError,
2553+
new String[] {entryPathMsg, project.getElementName()}));
25562554
}
25572555
return JavaModelStatus.VERIFIED_OK;
25582556
}

0 commit comments

Comments
 (0)