Different behavior between 1.5b51 and 1.4.2_03.
REPRODUCE;
1) Compile the program
::::::::::::::
test2.java
::::::::::::::
import java.io.*;
import java.util.*;
public class test2 {
public static void main(String[] args) {
try{
String test = "test";
String test2 = null;
test.equalsIgnoreCase("Apple");
test2.equalsIgnoreCase("Apple");
}catch(Throwable ne) {
System.out.println(ne.getMessage());
ne.printStackTrace();
}
}
}
2) Launch "java -showversion test2" in 1.5-beta-b51
d;\temp>java -showversion test2
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0-beta2-b51, mixed mode)
java.lang.NullPointerException:
at test2.main(test2.java:11)
3) Then launch the same command in 1.4.2_0X on x86 windows machine.
d;\temp>java -showversion test2
java version "1.4.2_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)
Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)
null
java.lang.NullPointerException
at test2.main(test2.java:11)
The difference is the line after version information.
The result in 1.5b51 is "space"(or no output), but the result in 1.4.2_03
is String, "null".
CONFIGURATION;
- Itenium2 machine ( above 2) )
OS : Windows Server 2003
MPU : Itenium2 900[MHz]
JRE : 1.5-beta-b51
- Another machine for jre x86 ( above 3) )
OS : Windows XP (SP1, Japanese)
MPU : Pentium IV (1.4[GHz])
JRE : 1.4.2_03
NOTE:
- When the command is launched in 1.5b51(for ia64) with -Xcomp,
the output message is the same to that in 1.4.2_03.
The interpreter in 1.5 seems different from 1.4.2.
- Ttest2.java prints out the result of getMessage()
in System.out.println() on NullPointerException.
I attachedt the similar program(test1.java) to the test2.java.
The test1.java does not cause the above-mentioned diff.
The message is the same in 1.5-beta-b51 and 1.4.2_03 witj test1.java.
Only the above test2.java causes the diff.
::::::::::::::
test1.java
::::::::::::::
import java.io.*;
import java.util.*;
public class test1 {
public static void main(String[] args) {
try{
String test = null;
test.equalsIgnoreCase("Apple");
}catch(Throwable ne) {
System.out.println(ne.getMessage());
ne.printStackTrace();
}
}
}
=====================================================================
###@###.### 10/5/04 20:00 GMT
REPRODUCE;
1) Compile the program
::::::::::::::
test2.java
::::::::::::::
import java.io.*;
import java.util.*;
public class test2 {
public static void main(String[] args) {
try{
String test = "test";
String test2 = null;
test.equalsIgnoreCase("Apple");
test2.equalsIgnoreCase("Apple");
}catch(Throwable ne) {
System.out.println(ne.getMessage());
ne.printStackTrace();
}
}
}
2) Launch "java -showversion test2" in 1.5-beta-b51
d;\temp>java -showversion test2
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0-beta2-b51, mixed mode)
java.lang.NullPointerException:
at test2.main(test2.java:11)
3) Then launch the same command in 1.4.2_0X on x86 windows machine.
d;\temp>java -showversion test2
java version "1.4.2_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)
Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)
null
java.lang.NullPointerException
at test2.main(test2.java:11)
The difference is the line after version information.
The result in 1.5b51 is "space"(or no output), but the result in 1.4.2_03
is String, "null".
CONFIGURATION;
- Itenium2 machine ( above 2) )
OS : Windows Server 2003
MPU : Itenium2 900[MHz]
JRE : 1.5-beta-b51
- Another machine for jre x86 ( above 3) )
OS : Windows XP (SP1, Japanese)
MPU : Pentium IV (1.4[GHz])
JRE : 1.4.2_03
NOTE:
- When the command is launched in 1.5b51(for ia64) with -Xcomp,
the output message is the same to that in 1.4.2_03.
The interpreter in 1.5 seems different from 1.4.2.
- Ttest2.java prints out the result of getMessage()
in System.out.println() on NullPointerException.
I attachedt the similar program(test1.java) to the test2.java.
The test1.java does not cause the above-mentioned diff.
The message is the same in 1.5-beta-b51 and 1.4.2_03 witj test1.java.
Only the above test2.java causes the diff.
::::::::::::::
test1.java
::::::::::::::
import java.io.*;
import java.util.*;
public class test1 {
public static void main(String[] args) {
try{
String test = null;
test.equalsIgnoreCase("Apple");
}catch(Throwable ne) {
System.out.println(ne.getMessage());
ne.printStackTrace();
}
}
}
=====================================================================
###@###.### 10/5/04 20:00 GMT