If Sun JDK is incompatible with ibm jdk at work, let's take a note.
1. String. getbytes (string encoding)
Testcase: public static void main (string [] ARGs ){
Try {
Randomaccessfile F = new randomaccessfile ("test.txt", "RW ");
F. Write ("TETS". getbytes (null ));
F. Close ();
} Catch (ioexception e ){
E. printstacktrace ();
}
} Sun JDK 1.4: OK
Ibm jdk 1.4:
Exception in thread "Main" Java. Lang. nullpointerexception
At java. Lang. stringcoding $ encodercache. makeencoder (stringcoding. Java: 198)
At java. Lang. stringcoding $ 2.run( stringcoding. Java: 251)
At java. Security. accesscontroller. doprivileged1 (native method)
At java. Security. accesscontroller. doprivileged (accesscontroller. Java: 351)
At java. Lang. stringcoding $ encodercache. getencoder (stringcoding. Java: 248)
At java. Lang. stringcoding. getencoder (stringcoding. Java: 331)
At java. Lang. stringcoding. encode (stringcoding. Java: 472)
At java. Lang. String. getbytes (string. Java: 947)
At nullencoding. Main (nullencoding. Java: 12)
2. Japanese Encoding
Test Case: public static void main (string [] ARGs ){
Try {
"".Getbytes ("
Shift_jis");
"".Getbytes ("
Shift-JIS");
} Catch (exception e ){
E. printstacktrace ();
}
}
Sun JDK 1.4: OK
Ibm jdk 1.4:
Java. Io. unsupportedencodingexception:Shift-JIS
At java. Lang. stringcoding $ encodercache. getencoder (stringcoding. Java: 262)
At java. Lang. stringcoding. getencoder (stringcoding. Java: 331)
At java. Lang. stringcoding. encode (stringcoding. Java: 472)
At java. Lang. String. getbytes (string. Java: 947)
At shiftencoding. Main (shiftencoding. Java: 17)
To be continue...