JDK-6564860 : Liveconnect: Data types issues on IE should be documented or FIXED
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6u2,6u10
  • Priority: P3
  • Status: Closed
  • Resolution: Future Project
  • OS: windows
  • CPU: generic,x86
  • Submitted: 2007-06-01
  • Updated: 2010-12-14
  • Resolved: 2007-06-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7-poolResolved
Related Reports
Duplicate :  
Description
I've one more scenario related to passing of datatypes from java > JS then again getting them back from JS > Java. Link given below
Build Tried : Promoted 6u2 JRE build
OS : Windows XP
Problem:
Datayypes are not getting exchanged properly on IE browser but it works fine on firefox and mozilla. 
- long, float are getting retrieved as java.lang.Double 
- char,short,byte are getting converted into java.lang.Integer.
Interesting thing about char is that on IE, Javascript is recieving it as
- char MIN_VALUE as "0" 
- char MAX_VALUE as "65535"
Passing an array from JS > Java or Java > JS is not possible at all on IE. It simply throws following exception :
java.lang.Exception: setStringArray{0} :no such method exists
	at sun.plugin.com.JavaClass.getMethod1(Unknown Source)
	at sun.plugin.com.JavaClass.getDispatcher(Unknown Source)
	at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
	at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
java.lang.Exception: java.lang.Exception: setStringArray{0} :no such method exists
	at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
	at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.plugin.com.DispatchImpl.invoke(Unknown Source)

Bug is also reproducible with 1.4.2_15 and 1.5.0_12

1) For array related issue try to run any of the following htmls inside IE browser:
Test HTML:
http://sqeweb.sfbay.sun.com/deployment2/jitu/deployment_mustang_UR_int_ws/deployment/src/plugin/LiveConnect/LiveConnect/html/SimpleJavaJSJava.html
http://sqeweb.sfbay.sun.com/deployment2/jitu/deployment_mustang_UR_int_ws/deployment/src/plugin/LiveConnect/LiveConnect/html/Public_array_method.html
If you notice the above mentioned exception then bug is reporduced

Java Sources:
http://sqeweb.sfbay.sun.com/deployment2/jitu/deployment_mustang_UR_int_ws/deployment/src/plugin/LiveConnect/LiveConnect/src/SimpleJavaJSJava.java

2) For other data types issues try to run following html inside IE browser
http://sqeweb.sfbay.sun.com/deployment2/jitu/deployment_mustang_UR_int_ws/deployment/src/plugin/LiveConnect/LiveConnect/html/win32/JavaToJSDataTypesApp.html
Java source:
http://sqeweb.sfbay.sun.com/deployment2/jitu/deployment_mustang_UR_int_ws/deployment/src/plugin/LiveConnect/LiveConnect/html/win32/JavaToJSDataTypes.java

The issues should either be FIXED or documented if not possible to fix

Comments
EVALUATION Some of these issues are bugs in the test cases; some are due to differences in the JavaScript engines in IE and Firefox; and some are fixable. Passing in a JavaScript array and expecting that to show up as a Java array is not specified behavior. I don't think there's a LiveConnect specification out there which guarantees this works, even though it happens to work on the Firefox browser family. The basic observation is that arrays should be passed by reference, not by value, and from a semantic standpoint the JavaScript array should not be copied to a Java array; instead it should show up as a JSObject. This might be considered a bug in the test case. We may, however, be able to make this work in IE at some point. Returning a Java array to JavaScript on IE has been broken basically forever. Experimentation indicates that it should be possible to make this work with the same syntax as is supported in the Firefox browsers (using the array dereference operators) with changes to how we hand these objects back to the JScript engine. The numerical conversion issues are due to how IE's JScript engine represents numbers internally; most numbers are converted to double-precision floating point. There is no good way to narrow these numbers back down. One might choose to box the return values from JScript in the most narrow boxing type capable of holding the value, but this would still not guarantee that the types match as per the test case. We need to provide a clear specification on how these values are handled across browsers. This bug is being deferred to a future release of the Java Plug-In in which we anticipate being able to address a majority of these issues, in particular around array handling, and in which we will document the rest.
12-06-2007