-
Bug
-
Resolution: Fixed
-
P3
-
6u10
FULL PRODUCT VERSION :
JRE 1.6.0_10-rc
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
We have an method in applet that process a number passed from JavaScript. It worked fine in previous version of JRE but has java.lang.NumberFormatException in JRE 1.6.0_10-RC
We found that a number 1219224288742 in JavaScript becomes 1.219224288742E12 in our Applet. When we parse it into Long, it has error.
This is not the case in previous version of JRE including 1.6.0_7
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Prepare and compile a Java Applet as follows,
import java.applet.Applet;
public class TestApplet extends Applet {
public void init() {
;
}
public void destroy() {
;
}
public void printStringValue(String strValue) {
System.out.println("strValue: [" + strValue + "]");
}
}
2. Prepare a HTML as follows,
<html><head><title>ABC</title></head>
<applet code="TestApplet.class" name="test" width="1" height="1"></applet>
<script language="JavaScript">
<!--
var m_currTime = null;
m_currTime = new Date().getTime();
alert("m_currTime: " + m_currTime);
test.printStringValue(m_currTime);
//-->
</script>
<body>
TEST
</body>
</html>
3. Run the HTML in web browser
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The number display in the Java Console should has the same format as that prompted in JavaScript.
e.g.:
strValue: [1219224288742]
ACTUAL -
The number display in the Java Console has different format as that prompted in JavaScript.
e.g.:
strValue: [1.219224086554E12]
ERROR MESSAGES/STACK TRACES THAT OCCUR :
The number format is wrong and induces problem if we further process the value.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
TestApplet.java
import java.applet.Applet;
public class TestApplet extends Applet {
public void init() {
;
}
public void destroy() {
;
}
public void printStringValue(String strValue) {
System.out.println("strValue: [" + strValue + "]");
}
}
=================
testApplet.html
<html><head><title>ABC</title></head>
<applet code="TestApplet.class" name="test" width="1" height="1"></applet>
<script language="JavaScript">
<!--
var m_currTime = null;
m_currTime = new Date().getTime();
alert("m_currTime: " + m_currTime);
test.printStringValue(m_currTime);
//-->
</script>
<body>
TEST
</body>
</html>
---------- END SOURCE ----------
Release Regression From : 6u7
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
JRE 1.6.0_10-rc
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
We have an method in applet that process a number passed from JavaScript. It worked fine in previous version of JRE but has java.lang.NumberFormatException in JRE 1.6.0_10-RC
We found that a number 1219224288742 in JavaScript becomes 1.219224288742E12 in our Applet. When we parse it into Long, it has error.
This is not the case in previous version of JRE including 1.6.0_7
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Prepare and compile a Java Applet as follows,
import java.applet.Applet;
public class TestApplet extends Applet {
public void init() {
;
}
public void destroy() {
;
}
public void printStringValue(String strValue) {
System.out.println("strValue: [" + strValue + "]");
}
}
2. Prepare a HTML as follows,
<html><head><title>ABC</title></head>
<applet code="TestApplet.class" name="test" width="1" height="1"></applet>
<script language="JavaScript">
<!--
var m_currTime = null;
m_currTime = new Date().getTime();
alert("m_currTime: " + m_currTime);
test.printStringValue(m_currTime);
//-->
</script>
<body>
TEST
</body>
</html>
3. Run the HTML in web browser
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The number display in the Java Console should has the same format as that prompted in JavaScript.
e.g.:
strValue: [1219224288742]
ACTUAL -
The number display in the Java Console has different format as that prompted in JavaScript.
e.g.:
strValue: [1.219224086554E12]
ERROR MESSAGES/STACK TRACES THAT OCCUR :
The number format is wrong and induces problem if we further process the value.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
TestApplet.java
import java.applet.Applet;
public class TestApplet extends Applet {
public void init() {
;
}
public void destroy() {
;
}
public void printStringValue(String strValue) {
System.out.println("strValue: [" + strValue + "]");
}
}
=================
testApplet.html
<html><head><title>ABC</title></head>
<applet code="TestApplet.class" name="test" width="1" height="1"></applet>
<script language="JavaScript">
<!--
var m_currTime = null;
m_currTime = new Date().getTime();
alert("m_currTime: " + m_currTime);
test.printStringValue(m_currTime);
//-->
</script>
<body>
TEST
</body>
</html>
---------- END SOURCE ----------
Release Regression From : 6u7
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
- relates to
-
JDK-6753303 Request to specify the LiveConnect data conversion behavior from Number to String
- Closed