Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-1653

Change DateTools to not create a Calendar in every call to dateToString or timeToString

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 2.9
    • core/other
    • None
    • New, Patch Available

    Description

      DateTools creates a Calendar instance on every call to dateToString and timeToString. Specifically:

      1. timeToString calls Calendar.getInstance on every call.
      2. dateToString calls timeToString(date.getTime()), which then instantiates a new Date(). I think we should change the order of the calls, or not have each call the other.
      3. round(), which is called from timeToString (after creating a Calendar instance) creates another Calendar instance ...

      Seems that if we synchronize the methods and create the Calendar instance once (static), it should solve it.

      Attachments

        1. cleanerDateTools.patch
          11 kB
          David Smiley
        2. LUCENE-1653.patch
          9 kB
          Mark Miller
        3. LUCENE-1653.patch
          8 kB
          Shai Erera

        Activity

          People

            markrmiller@gmail.com Mark Miller
            shaie Shai Erera
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: