falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sowmya...@apache.org
Subject falcon git commit: FALCON-1461 NPE in DateValidator validate. Contributed by Raghav Kumar Gautam
Date Wed, 16 Sep 2015 22:07:57 GMT
Repository: falcon
Updated Branches:
  refs/heads/master 947ed13b7 -> 52586b3e3


FALCON-1461 NPE in DateValidator validate. Contributed by Raghav Kumar Gautam


Project: http://git-wip-us.apache.org/repos/asf/falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/52586b3e
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/52586b3e
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/52586b3e

Branch: refs/heads/master
Commit: 52586b3e36b93dd71d9325f190dcb0917a42bda7
Parents: 947ed13
Author: Sowmya Ramesh <sramesh@hortonworks.com>
Authored: Wed Sep 16 15:07:46 2015 -0700
Committer: Sowmya Ramesh <sramesh@hortonworks.com>
Committed: Wed Sep 16 15:07:46 2015 -0700

----------------------------------------------------------------------
 CHANGES.txt                                                    | 2 ++
 .../main/java/org/apache/falcon/entity/v0/DateValidator.java   | 6 +++++-
 .../java/org/apache/falcon/entity/v0/DateValidatorTest.java    | 1 +
 3 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/52586b3e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 3aa300c..b7a2831 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -23,6 +23,8 @@ Trunk (Unreleased)
   OPTIMIZATIONS
 
   BUG FIXES
+    FALCON-1461 NPE in DateValidator validate(Raghav Kumar Gautam via Sowmya Ramesh)
+
     FALCON-1446 Flaky TaskLogRetrieverYarnTest(Narayan Periwal via Pallavi Rao)
 
     FALCON-1443 NPE in shutdown hook(Pallavi Rao via Ajay Yadava)

http://git-wip-us.apache.org/repos/asf/falcon/blob/52586b3e/client/src/main/java/org/apache/falcon/entity/v0/DateValidator.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/entity/v0/DateValidator.java b/client/src/main/java/org/apache/falcon/entity/v0/DateValidator.java
index e9cdd87..e211f57 100644
--- a/client/src/main/java/org/apache/falcon/entity/v0/DateValidator.java
+++ b/client/src/main/java/org/apache/falcon/entity/v0/DateValidator.java
@@ -17,6 +17,8 @@
  */
 package org.apache.falcon.entity.v0;
 
+import org.apache.commons.lang3.StringUtils;
+
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -39,7 +41,9 @@ public final class DateValidator {
      * @return true valid date fromat, false invalid date format
      */
     public static boolean validate(final String date) {
-
+        if (StringUtils.isBlank(date)) {
+            return false;
+        }
         Matcher matcher = PATTERN.matcher(date);
 
         if (matcher.matches()) {

http://git-wip-us.apache.org/repos/asf/falcon/blob/52586b3e/client/src/test/java/org/apache/falcon/entity/v0/DateValidatorTest.java
----------------------------------------------------------------------
diff --git a/client/src/test/java/org/apache/falcon/entity/v0/DateValidatorTest.java b/client/src/test/java/org/apache/falcon/entity/v0/DateValidatorTest.java
index e288b39..a1adb24 100644
--- a/client/src/test/java/org/apache/falcon/entity/v0/DateValidatorTest.java
+++ b/client/src/test/java/org/apache/falcon/entity/v0/DateValidatorTest.java
@@ -62,6 +62,7 @@ public class DateValidatorTest {
             new Object[]{"2010-6-31T00:00Z", }, new Object[]{"2010-06-31T00:00Z", },
             new Object[]{"2010-9-31T00:00Z", }, new Object[]{"2010-09-31T00:00Z", },
             new Object[]{"2010-11-31T00:00Z", }, new Object[]{"1999-04-31T01:00Z", },
+            new Object[]{null, }, new Object[]{"", }, new Object[]{"      ", },
         };
     }
 


Mime
View raw message