[JBoss JIRA] Created: (GTNPORTAL-1986) inconistent use of ids and names to retrieve objects
by Matt Wringe (JIRA)
inconistent use of ids and names to retrieve objects
----------------------------------------------------
Key: GTNPORTAL-1986
URL: https://issues.jboss.org/browse/GTNPORTAL-1986
Project: GateIn Portal
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Java API
Reporter: Matt Wringe
The api is using inconsistent values to retrieve objects. Sometimes it will require using an Id to retrieve an object, sometimes it will require passing a string value to retrieve the object. This especially gets confusing since many of the ids only require a single string to create them anyways.
Since the api is suppose to be Id centric, retrieval of all objects should be done using ids.
Examples using strings instead of ids:
- ContentRegistry with categories
- Category with ManagedContent
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 9 months
[JBoss JIRA] Created: (GTNPORTAL-1944) DateTimeValidator has superflous code that breaks localized date timestamps
by Matt Davis (JIRA)
DateTimeValidator has superflous code that breaks localized date timestamps
---------------------------------------------------------------------------
Key: GTNPORTAL-1944
URL: https://issues.jboss.org/browse/GTNPORTAL-1944
Project: GateIn Portal
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: WebUI
Affects Versions: 3.1.0-GA
Reporter: Matt Davis
http://anonsvn.jboss.org/repos/gatein/epp/portal/tags/EPP_5_1_0_GA/webui/...
has an additional check where the date input value needs to match the (not localized) DATETIME_REGEX, which is superfluous and causes localized date input to fail:
Index: core/src/main/java/org/exoplatform/webui/form/validator/DateTimeValidator.java
===================================================================
--- core/src/main/java/org/exoplatform/webui/form/validator/DateTimeValidator.java (revision 6667)
+++ core/src/main/java/org/exoplatform/webui/form/validator/DateTimeValidator.java (working copy)
@@ -43,17 +43,11 @@
public class DateTimeValidator implements Validator
{
- 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)
return;
String s = (String)uiInput.getValue();
- DateFormat stFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
UIFormDateTimeInput uiDateInput = (UIFormDateTimeInput)uiInput;
SimpleDateFormat sdf = new SimpleDateFormat(uiDateInput.getDatePattern_().trim());
@@ -79,24 +73,5 @@
{
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;
- }
}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 9 months