"CAMEL-11620:Requiredement for date string to be longer than pattern is invalid
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bec5e1db Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bec5e1db Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bec5e1db Branch: refs/heads/master Commit: bec5e1dbe14dc142b44843c341f340b325a91c3b Parents: 21e30ec Author: Pulkit <pchha...@redhat.com> Authored: Tue Aug 1 19:19:44 2017 +0530 Committer: Andrea Cosentino <anco...@gmail.com> Committed: Wed Aug 2 08:30:40 2017 +0200 ---------------------------------------------------------------------- .../format/factories/LocalDateFormatFactory.java | 15 +++------------ .../format/factories/LocalDateTimeFormatFactory.java | 14 ++------------ .../format/factories/LocalTimeFormatFactory.java | 14 ++------------ 3 files changed, 7 insertions(+), 36 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/bec5e1db/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/factories/LocalDateFormatFactory.java ---------------------------------------------------------------------- diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/factories/LocalDateFormatFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/factories/LocalDateFormatFactory.java index 64b8606..66fd217 100644 --- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/factories/LocalDateFormatFactory.java +++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/factories/LocalDateFormatFactory.java @@ -57,19 +57,10 @@ public class LocalDateFormatFactory extends AbstractFormatFactory { DateTimeFormatter df = this.getDateFormat(); ObjectHelper.notNull(this.pattern, "pattern"); - - if (doesStringFitLengthOfPattern(string)) { - date = LocalDate.parse(string, df); - return date; - } else { - throw new FormatException("Date provided does not fit the pattern defined"); - } - - } - - private boolean doesStringFitLengthOfPattern(String string) { - return string.length() <= this.pattern.length(); + date = LocalDate.parse(string, df); + return date; } + DateTimeFormatter getDateFormat() { DateTimeFormatter result; http://git-wip-us.apache.org/repos/asf/camel/blob/bec5e1db/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/factories/LocalDateTimeFormatFactory.java ---------------------------------------------------------------------- diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/factories/LocalDateTimeFormatFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/factories/LocalDateTimeFormatFactory.java index 109168b..74b0c89 100644 --- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/factories/LocalDateTimeFormatFactory.java +++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/factories/LocalDateTimeFormatFactory.java @@ -66,18 +66,8 @@ public class LocalDateTimeFormatFactory extends AbstractFormatFactory { DateTimeFormatter df = this.getDateFormat(); ObjectHelper.notNull(this.pattern, "pattern"); - - if (doesStringFitLengthOfPattern(string)) { - date = LocalDateTime.parse(string, df); - return date; - } else { - throw new FormatException("Date provided does not fit the pattern defined"); - } - - } - - private boolean doesStringFitLengthOfPattern(String string) { - return string.length() <= this.pattern.length(); + date = LocalDateTime.parse(string, df); + return date; } DateTimeFormatter getDateFormat() { http://git-wip-us.apache.org/repos/asf/camel/blob/bec5e1db/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/factories/LocalTimeFormatFactory.java ---------------------------------------------------------------------- diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/factories/LocalTimeFormatFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/factories/LocalTimeFormatFactory.java index aa177ab..94e63e2 100644 --- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/factories/LocalTimeFormatFactory.java +++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/factories/LocalTimeFormatFactory.java @@ -66,18 +66,8 @@ public class LocalTimeFormatFactory extends AbstractFormatFactory { DateTimeFormatter df = this.getDateFormat(); ObjectHelper.notNull(this.pattern, "pattern"); - - if (doesStringFitLengthOfPattern(string)) { - date = LocalTime.parse(string, df); - return date; - } else { - throw new FormatException("Date provided does not fit the pattern defined"); - } - - } - - private boolean doesStringFitLengthOfPattern(String string) { - return string.length() <= this.pattern.length(); + date = LocalTime.parse(string, df); + return date; } DateTimeFormatter getDateFormat() {