diff --git a/core/src/main/java/lucee/commons/io/res/type/file/FileResource.java b/core/src/main/java/lucee/commons/io/res/type/file/FileResource.java index 578d4ec471..449f4e4064 100644 --- a/core/src/main/java/lucee/commons/io/res/type/file/FileResource.java +++ b/core/src/main/java/lucee/commons/io/res/type/file/FileResource.java @@ -137,12 +137,24 @@ public Resource getAbsoluteResource() { @Override public Resource getCanonicalResource() throws IOException { - // java 12 performance regression LDEV-5218 - if (SystemUtil.JAVA_VERSION > SystemUtil.JAVA_VERSION_11 ) - return new FileResource(provider, Path.of(getPath()).toAbsolutePath().normalize().toString()); return new FileResource(provider, getCanonicalPath()); } + public String getCanonicalPath() { + try { + // java 12 performance regression LDEV-5218 + if (SystemUtil.JAVA_VERSION > SystemUtil.JAVA_VERSION_11 ) + return Path.of(getPath()).toAbsolutePath().normalize().toString(); + return super.getCanonicalPath(); + } + catch (IOException e) { + return getAbsolutePath(); + } + catch (java.nio.file.InvalidPathException ipe) { + return getPath(); + } + } + @Override public Resource getParentResource() { String p = getParent(); diff --git a/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java b/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java index cb9b533acf..945168c78e 100755 --- a/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java +++ b/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java @@ -770,6 +770,8 @@ public static Resource getCanonicalResourceEL(Resource res) { public static File getCanonicalFileEL(File file) { if (file == null) return file; try { + if (SystemUtil.JAVA_VERSION > SystemUtil.JAVA_VERSION_11 ) + return file.getAbsoluteFile(); return file.getCanonicalFile(); } catch (IOException e) { diff --git a/loader/build.xml b/loader/build.xml index 7036c23210..8bf332bbc0 100644 --- a/loader/build.xml +++ b/loader/build.xml @@ -2,7 +2,7 @@ - + diff --git a/loader/pom.xml b/loader/pom.xml index bcbb01592e..2c0618b221 100644 --- a/loader/pom.xml +++ b/loader/pom.xml @@ -3,7 +3,7 @@ org.lucee lucee - 6.2.0.232-SNAPSHOT + 6.2.0.233-SNAPSHOT jar Lucee Loader Build