Sidebar

Cause and fix for EvaluatorException (Explicitly calling java overloaded methods from javascript)

0 votes
1.7K views
asked Oct 10, 2013 by rich-c-2789 (16,240 points)
How can I resolve this type of error?

Caused by: sun.org.mozilla.javascript.internal.EvaluatorException: The choice of Java constructor write matching JavaScript argument types ([B) is ambiguous; candidate constructors are:
void write(int)
void write(byte[]) (<Unknown Source>#28)

1 Answer

+1 vote
 
Best answer

This exception may be thrown for other reasons but, in the case above, it is a problem with calling an overloaded method.

I came across this error trying to write to a FileOutputStream like:

out.write(binaryData);

to fix it I changed it to:

out["write(byte[])"](binaryData);

In short the bracket notation explicitly calls the appropriate method.

This link had the best explanation: http://s17.codeinspot.com/q/2852998

See also:

https://access.redhat.com/site/documentation/en-US/JBoss_Operations_Network/3.1/html/3.1.2_Release_Notes/Known-Issues-with-this-release.html

http://community.servicenow.com/blog/christophermaloy/writing-attachments-out-mid-server-and-calling-overloaded-java-methods-javascr

 

 

 

 

answered Oct 10, 2013 by rich-c-2789 (16,240 points)
selected Dec 17, 2013 by ron-s-6919
...