Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 35349 invoked from network); 24 May 2004 16:38:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 24 May 2004 16:38:47 -0000 Received: (qmail 61975 invoked by uid 500); 24 May 2004 10:57:21 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 50961 invoked by uid 500); 24 May 2004 10:54:12 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: users@cocoon.apache.org Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 35977 invoked by uid 98); 24 May 2004 10:49:33 -0000 Received: from H.vanderLinden@MI.unimaas.nl by hermes.apache.org by uid 82 with qmail-scanner-1.20 (clamuko: 0.70. Clear:RC:0(137.120.1.4):. Processed in 0.278361 secs); 24 May 2004 10:49:33 -0000 X-Qmail-Scanner-Mail-From: H.vanderLinden@MI.unimaas.nl via hermes.apache.org X-Qmail-Scanner: 1.20 (Clear:RC:0(137.120.1.4):. Processed in 0.278361 secs) Received: from unknown (HELO um0004.unimaas.nl) (137.120.1.4) by hermes.apache.org with SMTP; 24 May 2004 10:49:32 -0000 Received: by um0004.unimaas.nl (Postfix, from userid 508) id 858A2501D5; Mon, 24 May 2004 12:49:31 +0200 (CEST) Received: from mail011.unimaas.nl (mail011.unimaas.nl [137.120.1.42]) by um0004.unimaas.nl (Postfix) with ESMTP id 7CDAD50035 for ; Mon, 24 May 2004 12:49:30 +0200 (CEST) Received: by mail011.unimaas.nl with Internet Mail Service (5.5.2653.19) id ; Mon, 24 May 2004 12:49:32 +0200 Message-ID: From: H.vanderLinden@MI.unimaas.nl To: users@cocoon.apache.org Subject: RE: write function in flowscript Date: Mon, 24 May 2004 12:49:30 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C4417C.CA8991A0" X-UM-Spam-DCC: xmailer: um0004 1192; Body=1 Fuz1=1 Fuz2=1 X-UM-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on um0004.unimaas.nl X-UM-Spam-Level: X-UM-Spam-Status: No, hits=-0.7 required=5.0 tests=AWL,BAYES_44,HTML_MESSAGE, NO_REAL_NAME autolearn=no version=2.63 X-Spam-Rating: hermes.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N ------_=_NextPart_001_01C4417C.CA8991A0 Content-Type: text/plain Hi, I notice you reuse the parameter name for a variable later. If I'm correct the first assignment determines more or less the datatype of the variable. Could that be the problem? HTH Bye, Helma -----Original Message----- From: Steve [mailto:coconaka@excite.com] Sent: Monday, 24 May 2004 05:57 To: users@cocoon.apache.org Subject: write function in flowscript The problem was that i was printing in the log before form.showForm().So the sel list value was not getting printed. I have another query. I want to copy one file to another location. I have written a function for that. Below is that function:- function copyFiles(srcFile,destFile){ try{ var inputFile = new Packages.java.io.File(srcFile); var outputFile = new Packages.java.io.File(destFile); cocoon.log.info("Input File is "+inputFile); cocoon.log.info("Output File is "+outputFile); var fileInSt = new Packages.java.io.FileInputStream(inputFile); var buffInSt = new Packages.java.io.BufferedInputStream(fileInSt); var sourceFile = new Packages.java.io.DataInputStream(buffInSt); var destFile = new Packages.java.io.BufferedOutputStream(new Packages.java.io.FileOutputStream(ou tputFile)); }catch(e){ cocoon.log.info("File Exception"); } var read = 0; do{ read = sourceFile.read(); destFile.write(read); destFile.flush(); }while(read != -1); destFile.close(); sourceFile.close(); } Cocoon throws an error as follows;- An Error Occurred write is not a function. org.apache.avalon.framework.CascadingRuntimeException: write is not a function. Can anyone tell me why is that so? I tried using destFile["write"](read); But it says syntax error. Please help me in locating the error. _____ Join Excite! - http://www.excite.com The most personalized portal on the Web! ------_=_NextPart_001_01C4417C.CA8991A0 Content-Type: text/html Message
Hi,
 
I notice you reuse the parameter name for a variable later. If I'm correct the first assignment determines more or less the datatype of the variable. Could that be the problem?
 
HTH
 
Bye, Helma
-----Original Message-----
From: Steve [mailto:coconaka@excite.com]
Sent: Monday, 24 May 2004 05:57
To: users@cocoon.apache.org
Subject: write function in flowscript


The problem was that i was printing in the log before form.showForm().So the sel list value was not getting printed.

I have another query. I want to copy one file to another location. I have written a function for that.

Below is that function:-

function copyFiles(srcFile,destFile){
try{
var inputFile = new Packages.java.io.File(srcFile);
var outputFile = new Packages.java.io.File(destFile);


cocoon.log.info("Input File is "+inputFile);
cocoon.log.info("Output File is "+outputFile);

var fileInSt = new Packages.java.io.FileInputStream(inputFile);
var buffInSt = new Packages.java.io.BufferedInputStream(fileInSt);
var sourceFile = new Packages.java.io.DataInputStream(buffInSt);
var destFile = new Packages.java.io.BufferedOutputStream(new Packages.java.io.FileOutputStream(ou tputFile));

}catch(e){

cocoon.log.info("File Exception");
}
var read = 0;
do{
read = sourceFile.read();
destFile.write(read);
destFile.flush();
}while(read != -1);

destFile.close();
sourceFile.close();
}

Cocoon throws an error as follows;-

An Error Occurred

write is not a function.

org.apache.avalon.framework.CascadingRuntimeException: write is not a function.

Can anyone tell me why is that so?

I tried using destFile["write"](read);

But it says syntax error.

Please help me in locating the error.



Join Excite! - http://www.excite.com
The most personalized portal on the Web!
------_=_NextPart_001_01C4417C.CA8991A0--