BUG-4688: eliminate SimpleDateFormatUtil.DEFAULT_DATE_REV
[yangtools.git] / yang / yang-common / src / main / java / org / opendaylight / yangtools / yang / common / SimpleDateFormatUtil.java
index fd50c95ab8c10bfab7ec04363d152995fa299d58..2d8df756c0ad69463c74f63c1c560dd62e7e1f80 100644 (file)
@@ -10,17 +10,30 @@ package org.opendaylight.yangtools.yang.common;
 
 import java.text.SimpleDateFormat;
 
-public class SimpleDateFormatUtil {
+public final class SimpleDateFormatUtil {
+
+    /**
+     * revision format according to Yang spec.
+     */
+    private static final String REVISION_SIMPLE_DATE = "yyyy-MM-dd";
+
+    private SimpleDateFormatUtil() {
+        throw new UnsupportedOperationException("Utility class should not be instantiated");
+    }
 
     private static final ThreadLocal<SimpleDateFormat> REVISION_FORMAT = new ThreadLocal<SimpleDateFormat>() {
 
+        @Override
         protected SimpleDateFormat initialValue() {
-            return new SimpleDateFormat("yyyy-MM-dd");
-        };
+            final SimpleDateFormat fmt = new SimpleDateFormat(REVISION_SIMPLE_DATE);
+            fmt.setLenient(false);
+            return fmt;
+        }
 
-        public void set(SimpleDateFormat value) {
+        @Override
+        public void set(final SimpleDateFormat value) {
             throw new UnsupportedOperationException();
-        };
+        }
 
     };