Uploaded image for project: 'Runtime'
  1. Runtime
  2. RUNTIME-2437

SimpleDateFormat should not be instanced in class variables

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • 4.8.0
    • 3.9, 4.0RC3
    • Général
    • None

      SimpleDateFormat is not a thread-safe component, we should use the method used in SolrIndexer class :

      private static final ThreadLocal<SimpleDateFormat> __DATE_FORMAT = new ThreadLocal<>();
      
      public static SimpleDateFormat dateFormat()
      {
          if (__DATE_FORMAT.get() == null)
          {
              __DATE_FORMAT.set(new SimpleDateFormat("yyyy-MM-dd"));
          }
          return __DATE_FORMAT.get();
      }

            sprieul Simon Prieul (Inactive)
            bmaurel Bérénice Maurel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: