if (statusFilter != null) {
for (String status : statusFilter) {
try {
StatusKeys.valueOf(status.toUpperCase());
} catch (IllegalArgumentException e) {
throw new InvalidRequestException(
"The status you're using in your filter isn't valid, "
+ "only the active, suspended, error, completed, terminated and faulted status are "
+ "valid. " + e.toString());
}
}
}
// Some additional validation on date format value
if (startedDateFilter != null) {
for (String ddf : startedDateFilter) {
try {
parseDateExpression(getDateWithoutOp(ddf));
} catch (ParseException e) {
throw new InvalidRequestException(
"Couldn't parse one of the filter date, please make "
+ "sure it follows the ISO-8601 date or date/time standard (yyyyMMddhhmmss). "
+ e.toString());
}
}
}
if (lastActiveDateFilter != null) {
for (String ddf : lastActiveDateFilter) {
try {
parseDateExpression(getDateWithoutOp(ddf));
} catch (ParseException e) {
throw new InvalidRequestException(
"Couldn't parse one of the filter date, please make "
+ "sure it follows the ISO-8601 date or date/time standard (yyyyMMddhhmmss). "
+ e.toString());
}
}
}
if (orderKeys != null && orderKeys.length() > 0) {
orders = new ArrayList<String>(3);
for (StringTokenizer orderKeysTok = new StringTokenizer(orderKeys, " "); orderKeysTok
.hasMoreTokens();) {
String orderKey = orderKeysTok.nextToken();
try {
String justKey = orderKey;
if (justKey.startsWith("-") || justKey.startsWith("+"))
justKey = orderKey.substring(1, justKey.length());
OrderKeys.valueOf(justKey.replaceAll("-", "_").toUpperCase());
orders.add(orderKey);
} catch (IllegalArgumentException e) {
throw new InvalidRequestException(
"One of the ordering keys isn't valid, processes can only "
+ "be sorted by pid, name, namespace, version, status, started and last-active "
+ "date." + e.toString());
}