FULL PRODUCT VERSION :
java version "1.5.0_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)
Java HotSpot(TM) Client VM (build 1.5.0_03-b07, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Internet Explorer version 6.0.28
A DESCRIPTION OF THE PROBLEM :
When my applet contains 2 methods with the same name but not the same return type, internet explorer does not take the good return type.
Here is an exemple :
/**
* Class TestApplet
*/
package test.applet;
import java.applet.Applet;
public class TestApplet extends Applet {
public void init() {
System.out.println("init()");
}
public void start() {
System.out.println("start()");
}
public String test(String s) {
System.out.println("test(String) :" + s);
return s;
}
public boolean test(int i) {
System.out.println("test(int) :" + i);
return true;
}
}
I have 2 methods test(), one returns a String and the other a boolean.
I use the following html code :
<html>
<head>
<script>
function test() {
alert(document.DataAccess.test("hello"));
}
</script>
</head>
<body>
<applet WIDTH="500" HEIGHT="200" ID="DataAccess" NAME="DataAccess" CODE="test.applet.TestApplet">
</applet>
<div onclick="test()">test</div>
</body>
</html>
When I click on "test", the alert show "true" instead of "hello".
The problem only occurs with a JVM 1.5. It work fine with JVM 1.4.
I am attaching excerpts from the console -
----------------------------------------------------
Java Plug-in 1.5.0_03
----------------------------------------------------
init()
start()
liveconnect: Invoking method: public java.lang.String TestApplet.test(java.lang.String)
liveconnect: Needs conversion: java.lang.String --> java.lang.String
test(String) :hello
----------------------------------------------------
Java(TM) Plug-in: Version 1.4.2_08
----------------------------------------------------
init()
start()
test(String) :hello
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- Step 1 : Create the following applet
/**
* Class TestApplet
*/
package test.applet;
import java.applet.Applet;
public class TestApplet extends Applet {
public void init() {
System.out.println("init()");
}
public void start() {
System.out.println("start()");
}
public String test(String s) {
System.out.println("test(String) :" + s);
return s;
}
public boolean test(int i) {
System.out.println("test(int) :" + i);
return true;
}
}
- Step 2 : Insert the applet in the following html page :
<html>
<head>
<script>
function test() {
alert(document.DataAccess.test("hello"));
}
</script>
</head>
<body>
<applet WIDTH="500" HEIGHT="200" ID="DataAccess" NAME="DataAccess" CODE="test.applet.TestApplet">
</applet>
<div onclick="test()">test</div>
</body>
</html>
- Step 3 : View this html page in internet explorer
- Step 4 : Click on "test"
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Internet explorer should show an alert with the text "hello"
ACTUAL -
The alert contains the text "true"
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Rename the method test(int) to something else.
###@###.### 2005-07-05 10:23:22 GMT
java version "1.5.0_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)
Java HotSpot(TM) Client VM (build 1.5.0_03-b07, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Internet Explorer version 6.0.28
A DESCRIPTION OF THE PROBLEM :
When my applet contains 2 methods with the same name but not the same return type, internet explorer does not take the good return type.
Here is an exemple :
/**
* Class TestApplet
*/
package test.applet;
import java.applet.Applet;
public class TestApplet extends Applet {
public void init() {
System.out.println("init()");
}
public void start() {
System.out.println("start()");
}
public String test(String s) {
System.out.println("test(String) :" + s);
return s;
}
public boolean test(int i) {
System.out.println("test(int) :" + i);
return true;
}
}
I have 2 methods test(), one returns a String and the other a boolean.
I use the following html code :
<html>
<head>
<script>
function test() {
alert(document.DataAccess.test("hello"));
}
</script>
</head>
<body>
<applet WIDTH="500" HEIGHT="200" ID="DataAccess" NAME="DataAccess" CODE="test.applet.TestApplet">
</applet>
<div onclick="test()">test</div>
</body>
</html>
When I click on "test", the alert show "true" instead of "hello".
The problem only occurs with a JVM 1.5. It work fine with JVM 1.4.
I am attaching excerpts from the console -
----------------------------------------------------
Java Plug-in 1.5.0_03
----------------------------------------------------
init()
start()
liveconnect: Invoking method: public java.lang.String TestApplet.test(java.lang.String)
liveconnect: Needs conversion: java.lang.String --> java.lang.String
test(String) :hello
----------------------------------------------------
Java(TM) Plug-in: Version 1.4.2_08
----------------------------------------------------
init()
start()
test(String) :hello
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- Step 1 : Create the following applet
/**
* Class TestApplet
*/
package test.applet;
import java.applet.Applet;
public class TestApplet extends Applet {
public void init() {
System.out.println("init()");
}
public void start() {
System.out.println("start()");
}
public String test(String s) {
System.out.println("test(String) :" + s);
return s;
}
public boolean test(int i) {
System.out.println("test(int) :" + i);
return true;
}
}
- Step 2 : Insert the applet in the following html page :
<html>
<head>
<script>
function test() {
alert(document.DataAccess.test("hello"));
}
</script>
</head>
<body>
<applet WIDTH="500" HEIGHT="200" ID="DataAccess" NAME="DataAccess" CODE="test.applet.TestApplet">
</applet>
<div onclick="test()">test</div>
</body>
</html>
- Step 3 : View this html page in internet explorer
- Step 4 : Click on "test"
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Internet explorer should show an alert with the text "hello"
ACTUAL -
The alert contains the text "true"
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Rename the method test(int) to something else.
###@###.### 2005-07-05 10:23:22 GMT