I figured out a way around this problem, using the JavaCast() function:
<cfset myVar = 2 /> <cfset myOtherVar = JavaCast("string",myVar + 1) /> <cffile action="write" file="#filePath#" output="#myOtherVar#" addnewline="no" /> andy > -----Original Message----- > From: Chris Kief [mailto:[EMAIL PROTECTED]] > Sent: Sunday, October 13, 2002 2:00 AM > To: CF-Talk > Subject: RE: Possible cffile bug in CFMX > > > Thanks for the response Lee. I'm glad I'm not the only one who is seeing > this. > > I tried the following as a workaround and cffile worked as expected: > > <cfscript> > // create myVar > myVar = 1; > // add 1 to myVar > myOtherVar = myVar + 1; > // java casting error workaround > // this will force CF to cast myOtherVar back into a string > myOtherVar = "x#myOtherVar#"; > myOtherVar = replace(myOtherVar,"x","","all"); > </cfscript> > > chris > > > -----Original Message----- > From: Lee Fuller [mailto:[EMAIL PROTECTED]] > Sent: Saturday, October 12, 2002 10:39 PM > To: CF-Talk > Subject: RE: Possible cffile bug in CFMX > > That's interesting. > > Almost as if it's reverse type casting. Odd. > > Don't have the answer. But it's truly odd. > > > > | -----Original Message----- > | From: Chris Kief [mailto:[EMAIL PROTECTED]] > | Sent: Saturday, October 12, 2002 10:30 PM > | To: CF-Talk > | Subject: RE: Possible cffile bug in CFMX > | > | > | I should note... > | > | Including ANY additional text in output="" along with the > | variable will cause cffile to work as expected. (i.e. > | output="X#myOtherVar#") > | > | chris > | > | > | > | -----Original Message----- > | From: Chris Kief [mailto:[EMAIL PROTECTED]] > | Sent: Saturday, October 12, 2002 10:26 PM > | To: CF-Talk > | Subject: Possible cffile bug in CFMX > | > | This may be a simple error on my part or a bug in CFMX: > | > | The following code simply creates a variable with the value > | of 2 and writes it to a file...this works fine: > | > | <cfset myVar = 2 /> > | > | <cffile action="write" file="#filePath#" output="#myVar#" > | addnewline="no" /> > | > | > | > | The follwing code creates the same variable, adds 1 to it, > | and writes the the result to a file...this DOESN'T work: > | > | <cfset myVar = 2 /> > | > | <cfset myOtherVar = myVar + 1 /> > | > | <cffile action="write" file="#filePath#" > | output="#myOtherVar#" addnewline="no" /> > | > | > | > | This code fails with the following error: > | > | Error casting an object of type java.lang.Double to an > | incompatible type. This usually indicates a programming error > | in Java, although it could also mean you have tried to use a > | foreign object in a different way than it was designed. > | java.lang.Double > | > | Any insights in to what this may be?? > | > | TIA, > | chris > | > | > | > | > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com