Skip to content

Commit

Permalink
LDEV-5128 improve getCanonicalPath and getCanonicalFileEL
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Dec 19, 2024
1 parent e6cd5a7 commit 6600231
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion loader/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project default="core" basedir="." name="Lucee"
xmlns:resolver="antlib:org.apache.maven.resolver.ant">

<property name="version" value="6.2.0.232-SNAPSHOT"/>
<property name="version" value="6.2.0.233-SNAPSHOT"/>

<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml">
<classpath>
Expand Down
2 changes: 1 addition & 1 deletion loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.lucee</groupId>
<artifactId>lucee</artifactId>
<version>6.2.0.232-SNAPSHOT</version>
<version>6.2.0.233-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lucee Loader Build</name>
Expand Down

0 comments on commit 6600231

Please sign in to comment.