error with application.writeFile() on Servoy 2.1.1

I have the following code wich worked perfect on servoy 2.1
Ive tested on Servoy 2.1.1 and I get an error.

The method is:

//Downloads file with FTP, and saves it to a global
elements.bean_148c.ftpConnect("xx.xx.xx.xx", "user", "pass");
globals.blob1 = elements.bean_148c.getBinaryFile("abc.txt");
 
//Saves the file in a temp file on disk
var tempFile = application.createTempFile("abc",".txt");

application.writeFile(tempFile,globals.blob1);

// When executing the last line I get an error like this:
//
//java.lang.ClassCastException
//java.lang.ClassCastException
//        at com.servoy.j2db.scripting.k.get(Unknown Source)
//        at com.servoy.j2db.scripting.d.get(Unknown Source)
//        at org.mozilla.javascript.ScriptRuntime.getProp
ScriptRuntime.java:714)
//        at 
org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1821)
//        at 
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
//        at com.servoy.j2db.scripting.e.call(Unknown Source)
//        at com.servoy.j2db.develop.debugger.n.a(Unknown Source)
//        at com.servoy.j2db.develop.debugger.n.executeFunction(Unknown 
Source)
//        at com.servoy.j2db.FormPanel.a(Unknown Source)
//        at com.servoy.j2db.FormPanel.a(Unknown Source)
//        at com.servoy.j2db.FormPanel$b.actionPerformed(Unknown Source)
//        at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
//        at 
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown 
Source)
//        at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown 
Source)
//        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
//        at 
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
//        at java.awt.Component.processMouseEvent(Unknown Source)
//        at java.awt.Component.processEvent(Unknown Source)
//        at java.awt.Container.processEvent(Unknown Source)
//        at java.awt.Component.dispatchEventImpl(Unknown Source)
//        at java.awt.Container.dispatchEventImpl(Unknown Source)
//        at java.awt.Component.dispatchEvent(Unknown Source)
//        at 
javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.repostEvent(Unknown 
Source)
//        at 
javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.mouseReleased(Unknown 
Source)
//        at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
//        at java.awt.Component.processMouseEvent(Unknown Source)
//        at java.awt.Component.processEvent(Unknown Source)
//        at java.awt.Container.processEvent(Unknown Source)
//        at java.awt.Component.dispatchEventImpl(Unknown Source)
//        at java.awt.Container.dispatchEventImpl(Unknown Source)
//        at java.awt.Component.dispatchEvent(Unknown Source)
//        at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown 
Source)
//        at java.awt.LightweightDispatcher.processMouseEvent(Unknown 
Source)
//        at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
//        at java.awt.Container.dispatchEventImpl(Unknown Source)
//        at java.awt.Window.dispatchEventImpl(Unknown Source)
//        at java.awt.Component.dispatchEvent(Unknown Source)
//        at java.awt.EventQueue.dispatchEvent(Unknown Source)
//        at 
java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
//        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown 
Source)
//        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
//        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
//        at java.awt.EventDispatchThread.run(Unknown Source)

[/code]

this is a bug, have fixed it for 2.1.2
For now please try to store it in the form scope it self (so not through a global)

var blob = bean.xxxx.getBinaryFile();
applicaiton.writeFile(file,blob)

Perfect it worked fine !!! :lol:
Thanks