Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4184229

SimpleTimeZone ctors, setStartRule and setEndRule works wrong

XMLWordPrintable

    • beta
    • sparc
    • solaris_2.5



      Name: avC70361 Date: 10/26/98



        SimpleTimeZone ctors, setStartRule and setEndRule works wrong when setting a day-of-month rule with negative
      day of month. The rules are illegal since the day should be greater than 0. But the methods don't throw any
      IllegalArgumentException for such rules.

      Here is a test demonstrating the bug.
      ---------------SimpleTimeZoneTest.java---------
      import java.util.SimpleTimeZone;

      public class SimpleTimeZoneTest {
        public static void main(String args[]) {
          try {
            SimpleTimeZone zone = new SimpleTimeZone(
              0, "ID",
              0, -1, 0, 0,
              0, 0, 0, 0
            );

            System.out.println("Failed. No exception has been thrown");
          } catch(IllegalArgumentException e) {
            System.out.println("Passed.");
          }
        }
      }
      -------------The test output-----------
      > java -version
      java version "1.2fcs"
      Classic VM (build JDK-1.2fcs-O, green threads, sunwjit)
      > java SimpleTimeZoneTest
      Failed. No exception has been thrown

      ======================================================================

            aliusunw Alan Liu (Inactive)
            ovlasov Oleksandr Vlasov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: