Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3326

Obscure method getTimeZone(java.util.Date) in org.codehaus.groovy.runtime.TimeCategory

    XMLWordPrintableJSON

Details

    Description

      TimeCategory#getTimeZone(Date) pretends to return a TimeZone that would be somehow associated with the given Date.

      • A java.util.Date does not carry any time zone information as long as it's deprecated functionality is not used an it's toString() method is not called.
      • A java.util.Calendar's time zone is not affected by calling #setTime(Date).

      So the current implementation of TimeCategory#getTimeZone(Date) is effectively equivalent to

      public static TimeZone getTimeZone(Date self) {
        return TimeZone.getDefault();
      }
      

      The result does not depend on the passed Date, and the method should probably be deprecated.

      Attachments

        Activity

          People

            paulk Paul King
            veita Alexander Veit
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: