BETA_JAVA9 - Remove wrong JavaModelException usage from compiler code
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java
index a7da686..316e526 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java
@@ -30,7 +30,6 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;
@@ -218,8 +217,8 @@
}
});
- } catch (JavaModelException e) {
- e.printStackTrace();
+ } catch (IOException e) {
+ // Ignore and move on
}
} else {
for (Enumeration e = this.zipFile.entries(); e.hasMoreElements(); ) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java
index 1bc23de..8da179c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java
@@ -46,8 +46,6 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
-import org.eclipse.jdt.core.IJavaModelStatusConstants;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ClassFile;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
@@ -734,9 +732,9 @@
*
* @param image a java.io.File handle to the JRT image.
* @param visitor an instance of JimageVisitor to be notified of the entries in the JRT image.
- * @throws JavaModelException
+ * @throws IOException
*/
- public static void walkModuleImage(File image, final JimageVisitor<java.nio.file.Path> visitor) throws JavaModelException {
+ public static void walkModuleImage(File image, final JimageVisitor<java.nio.file.Path> visitor) throws IOException {
java.nio.file.FileSystem fs = FileSystems.getFileSystem(JRT_URI);
Iterable<java.nio.file.Path> roots = fs.getRootDirectories();
for (java.nio.file.Path path : roots) {
@@ -770,7 +768,7 @@
});
}
} catch (Exception e) {
- throw new JavaModelException(e, IJavaModelStatusConstants.IO_EXCEPTION);
+ throw new IOException(e.getMessage());
}
}
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java
index 2fbda1f..8f8ff7f 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java
@@ -100,20 +100,24 @@
rawPackageInfo.put(CharOperation.NO_STRINGS, new ArrayList[] { EMPTY_LIST, EMPTY_LIST });
if (this.isJimage) {
- org.eclipse.jdt.internal.compiler.util.Util.walkModuleImage(getPath().toFile(),
- new org.eclipse.jdt.internal.compiler.util.Util.JimageVisitor<Path>() {
- @Override
- public FileVisitResult visitPackage(Path dir, BasicFileAttributes attrs) throws IOException {
- initRawPackageInfo(rawPackageInfo, dir.toString(), true, compliance);
- return FileVisitResult.CONTINUE;
- }
+ try {
+ org.eclipse.jdt.internal.compiler.util.Util.walkModuleImage(getPath().toFile(),
+ new org.eclipse.jdt.internal.compiler.util.Util.JimageVisitor<Path>() {
+ @Override
+ public FileVisitResult visitPackage(Path dir, BasicFileAttributes attrs) throws IOException {
+ initRawPackageInfo(rawPackageInfo, dir.toString(), true, compliance);
+ return FileVisitResult.CONTINUE;
+ }
- @Override
- public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) throws IOException {
- initRawPackageInfo(rawPackageInfo, path.toString(), false, compliance);
- return FileVisitResult.CONTINUE;
- }
- });
+ @Override
+ public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) throws IOException {
+ initRawPackageInfo(rawPackageInfo, path.toString(), false, compliance);
+ return FileVisitResult.CONTINUE;
+ }
+ });
+ } catch (IOException e) {
+ // We are not reading any specific Jimage file, so, move on for now
+ }
} else {
jar = getJar();
for (Enumeration e= jar.entries(); e.hasMoreElements();) {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java
index a220764..36f54da 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java
@@ -541,9 +541,8 @@
complianceLevel = jimagePackageNamesAdderVisitor.complianceLevel;
containsADefaultPackage = jimagePackageNamesAdderVisitor.containsADefaultPackage;
containsJavaSource = jimagePackageNamesAdderVisitor.containsJavaSource;
- } catch (JavaModelException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ } catch (IOException e) {
+ // We are not reading any specific Jimage file, so, move on for now
}
} else if (root.isArchive()) {
JavaModelManager manager = JavaModelManager.getJavaModelManager();
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJar.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJar.java
index a115dce..8487309 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJar.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJar.java
@@ -19,7 +19,6 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.*;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;
import org.eclipse.jdt.internal.compiler.env.AccessRuleSet;
@@ -90,8 +89,8 @@
return FileVisitResult.CONTINUE;
}
});
- } catch (JavaModelException e) {
- e.printStackTrace();
+ } catch (IOException e) {
+ // Move on
}
// TODO: What about caching?
} else {
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJimageFileToIndex.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJimageFileToIndex.java
index 6bf40f1..b545c37 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJimageFileToIndex.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJimageFileToIndex.java
@@ -25,7 +25,6 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.compiler.InvalidInputException;
import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.core.search.SearchEngine;
@@ -283,7 +282,7 @@
} finally {
monitor.exitWrite();
}
- } catch (JavaModelException | IOException e ) {
+ } catch (IOException e ) {
if (JobManager.VERBOSE) {
org.eclipse.jdt.internal.core.util.Util.verbose("-> failed to index " + this.containerPath + " because of the following exception:"); //$NON-NLS-1$ //$NON-NLS-2$
e.printStackTrace();