BUG-4688: eliminate SimpleDateFormatUtil.DEFAULT_DATE_REV
[yangtools.git] / yang / yang-common / src / main / java / org / opendaylight / yangtools / yang / common / SimpleDateFormatUtil.java
index 3824f4afd36b4b9a4c402951c7d96e7f880c472e..2d8df756c0ad69463c74f63c1c560dd62e7e1f80 100644 (file)
@@ -12,6 +12,11 @@ import java.text.SimpleDateFormat;
 
 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");
     }
@@ -20,11 +25,13 @@ public final class SimpleDateFormatUtil {
 
         @Override
         protected SimpleDateFormat initialValue() {
-            return new SimpleDateFormat("yyyy-MM-dd");
+            final SimpleDateFormat fmt = new SimpleDateFormat(REVISION_SIMPLE_DATE);
+            fmt.setLenient(false);
+            return fmt;
         }
 
         @Override
-        public void set(SimpleDateFormat value) {
+        public void set(final SimpleDateFormat value) {
             throw new UnsupportedOperationException();
         }