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

Incorrect leap second behavior in XMLGregorianCalendar.setTime method

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.3.0
    • 5.0
    • xml
    • 1.6
    • generic
    • generic

      Since leap second is possible only at the end of month. So the most recent leap second are in the following list (ftp://tycho.usno.navy.mil/pub/series/ser14.txt):
      0 36204 01-01-58 Beginning of Atomic Time
       1 41499 07-01-72 Effective at 0 hours UTC of the MJD
       2 41683 01-01-73
       3 42048 01-01-74
       4 42413 01-01-75
       5 42778 01-01-76
       6 43144 01-01-77
       7 43509 01-01-78
       8 43874 01-01-79
       9 44239 01-01-80
      10 44786 07-01-81
      11 45151 07-01-82
      12 45516 07-01-83
      13 46247 07-01-85
      14 47161 01-01-88
      15 47892 01-01-90
      16 48257 01-01-91
      17 48804 07-01-92
      18 49169 07-01-93
      19 49534 07-01-94
      20 50083 01-01-96
      21 50630 07-01-97
      22 51179 01-01-99

      Therefore the time to have leap second is only 0 hours and 0 minutes (or 23 hours and 59 minutes). Other times may not have leap second and following test should throw IllegalArgumentException:

      import javax.xml.datatype.DatatypeConfigurationException;
      import javax.xml.datatype.DatatypeFactory;
      import javax.xml.datatype.XMLGregorianCalendar;


      class test {

          public static void main(String [] args) throws Exception {
              DatatypeFactory factory = null;
              try {
                  factory = DatatypeFactory.newInstance();
              } catch (DatatypeConfigurationException dce) {
                  dce.printStackTrace();
              }

              XMLGregorianCalendar calendar =
                      factory.newXMLGregorianCalendar();
              calendar.setTime(3, 23, 60);
              System.out.println("OK");
          }
      }

      But it prints OK.

      ###@###.### 2005-03-10 15:36:24 GMT

      intrgrated in tag JWSDP-1_6-b08
      ###@###.### 2005-05-02 23:05:20 GMT

            duke J. Duke
            ydanilev Yury Danilevich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: