-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
1.4.0
-
sparc
-
solaris_2.6
Name: auR10023 Date: 01/30/2001
SimpleDateFormat.parse(String) does not support some three-letter time zones from the
resouces. Here is the example.
-----Test.java-----
import java.text.*;
import java.util.*;
class Test {
public static void main(String args[]) {
String dt = "Wed, 15 Apr 1372 13:17:37 ";
SimpleDateFormat format = new SimpleDateFormat(
"EEE, dd MMM yyyy HH:mm:ss z", Locale.ENGLISH
);
String [] avalIDs = TimeZone.getAvailableIDs(); // receiving time zone ids
// for current platform
for (int i = 0; i < avalIDs.length; i++) {
if (avalIDs[i].length() != 3) { // using ids with 3 letters only
continue;
}
try {
format.parse(dt + avalIDs[i]).getTime();
} catch(ParseException e) {
System.out.println("ParseException was thrown for " + avalIDs[i]);
}
}
}
}
---output:---
#java -version
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b48)
Java HotSpot(TM) Client VM (build 1.4beta-B48, mixed mode)
#java -cp . Test
ParseException was thrown for MIT
ParseException was thrown for PNT
ParseException was thrown for IET
ParseException was thrown for PRT
ParseException was thrown for CNT
ParseException was thrown for AGT
ParseException was thrown for BET
ParseException was thrown for MET
ParseException was thrown for NET
ParseException was thrown for PLT
ParseException was thrown for VST
ParseException was thrown for CTT
ParseException was thrown for AET
======================================================================