Author: tkobayas(a)redhat.com
Date: 2011-09-06 21:04:35 -0400 (Tue, 06 Sep 2011)
New Revision: 7316
Modified:
epp/portal/branches/EPP_5_1_0_GA_JBEPP-1114/webui/core/src/main/java/org/exoplatform/webui/form/validator/DateTimeValidator.java
Log:
JBEPP-1114 DateTimeValidator has superflous code that breaks localized date timestamps
Modified:
epp/portal/branches/EPP_5_1_0_GA_JBEPP-1114/webui/core/src/main/java/org/exoplatform/webui/form/validator/DateTimeValidator.java
===================================================================
---
epp/portal/branches/EPP_5_1_0_GA_JBEPP-1114/webui/core/src/main/java/org/exoplatform/webui/form/validator/DateTimeValidator.java 2011-09-06
20:55:01 UTC (rev 7315)
+++
epp/portal/branches/EPP_5_1_0_GA_JBEPP-1114/webui/core/src/main/java/org/exoplatform/webui/form/validator/DateTimeValidator.java 2011-09-07
01:04:35 UTC (rev 7316)
@@ -28,9 +28,6 @@
import java.text.DateFormat;
import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
/**
* Created by The eXo Platform SARL
@@ -45,9 +42,6 @@
{
static private final String SPLIT_REGEX = "/|\\s+|:";
- static private final String DATETIME_REGEX =
-
"^(\\d{1,2}\\/\\d{1,2}\\/\\d{1,4})\\s*(\\s+\\d{1,2}:\\d{1,2}:\\d{1,2})?$";
-
public void validate(UIFormInput uiInput) throws Exception
{
if (uiInput.getValue() == null || ((String)uiInput.getValue()).trim().length() ==
0)
@@ -79,24 +73,6 @@
{
throw new MessageException(new
ApplicationMessage("DateTimeValidator.msg.Invalid-input", args,
ApplicationMessage.WARNING));
}
- if (s.matches(DATETIME_REGEX) && isValidDateTime(s))
- return;
-
- throw new MessageException(new
ApplicationMessage("DateTimeValidator.msg.Invalid-input", args,
ApplicationMessage.WARNING));
}
- private boolean isValidDateTime(String dateTime)
- {
- String[] arr = dateTime.split(SPLIT_REGEX, 7);
- int valid = Integer.parseInt(arr[0]);
- if (valid < 1 || valid > 12)
- return false;
- Calendar date = new GregorianCalendar(Integer.parseInt(arr[2]), valid - 1, 1);
- if (Integer.parseInt(arr[1]) > date.getActualMaximum(Calendar.DAY_OF_MONTH))
- return false;
- if (arr.length > 3
- && (Integer.parseInt(arr[3]) > 23 || Integer.parseInt(arr[4]) > 59
|| Integer.parseInt(arr[5]) > 59))
- return false;
- return true;
- }
}