I'm checking whether a date is valid. Method boolean CheckValidDate(ProductStartEnd productStartEnd) |
SimpleDateFormat sdf = new SimpleDateFormat
("yyyy-MM-dd"); sdf.setLenient(false); try { Date date = sdf.parse (productStartEnd.startDateString); { catch (ParseException e) { return false; } return true; [DecisionTable${OPENRULES_MODE}Templates.xls] has been resolved to [file:/C:/EclipseWorkspace/P2V+/DecisionTableExecuteTemplates.xls] Processing file:/C:/EclipseWorkspace/P2V+/DecisionTableExecuteTemplates.xls IMPORT.JAVA=mypackage.* IMPORT.JAVA=java.util.regex.* IMPORT.JAVA=java.text.* Exception in thread "main" org.openl.syntax.SyntaxErrorException: Error: Encountered "try" at line 3, column 1. Was expecting one of: <EOF> "break" ... "continue" ... "do" ... "false" ... "for" ... "if" ... "new" ... "null" ... "return" ... "throw" ... "true" ... "while" ... "(" ... "{" ... ";" ... "!" ... "++" ... "--" ... "+" ... "-" ... "|" ... <INTEGER_LITERAL> ... <FLOATING_POINT_LITERAL> ... <CHARACTER_LITERAL> ... <STRING_LITERAL> ... <IDENTIFIER> ... Invalid Code Fragment: ========================================= SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd"); sdf.setLenient(false); ^ try { Date date = sdf.parse (productStartEnd.startDateString); ========================================= at file:/C:/EclipseWorkspace/P2V+/spreadsheet/xtra/Miscellaneous.xls?sheet=Method&cell=F28&start=81&end=81&openl= Without the try command the following happens: Execute Rules <EvaluateOneStartDate> for a collection of ProductStartEnd Conclusion: Start Date Flag is Y org.apache.commons.lang.exception.NestableRuntimeException: Unparseable date: "2015-07-33" at org.openl.util.RuntimeExceptionWrapper.wrap(RuntimeExceptionWrapper.java:27) at org.openl.types.java.JavaOpenMethod.invoke(JavaOpenMethod.java:65) at org.openl.binding.impl.MethodBoundNode.evaluateRuntime(MethodBoundNode.java:65) |