Skip to content

Commit

Permalink
LDEV-4081 - modify FileWrite
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Feb 19, 2024
1 parent 57bd776 commit beed46e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
14 changes: 8 additions & 6 deletions core/src/main/java/lucee/runtime/functions/file/FileWrite.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import lucee.runtime.PageContext;
import lucee.runtime.PageContextImpl;
import lucee.runtime.PageSourcePool;
import lucee.runtime.exp.FunctionException;
import lucee.runtime.exp.PageException;
import lucee.runtime.op.Caster;

Expand All @@ -50,14 +51,15 @@ public static String call(PageContext pc, Object obj, Object data, String charse
res = Caster.toResource(pc, obj, false);
pc.getConfig().getSecurityManager().checkFileLocation(res);
Resource parent = res.getParentResource();
// if (parent != null && !parent.exists()) throw new FunctionException(pc, "FileWrite", 1, "source",
// "parent directory for [" + res + "] doesn't exist");
if (parent != null && !parent.exists()) throw new FunctionException(pc, "FileWrite", 1, "source", "parent directory for [" + res + "] doesn't exist");
fsw = new FileStreamWrapperWrite(res, charset, false, false);
}
fsw.write(data);
}
catch (IOException e) {
throw Caster.toPageException(e);
try {
fsw.write(data);
}
catch (IOException e) {
throw new FunctionException(pc, "FileWrite", 1, "source", "Invalid file [" + Caster.toResource(pc, obj, false) + "]", e.getMessage());
}
}
finally {
if (close) IOUtil.closeEL(fsw);
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.1.0.49-SNAPSHOT"/>
<property name="version" value="6.1.0.50-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.1.0.49-SNAPSHOT</version>
<version>6.1.0.50-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lucee Loader Build</name>
Expand Down
2 changes: 1 addition & 1 deletion test/tickets/LDEV4081.cfc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
component extends="org.lucee.cfml.test.LuceeTestCase" skip="true" {
component extends="org.lucee.cfml.test.LuceeTestCase" {

function run( testResults , testBox ) {
describe( "Test case for LDEV-4081", function() {
Expand Down

0 comments on commit beed46e

Please sign in to comment.