diff --git a/jdt-patch/e416/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java b/jdt-patch/e416/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java index a848b11794..294d5803a6 100644 --- a/jdt-patch/e416/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java +++ b/jdt-patch/e416/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java @@ -14,6 +14,7 @@ import java.io.IOException; import java.net.URI; import java.nio.file.DirectoryStream; +import java.nio.file.FileSystemAlreadyExistsException; import java.nio.file.FileSystemNotFoundException; import java.nio.file.FileSystems; import java.nio.file.FileVisitResult; @@ -120,7 +121,11 @@ public void initialize() throws IOException { } if (this.fs == null) { HashMap env = new HashMap<>(); - this.fs = FileSystems.newFileSystem(uri, env); + try { + this.fs = FileSystems.newFileSystem(uri, env); + } catch (FileSystemAlreadyExistsException e) { + this.fs = FileSystems.getFileSystem(uri); + } } this.releasePath = this.fs.getPath("/"); //$NON-NLS-1$ if (!Files.exists(this.fs.getPath(this.releaseInHex))) { @@ -130,7 +135,7 @@ public void initialize() throws IOException { } @Override public void loadModules() { - // Modules below level 8 are not dealt with here. Leave it to ClasspathJrt + // Modules below level 9 are not dealt with here. Leave it to ClasspathJrt if (this.jdklevel <= ClassFileConstants.JDK1_8) { super.loadModules(); return; @@ -191,7 +196,7 @@ public FileVisitResult postVisitDirectory(java.nio.file.Path dir, IOException ex } @Override void acceptModule(ClassFileReader reader, Map cache) { - // Modules below level 8 are not dealt with here. Leave it to ClasspathJrt + // Modules below level 9 are not dealt with here. Leave it to ClasspathJrt if (this.jdklevel <= ClassFileConstants.JDK1_8) { super.acceptModule(reader, cache); return; @@ -259,15 +264,6 @@ public FileVisitResult postVisitDirectory(java.nio.file.Path dir, IOException ex return singletonModuleNameIf(this.packageCache.contains(qualifiedPackageName)); } @Override - public void reset() { - try { - super.reset(); - this.fs.close(); - } catch (IOException e) { - // Move on - } - } - @Override public String toString() { return "Classpath for JEP 247 for JDK " + this.file.getPath(); //$NON-NLS-1$ } diff --git a/jdt-patch/e417/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java b/jdt-patch/e417/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java index a848b11794..294d5803a6 100644 --- a/jdt-patch/e417/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java +++ b/jdt-patch/e417/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java @@ -14,6 +14,7 @@ import java.io.IOException; import java.net.URI; import java.nio.file.DirectoryStream; +import java.nio.file.FileSystemAlreadyExistsException; import java.nio.file.FileSystemNotFoundException; import java.nio.file.FileSystems; import java.nio.file.FileVisitResult; @@ -120,7 +121,11 @@ public void initialize() throws IOException { } if (this.fs == null) { HashMap env = new HashMap<>(); - this.fs = FileSystems.newFileSystem(uri, env); + try { + this.fs = FileSystems.newFileSystem(uri, env); + } catch (FileSystemAlreadyExistsException e) { + this.fs = FileSystems.getFileSystem(uri); + } } this.releasePath = this.fs.getPath("/"); //$NON-NLS-1$ if (!Files.exists(this.fs.getPath(this.releaseInHex))) { @@ -130,7 +135,7 @@ public void initialize() throws IOException { } @Override public void loadModules() { - // Modules below level 8 are not dealt with here. Leave it to ClasspathJrt + // Modules below level 9 are not dealt with here. Leave it to ClasspathJrt if (this.jdklevel <= ClassFileConstants.JDK1_8) { super.loadModules(); return; @@ -191,7 +196,7 @@ public FileVisitResult postVisitDirectory(java.nio.file.Path dir, IOException ex } @Override void acceptModule(ClassFileReader reader, Map cache) { - // Modules below level 8 are not dealt with here. Leave it to ClasspathJrt + // Modules below level 9 are not dealt with here. Leave it to ClasspathJrt if (this.jdklevel <= ClassFileConstants.JDK1_8) { super.acceptModule(reader, cache); return; @@ -259,15 +264,6 @@ public FileVisitResult postVisitDirectory(java.nio.file.Path dir, IOException ex return singletonModuleNameIf(this.packageCache.contains(qualifiedPackageName)); } @Override - public void reset() { - try { - super.reset(); - this.fs.close(); - } catch (IOException e) { - // Move on - } - } - @Override public String toString() { return "Classpath for JEP 247 for JDK " + this.file.getPath(); //$NON-NLS-1$ } diff --git a/jdt-patch/e418/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java b/jdt-patch/e418/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java index 3e67ec9078..3f5a0e7020 100644 --- a/jdt-patch/e418/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java +++ b/jdt-patch/e418/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java @@ -14,6 +14,7 @@ import java.io.IOException; import java.net.URI; import java.nio.file.DirectoryStream; +import java.nio.file.FileSystemAlreadyExistsException; import java.nio.file.FileSystemNotFoundException; import java.nio.file.FileSystems; import java.nio.file.FileVisitResult; @@ -120,7 +121,11 @@ public void initialize() throws IOException { } if (this.fs == null) { HashMap env = new HashMap<>(); - this.fs = FileSystems.newFileSystem(uri, env); + try { + this.fs = FileSystems.newFileSystem(uri, env); + } catch (FileSystemAlreadyExistsException e) { + this.fs = FileSystems.getFileSystem(uri); + } } this.releasePath = this.fs.getPath("/"); //$NON-NLS-1$ if (!Files.exists(this.fs.getPath(this.releaseInHex))) { @@ -130,7 +135,7 @@ public void initialize() throws IOException { } @Override public void loadModules() { - // Modules below level 8 are not dealt with here. Leave it to ClasspathJrt + // Modules below level 9 are not dealt with here. Leave it to ClasspathJrt if (this.jdklevel <= ClassFileConstants.JDK1_8) { super.loadModules(); return; @@ -191,7 +196,7 @@ public FileVisitResult postVisitDirectory(java.nio.file.Path dir, IOException ex } @Override void acceptModule(ClassFileReader reader, Map cache) { - // Modules below level 8 are not dealt with here. Leave it to ClasspathJrt + // Modules below level 9 are not dealt with here. Leave it to ClasspathJrt if (this.jdklevel <= ClassFileConstants.JDK1_8) { super.acceptModule(reader, cache); return; @@ -262,15 +267,6 @@ public FileVisitResult postVisitDirectory(java.nio.file.Path dir, IOException ex return singletonModuleNameIf(this.packageCache.contains(qualifiedPackageName)); } @Override - public void reset() { - try { - super.reset(); - this.fs.close(); - } catch (IOException e) { - // Move on - } - } - @Override public String toString() { return "Classpath for JEP 247 for JDK " + this.file.getPath(); //$NON-NLS-1$ } diff --git a/jdt-patch/e419/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java b/jdt-patch/e419/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java index 3e67ec9078..3f5a0e7020 100644 --- a/jdt-patch/e419/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java +++ b/jdt-patch/e419/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java @@ -14,6 +14,7 @@ import java.io.IOException; import java.net.URI; import java.nio.file.DirectoryStream; +import java.nio.file.FileSystemAlreadyExistsException; import java.nio.file.FileSystemNotFoundException; import java.nio.file.FileSystems; import java.nio.file.FileVisitResult; @@ -120,7 +121,11 @@ public void initialize() throws IOException { } if (this.fs == null) { HashMap env = new HashMap<>(); - this.fs = FileSystems.newFileSystem(uri, env); + try { + this.fs = FileSystems.newFileSystem(uri, env); + } catch (FileSystemAlreadyExistsException e) { + this.fs = FileSystems.getFileSystem(uri); + } } this.releasePath = this.fs.getPath("/"); //$NON-NLS-1$ if (!Files.exists(this.fs.getPath(this.releaseInHex))) { @@ -130,7 +135,7 @@ public void initialize() throws IOException { } @Override public void loadModules() { - // Modules below level 8 are not dealt with here. Leave it to ClasspathJrt + // Modules below level 9 are not dealt with here. Leave it to ClasspathJrt if (this.jdklevel <= ClassFileConstants.JDK1_8) { super.loadModules(); return; @@ -191,7 +196,7 @@ public FileVisitResult postVisitDirectory(java.nio.file.Path dir, IOException ex } @Override void acceptModule(ClassFileReader reader, Map cache) { - // Modules below level 8 are not dealt with here. Leave it to ClasspathJrt + // Modules below level 9 are not dealt with here. Leave it to ClasspathJrt if (this.jdklevel <= ClassFileConstants.JDK1_8) { super.acceptModule(reader, cache); return; @@ -262,15 +267,6 @@ public FileVisitResult postVisitDirectory(java.nio.file.Path dir, IOException ex return singletonModuleNameIf(this.packageCache.contains(qualifiedPackageName)); } @Override - public void reset() { - try { - super.reset(); - this.fs.close(); - } catch (IOException e) { - // Move on - } - } - @Override public String toString() { return "Classpath for JEP 247 for JDK " + this.file.getPath(); //$NON-NLS-1$ } diff --git a/jdt-patch/e420/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java b/jdt-patch/e420/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java index 18c86a573a..3f5a0e7020 100644 --- a/jdt-patch/e420/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java +++ b/jdt-patch/e420/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java @@ -14,6 +14,7 @@ import java.io.IOException; import java.net.URI; import java.nio.file.DirectoryStream; +import java.nio.file.FileSystemAlreadyExistsException; import java.nio.file.FileSystemNotFoundException; import java.nio.file.FileSystems; import java.nio.file.FileVisitResult; @@ -120,7 +121,11 @@ public void initialize() throws IOException { } if (this.fs == null) { HashMap env = new HashMap<>(); - this.fs = FileSystems.newFileSystem(uri, env); + try { + this.fs = FileSystems.newFileSystem(uri, env); + } catch (FileSystemAlreadyExistsException e) { + this.fs = FileSystems.getFileSystem(uri); + } } this.releasePath = this.fs.getPath("/"); //$NON-NLS-1$ if (!Files.exists(this.fs.getPath(this.releaseInHex))) { @@ -262,15 +267,6 @@ public FileVisitResult postVisitDirectory(java.nio.file.Path dir, IOException ex return singletonModuleNameIf(this.packageCache.contains(qualifiedPackageName)); } @Override - public void reset() { - try { - super.reset(); - this.fs.close(); - } catch (IOException e) { - // Move on - } - } - @Override public String toString() { return "Classpath for JEP 247 for JDK " + this.file.getPath(); //$NON-NLS-1$ }