-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
1.2fcs
-
sparc
-
solaris_2.5
-
Verified
Name: avC70361 Date: 06/23/98
The java.util.TimeZone.getDisplayName(boolean, int) and getDisplayName(
boolean, int, Locale) works wrong if its second argument is not TimeZone.SHORT
and not TimeZone.LONG. It doesn't throw IllegalArgumentException.
Here is a test demonstrating the bug.
----------GetDisplayNameTest.java----------
import java.util.Locale;
import java.util.TimeZone;
public class GetDisplayNameTest {
public static void main(String args[]) {
try {
TimeZone tz = TimeZone.getTimeZone("GMT");
String name = tz.getDisplayName(true, Integer.MAX_VALUE,
Locale.getDefault());
System.out.println("Failed. IllegalArgumentException haven't been thrown");
} catch(IllegalArgumentException e) {
System.out.println("Passed");
}
}
}
----------The test output-------
<avv@stardust(pts/3).570> java -version
java version "1.2beta4"
Classic VM (build JDK-1.2beta4-J, green threads, sunwjit)
<avv@stardust(pts/3).571> java GetDisplayNameTest
Failed. IllegalArgumentException haven't been thrown
======================================================================