You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sqoop.apache.org by bl...@apache.org on 2012/06/21 00:41:37 UTC

svn commit: r1352359 - /sqoop/trunk/src/java/org/apache/sqoop/ConnFactory.java

Author: blee
Date: Wed Jun 20 22:41:37 2012
New Revision: 1352359

URL: http://svn.apache.org/viewvc?rev=1352359&view=rev
Log:
SQOOP-505  Handle trailing space in managers.d/connectors

Modified:
    sqoop/trunk/src/java/org/apache/sqoop/ConnFactory.java

Modified: sqoop/trunk/src/java/org/apache/sqoop/ConnFactory.java
URL: http://svn.apache.org/viewvc/sqoop/trunk/src/java/org/apache/sqoop/ConnFactory.java?rev=1352359&r1=1352358&r2=1352359&view=diff
==============================================================================
--- sqoop/trunk/src/java/org/apache/sqoop/ConnFactory.java (original)
+++ sqoop/trunk/src/java/org/apache/sqoop/ConnFactory.java Wed Jun 20 22:41:37 2012
@@ -18,11 +18,11 @@
 
 package org.apache.sqoop;
 
+import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
-import java.io.Reader;
 import java.util.Arrays;
 import java.util.LinkedList;
 import java.util.List;
@@ -141,12 +141,18 @@ public class ConnFactory {
    * @param f the file containing the configuration data to add.
    */
   private void addManagersFromFile(Configuration conf, File f) {
-    Reader r = null;
+    BufferedReader r = null;
     try {
       // The file format is actually Java properties-file syntax.
-      r = new InputStreamReader(new FileInputStream(f));
+      r = new BufferedReader(new InputStreamReader(new FileInputStream(f)));
       Properties props = new Properties();
-      props.load(r);
+      String line;
+      while ((line = r.readLine()) != null) {
+        int separator = line.indexOf('=');
+        String key = line.substring(0, separator).trim();
+        String value = line.substring(separator + 1).trim();
+        props.setProperty(key, value);
+      }
 
       for (Map.Entry<Object, Object> entry : props.entrySet()) {
         // Each key is a ManagerFactory class name.