sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject sqoop git commit: SQOOP-2219: Sqoop2: Skip missing input in DirectoryExistsValidator
Date Tue, 17 Mar 2015 03:28:15 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 1abf38d63 -> 639fdbe0a


SQOOP-2219: Sqoop2: Skip missing input in DirectoryExistsValidator

(Jarek Jarcec Cecho via Abraham Elmahrek)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/639fdbe0
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/639fdbe0
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/639fdbe0

Branch: refs/heads/sqoop2
Commit: 639fdbe0a2b96a580b4d28053f9a71b266cba5a3
Parents: 1abf38d
Author: Abraham Elmahrek <abe@apache.org>
Authored: Mon Mar 16 20:27:12 2015 -0700
Committer: Abraham Elmahrek <abe@apache.org>
Committed: Mon Mar 16 20:27:12 2015 -0700

----------------------------------------------------------------------
 .../validators/DirectoryExistsValidator.java           |  5 +++++
 .../validators/TestDirectoryExistsValidator.java       | 13 +++++++++++++
 2 files changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/639fdbe0/common/src/main/java/org/apache/sqoop/validation/validators/DirectoryExistsValidator.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/validation/validators/DirectoryExistsValidator.java
b/common/src/main/java/org/apache/sqoop/validation/validators/DirectoryExistsValidator.java
index d81e6b0..60fda50 100644
--- a/common/src/main/java/org/apache/sqoop/validation/validators/DirectoryExistsValidator.java
+++ b/common/src/main/java/org/apache/sqoop/validation/validators/DirectoryExistsValidator.java
@@ -17,6 +17,7 @@
  */
 package org.apache.sqoop.validation.validators;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.sqoop.validation.Status;
 
 import java.io.File;
@@ -27,6 +28,10 @@ import java.io.File;
 public class DirectoryExistsValidator extends AbstractValidator<String> {
   @Override
   public void validate(String filePath) {
+    if(StringUtils.isBlank(filePath)) {
+      return;
+    }
+
     File file = new File(filePath);
 
     if(!file.exists()) {

http://git-wip-us.apache.org/repos/asf/sqoop/blob/639fdbe0/common/src/test/java/org/apache/sqoop/validation/validators/TestDirectoryExistsValidator.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/validation/validators/TestDirectoryExistsValidator.java
b/common/src/test/java/org/apache/sqoop/validation/validators/TestDirectoryExistsValidator.java
index e6c4ec3..458aa89 100644
--- a/common/src/test/java/org/apache/sqoop/validation/validators/TestDirectoryExistsValidator.java
+++ b/common/src/test/java/org/apache/sqoop/validation/validators/TestDirectoryExistsValidator.java
@@ -39,6 +39,19 @@ public class TestDirectoryExistsValidator {
   }
 
   @Test
+  public void testNull() {
+    validator.validate(null);
+    assertEquals(Status.OK, validator.getStatus());
+  }
+
+  @Test
+  public void testEmpty() {
+    validator.validate("");
+    assertEquals(Status.OK, validator.getStatus());
+  }
+
+
+  @Test
   public void testExistingDirectory() {
     File tmpDir = Files.createTempDir();
     tmpDir.deleteOnExit();


Mime
View raw message