Repository: sqoop
Updated Branches:
  refs/heads/trunk ad53e4e33 -> 79b717269


SQOOP-1387: Incorrect permissions on manager.d directory can lead to NPE


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

Branch: refs/heads/trunk
Commit: 79b71726946f1bc792e034a32ee10835c58d5033
Parents: ad53e4e
Author: Chiwan Park <[email protected]>
Authored: Tue Sep 16 16:17:29 2014 -0700
Committer: Abraham Elmahrek <[email protected]>
Committed: Tue Sep 16 16:17:49 2014 -0700

----------------------------------------------------------------------
 src/java/org/apache/sqoop/ConnFactory.java | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/79b71726/src/java/org/apache/sqoop/ConnFactory.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/sqoop/ConnFactory.java 
b/src/java/org/apache/sqoop/ConnFactory.java
index e9c45bc..335b037 100644
--- a/src/java/org/apache/sqoop/ConnFactory.java
+++ b/src/java/org/apache/sqoop/ConnFactory.java
@@ -294,7 +294,20 @@ public class ConnFactory {
     if (mgrDir.exists() && mgrDir.isDirectory()) {
       // We have a managers.d subdirectory. Get the file list, sort it,
       // and process them in order.
-      String [] fileNames = mgrDir.list();
+      String[] fileNames;
+
+      try {
+        fileNames = mgrDir.list();
+      } catch (SecurityException e) {
+        fileNames = null;
+      }
+
+      if (null == fileNames) {
+        LOG.warn("Sqoop cannot read $SQOOP_CONF_DIR/managers.d. "
+            + "Please check the permissions on managers.d.");
+        return conf;
+      }
+
       Arrays.sort(fileNames);
 
       for (String fileName : fileNames) {

Reply via email to