Skip to content

Commit

Permalink
double check existence before throwing an exception
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Oct 8, 2024
1 parent 864dc92 commit 8495e7a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ public OutputStream getOutputStream(boolean append) throws IOException {
provider.lock(this);
try {
if (!super.exists() && !super.createNewFile()) {
throw new IOException("Can't create file [" + this + "]");
// It's possible that another process (outside this JVM) has already created the file
// after our initial check, so we perform a double check before throwing an exception.
if (!super.exists()) throw new IOException("Can't create file [" + this + "]");
}
return new BufferedOutputStream(new ResourceOutputStream(this, new FileOutputStream(this, append)));
}
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.0.4.9-SNAPSHOT"/>
<property name="version" value="6.0.4.10-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.0.4.9-SNAPSHOT</version>
<version>6.0.4.10-SNAPSHOT</version>
<packaging>jar</packaging>

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

0 comments on commit 8495e7a

Please sign in to comment.