Skip to content

Commit c0b574f

Browse files
committed
Provide proper ELEMENT_DOES_NOT_EXIST code on missing jar files
This allows callers like JavaElementImageProvider or ClassFileEditor to ignore and do not log bunch of errors caused by a single missing jar file. See eclipse-jdt/eclipse.jdt.ui#2245
1 parent c098dce commit c0b574f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
import java.io.*;
2929
import java.net.URI;
30+
import java.nio.file.NoSuchFileException;
3031
import java.text.MessageFormat;
3132
import java.time.Instant;
3233
import java.util.*;
@@ -2988,7 +2989,11 @@ public ZipFile getZipFile(IPath path, boolean checkInvalidArchiveCache) throws C
29882989
// file may exist but for some reason is inaccessible
29892990
ArchiveValidity reason=ArchiveValidity.INVALID;
29902991
addInvalidArchive(path, reason);
2991-
throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Messages.status_IOException, e));
2992+
int code = -1;
2993+
if(e instanceof FileNotFoundException || e instanceof NoSuchFileException) {
2994+
code = IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST;
2995+
}
2996+
throw new JavaModelException(new JavaModelStatus(code, e));
29922997
}
29932998
}
29942999

0 commit comments

Comments
 (0)