Sidebar

Error Msg: Can't find method java.io.File.renameTo(org.mozilla.javascript.ConsString)

0 votes
1.2K views
asked Jan 28, 2016 by brayton-s-3145 (230 points)
edited Jan 28, 2016 by brayton-s-3145

 

version: 
build: 
address:
2.0.42
5346

 

I am processing some large files and am getting this error from QIE however the channel has not stopped processing.   Should i be concerned?

com.sun.phobos.script.util.ExtendedScriptException: org.mozilla.javascript.EvaluatorException: Can't find method java.io.File.renameTo(org.mozilla.javascript.ConsString). (<Unknown Source>#77) in <Unknown Source> at line number 77 

     at com.sun.phobos.script.javascript.RhinoCompiledScript.eval(RhinoCompiledScript.java:68) 

     at javax.script.CompiledScript.eval(Unknown Source) 

     at com.qvera.qie.utils.message.ChannelNodeHelper.runScript(ChannelNodeHelper.java:1015) 

     at com.qvera.qie.engine.in.CustomReceiver.checkForMessage(CustomReceiver.java:50) 

     at com.qvera.qie.engine.in.Receiver.scheduledCheckForMessage(Receiver.java:363) 

     at com.qvera.qie.engine.in.Receiver.run(Receiver.java:217) 

     at java.lang.Thread.run(Unknown Source) 

    Caused by: org.mozilla.javascript.EvaluatorException: Can't find method java.io.File.renameTo(org.mozilla.javascript.ConsString). (<Unknown Source>#77) 

     at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:77) 

     at org.mozilla.javascript.Context.reportRuntimeError(Context.java:926) 

     at org.mozilla.javascript.Context.reportRuntimeError(Context.java:982) 

     at org.mozilla.javascript.Context.reportRuntimeError1(Context.java:945) 

     at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:144) 

     at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32) 

     at org.mozilla.javascript.gen._Unknown_Source__20983023._c_evaluate_1(<Unknown Source>:77) 

     at org.mozilla.javascript.gen._Unknown_Source__20983023.call(<Unknown Source>) 

     at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:74) 

     at org.mozilla.javascript.gen._Unknown_Source__20983023._c_script_0(<Unknown Source>:86) 

     at org.mozilla.javascript.gen._Unknown_Source__20983023.call(<Unknown Source>) 

     at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393) 

     at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3280) 

     at org.mozilla.javascript.gen._Unknown_Source__20983023.call(<Unknown Source>) 

     at org.mozilla.javascript.gen._Unknown_Source__20983023.exec(<Unknown Source>) 

     at com.sun.phobos.script.javascript.RhinoCompiledScript.eval(RhinoCompiledScript.java:55) 

     ... 6 more

 

1 Answer

0 votes

This is caused by passing a string to the renameTo() method that takes a java.io.File argument.  See example below:

var file = new java.io.File('/tmp/test.txt');
 
if (!file.exists()) {      
   file.createNewFile();
}   
 
// file.renameTo('/tmp/renamedTest.txt');  //  This FAILS and the message should end up in the error queue
file.renameTo(new java.io.File('/tmp/renamedTest.txt'));  // SUCCEEDS.  Rename to requires a File object as an argument.
Are your messages going to the error queue?
answered Jan 29, 2016 by rich-c-2789 (16,180 points)
...