Vidyashree Rama
Committed by Gerrit Code Review

[ONOS-4497] Revision date defect fix

Change-Id: I57a17c75aaa44af2b03e280dbc1a09d879b77bf0
...@@ -35,6 +35,7 @@ import org.onosproject.yangutils.utils.YangConstructType; ...@@ -35,6 +35,7 @@ import org.onosproject.yangutils.utils.YangConstructType;
35 public final class ListenerUtil { 35 public final class ListenerUtil {
36 36
37 private static final Pattern IDENTIFIER_PATTERN = Pattern.compile("[a-zA-Z_][a-zA-Z0-9_.-]*"); 37 private static final Pattern IDENTIFIER_PATTERN = Pattern.compile("[a-zA-Z_][a-zA-Z0-9_.-]*");
38 + private static final String DATE_PATTERN = "[0-9]{4}-([0-9]{2}|[0-9])-([0-9]{2}|[0-9])";
38 private static final String NON_NEGATIVE_INTEGER_PATTERN = "[0-9]+"; 39 private static final String NON_NEGATIVE_INTEGER_PATTERN = "[0-9]+";
39 private static final String PLUS = "+"; 40 private static final String PLUS = "+";
40 private static final String ONE = "1"; 41 private static final String ONE = "1";
...@@ -109,8 +110,7 @@ public final class ListenerUtil { ...@@ -109,8 +110,7 @@ public final class ListenerUtil {
109 * @return validation result, true for success, false for failure 110 * @return validation result, true for success, false for failure
110 */ 111 */
111 public static boolean isDateValid(String dateToValidate) { 112 public static boolean isDateValid(String dateToValidate) {
112 - 113 + if (dateToValidate == null || !dateToValidate.matches(DATE_PATTERN)) {
113 - if (dateToValidate == null || !dateToValidate.matches("[0-9]{4}-[0-9]{2}-[0-9]{2}")) {
114 return false; 114 return false;
115 } 115 }
116 116
......