diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java index 3a0d3cd2bbd..fffaea3908d 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java @@ -310,12 +310,7 @@ public char[] normalizedPath() { @Override public String getPath() { if (this.path == null) { - try { - this.path = this.file.getCanonicalPath(); - } catch (IOException e) { - // in case of error, simply return the absolute path - this.path = this.file.getAbsolutePath(); - } + this.path = this.file.toPath().normalize().toAbsolutePath().toString(); } return this.path; } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJrt.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJrt.java index 7d4d428e1fb..e688dbeffb8 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJrt.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJrt.java @@ -339,12 +339,7 @@ public char[] normalizedPath() { @Override public String getPath() { if (this.path == null) { - try { - this.path = this.file.getCanonicalPath(); - } catch (IOException e) { - // in case of error, simply return the absolute path - this.path = this.file.getAbsolutePath(); - } + this.path = this.file.toPath().normalize().toAbsolutePath().toString(); } return this.path; } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/Main.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/Main.java index aa14a6cc1d1..b37e250d2e3 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/Main.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/Main.java @@ -475,13 +475,9 @@ public void logClassFile(boolean generatePackagesStructure, String outputPath, S } } File f = new File(fileName); - try { - HashMap parameters = new HashMap<>(); - parameters.put(Logger.PATH, f.getCanonicalPath()); - printTag(Logger.CLASS_FILE, parameters, true, true); - } catch (IOException e) { - logNoClassFileCreated(outputPath, relativeFileName, e); - } + HashMap parameters = new HashMap<>(); + parameters.put(Logger.PATH, f.toPath().normalize().toAbsolutePath().toString()); + printTag(Logger.CLASS_FILE, parameters, true, true); } } public void logClasspath(FileSystem.Classpath[] classpaths) {