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

XMLGregorianCalendar: wrong behaviour of setXXX methods

XMLWordPrintable

    • generic
    • generic

      Problem Description from IBM:
      The expectation that an exception be thrown contradicts all other behaviour of XMLGregorianCalendar where the user can set the values of fields in many ways where the value while they're editing may be invalid, for example setting the value of days = 31 in month 2 (i.e. Feburary 31st) before reassigning the month value to something else.

      A user calling the methods individually,

      XMLGregorianCalendar.setHour(24);
      XMLGregorianCalendar.setMinute(0);
      XMLGregorianCalendar.setSecond(1);

      wouldn't get an exception.

      XMLGregorianCalendar.setTime(24, 0, 1);

      is just short-hand for that sequence of calls. It should behave the same way as all the other set() methods and not throw an exception.

            joehw Joe Wang
            lkuskov Leonid Kuskov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: