diff options
author | Andrey Loskutov | 2021-07-13 18:41:56 +0000 |
---|---|---|
committer | Andrey Loskutov | 2021-07-13 21:14:45 +0000 |
commit | 1b756cc2eb17dc864ba5965d33c28e97092e2796 (patch) | |
tree | 49763fcb85536f2cf996e898b71b0afff0b2ba14 | |
parent | d47a2c18edd89fe4c60fe26ed41fddf623164d7a (diff) | |
download | eclipse.jdt.core-1b756cc2eb17dc864ba5965d33c28e97092e2796.tar.gz eclipse.jdt.core-1b756cc2eb17dc864ba5965d33c28e97092e2796.tar.xz eclipse.jdt.core-1b756cc2eb17dc864ba5965d33c28e97092e2796.zip |
Bug 574450 - ClosedFileSystemException in multi-threaded maven build
- don't close ct.sym file system, it could be used in other threads
- re-try getFileSystem() after FileSystemAlreadyExistsException - the
file system could be created by other thread after the first check
Change-Id: I172e48b055ddbf66f0b5f2e2372b8f90abe0c3fc
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Reviewed-on: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/183030
Tested-by: JDT Bot <jdt-bot@eclipse.org>
-rw-r--r-- | org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java index 18c86a573a..2b0054f1cf 100644 --- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java +++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java @@ -14,6 +14,7 @@ import java.io.File; 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 class ClasspathJep247 extends ClasspathJrt { } if (this.fs == null) { HashMap<String, ?> 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))) { @@ -261,15 +266,7 @@ public class ClasspathJep247 extends ClasspathJrt { } 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$ |