diff options
author | Stephane | 2020-09-22 18:59:56 +0000 |
---|---|---|
committer | Andrey Loskutov | 2020-09-23 08:16:14 +0000 |
commit | ee6646cb572cde97a576ccf8d32524fc4584f1c3 (patch) | |
tree | b961263fde0431b5dee003a7ea45fe5f9c0825b3 | |
parent | e7fbffe57eba5cf25acd0a5514843b11cfe75c98 (diff) | |
download | eclipse.jdt.core-ee6646cb572cde97a576ccf8d32524fc4584f1c3.tar.gz eclipse.jdt.core-ee6646cb572cde97a576ccf8d32524fc4584f1c3.tar.xz eclipse.jdt.core-ee6646cb572cde97a576ccf8d32524fc4584f1c3.zip |
Bug 566493 - Unable to compile when using maven multi-thread option (ex:
-T6)
Fix a race condition when using FileSystems that occurs when ecj is building project classpath and using parallelism
Change-Id: Ieb8f190c8f93ce861825a10ef8231d7f838b8b77
Signed-off-by: Stephane <eclipse@najdan.com>
-rw-r--r-- | org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathMultiReleaseJar.java | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathMultiReleaseJar.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathMultiReleaseJar.java index 2a108c0e9c..cf8d7b69d5 100644 --- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathMultiReleaseJar.java +++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathMultiReleaseJar.java @@ -4,7 +4,7 @@ import java.io.File; import java.io.IOException; import java.net.URI; import java.nio.file.DirectoryStream; -import java.nio.file.FileSystemNotFoundException; +import java.nio.file.FileSystemAlreadyExistsException; import java.nio.file.FileSystems; import java.nio.file.FileVisitResult; import java.nio.file.FileVisitor; @@ -42,18 +42,12 @@ public class ClasspathMultiReleaseJar extends ClasspathJar { URI t = this.file.toURI(); if (this.file.exists()) { URI uri = URI.create("jar:file:" + t.getRawPath()); //$NON-NLS-1$ + try { - this.fs = FileSystems.getFileSystem(uri); - } catch(FileSystemNotFoundException fne) { - // Ignore and move on - } - if (this.fs == null) { HashMap<String, ?> env = new HashMap<>(); - try { - this.fs = FileSystems.newFileSystem(uri, env); - } catch (IOException e) { - // return - } + this.fs = FileSystems.newFileSystem(uri, env); + } catch (FileSystemAlreadyExistsException e) { + this.fs = FileSystems.getFileSystem(uri); } this.releasePath = this.fs.getPath("/", "META-INF", "versions", this.compliance); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ if (!Files.exists(this.releasePath)) { |