From d8b4a781d2b1ced7deb42b19b41bf6c3c463f623 Mon Sep 17 00:00:00 2001 From: joewitt Date: Tue, 6 Jan 2015 09:23:19 -0500 Subject: [PATCH] NIFI-225 updating error handling to provide more context in output for date format parsing --- .../expression/language/evaluation/cast/DateCastEvaluator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/cast/DateCastEvaluator.java b/commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/cast/DateCastEvaluator.java index b6d758cbec..2a182403d9 100644 --- a/commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/cast/DateCastEvaluator.java +++ b/commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/cast/DateCastEvaluator.java @@ -72,7 +72,8 @@ public class DateCastEvaluator extends DateEvaluator { final Date date = sdf.parse(value); return new DateQueryResult(date); } catch (final ParseException pe) { - throw new AttributeExpressionLanguageException("Could not parse input as date", pe); + final String details = "Format: '" + DATE_TO_STRING_FORMAT + "' Value: '" + value + "'"; + throw new AttributeExpressionLanguageException("Could not parse date using " + details, pe); } } else if (NUMBER_PATTERN.matcher(value).matches()) { return new DateQueryResult(new Date(Long.valueOf(value)));