cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Sparkes <pe...@didm.co.uk>
Subject Re: Flowscript - delete file
Date Thu, 27 Dec 2012 17:12:08 GMT
Hi Martin

Thanks for your suggestion, unfortunately I get the same  error. The error log gives:

ERROR (2012-12-27) 15:30.46:723 [flow] (/office/deletefile_9999) PoolThread-4/JSErrorReporter:

"file:///D:/cocoon-2.1.11-wl/build/webapp/office/flow/deletefile.js", line 13: missing name
after . 
operator
ERROR (2012-12-27) 15:30.46:723 [sitemap.handled-errors] (/office/deletefile_9999) 
PoolThread-4/ErrorHandlerHelper: Sitemap: error calling function 'deletefile'
     at <map:call> - file:///D:/cocoon-2.1.11-wl/build/webapp/office/sitemap.xmap:230:37
     at <map:mount> - file:///D:/cocoon-2.1.11-wl/build/webapp/sitemap.xmap:783:90
org.mozilla.javascript.EvaluatorException: 
"file:///D:/cocoon-2.1.11-wl/build/webapp/office/flow/deletefile.js", line 1: Compilation
produced 1 
syntax errors.
     at 
org.apache.cocoon.components.flow.javascript.JSErrorReporter.runtimeError(JSErrorReporter.java:67)

regards

Peter


On 27/12/2012 11:42, Martin Heiden wrote:
> Hi Peter,
>
> PS>              //Delete file
> PS>              Packages.java.io.File.xml_file.delete();
>
> Try
>
> xml_file.delete();
>
> You just have to add the full "path" to the class when you
> construct it. After this, the variable contains a reference and you
> can just use it.
>
> Regards,
>
>    Martin.
>
>
> Thursday, December 27, 2012, 10:28:31 AM, you wrote:
>
> PS> Hi,
>
> PS> I am trying to delete xml files using the following flowscript:
>
> PS>     function deletefile() {
>
> PS>          //file to be deleted
> PS>          var file =
> PS> Packages.java.lang.String(cocoon.parameters["file"]);
>
> PS>          try {
> PS>              // creating a link to the file to be deleted
> PS>              var xml_file =
> PS> Packages.java.io.File("D:\cocoon-2.1.11-wl\build\webapp\B&B\xml" + file
> PS>     + ".xml");
>
> PS>              //Delete file
> PS>              Packages.java.io.File.xml_file.delete();
>
> PS>              //  .txt file with OK message
> PS>              cocoon.sendPage("success.txt", null);
> PS>          }
> PS>          catch(ex){
> PS>              cocoon.log.error(ex);
> PS>              // Smth. went wrong. Sending a error.txt file to the browser
> PS>            cocoon.sendPage("error.txt", null);
> PS>          }
>
> PS>     }
>
> PS> and get "Compilation produced 1 syntax errors"
>
> PS> The error log contains:
>
> PS>     ERROR ............    deletefile.js", line 13: missing name after . operator
>
> PS> line 13 is:
>
> PS>     Packages.java.io.File.xml_file.delete();
>
> PS> What I am doing wrong?
>
> PS> Peter
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


Mime
View raw message