JDK-6753303 : Request to specify the LiveConnect data conversion behavior from Number to String
  • Type: Enhancement
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6u10
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows
  • CPU: x86
  • Submitted: 2008-09-26
  • Updated: 2014-11-14
  • Resolved: 2008-09-26
Related Reports
Duplicate :  
Relates :  
Description
This is discussed in forum:
http://forums.java.net/jive/thread.jspa?messageID=301756

In JavaScript, when passing a "Number" value to a Java method that is expecting a String value and returns a String (i.e. String foo(String arg)). The behavior is different. In 6u7, if Number value = 3, the returned String from Java method is "3", but in 6u10, the return value is "3.0". This is only reproducible with IE.

jscript version is 5.7.0.16535

If I set the value of a variable as:
x=Number(3);
then it is converted correctly as a java String to "3" in 1.6.0_10.

But if set the value of a variable (with quotes around the 3) as:
x=Number("3");
then it is converted incorrectly as a java String to "3.0" in 1.6.0_10.

Both result in "typeof x" to return "number" but the objects are obviously slightly different otherwise java would convert them to the same value.