Author: rkanter
Date: Wed May 22 18:46:00 2013
New Revision: 1485330

URL: http://svn.apache.org/r1485330
Log:
OOZIE-1386 NPE in XOozieClient if fs.default.name is not defined but 
fs.defaultFS is (wypoon via rkanter)

Modified:
    oozie/trunk/client/src/main/java/org/apache/oozie/client/XOozieClient.java
    
oozie/trunk/core/src/test/java/org/apache/oozie/client/TestWorkflowXClient.java
    oozie/trunk/release-log.txt

Modified: 
oozie/trunk/client/src/main/java/org/apache/oozie/client/XOozieClient.java
URL: 
http://svn.apache.org/viewvc/oozie/trunk/client/src/main/java/org/apache/oozie/client/XOozieClient.java?rev=1485330&r1=1485329&r2=1485330&view=diff
==============================================================================
--- oozie/trunk/client/src/main/java/org/apache/oozie/client/XOozieClient.java 
(original)
+++ oozie/trunk/client/src/main/java/org/apache/oozie/client/XOozieClient.java 
Wed May 22 18:46:00 2013
@@ -123,6 +123,8 @@ public class XOozieClient extends OozieC
         if (NN == null) {
             if(NN_2 == null) {
                 throw new RuntimeException("namenode is not specified in 
conf");
+            } else {
+                NN = NN_2;
             }
         }
 

Modified: 
oozie/trunk/core/src/test/java/org/apache/oozie/client/TestWorkflowXClient.java
URL: 
http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/client/TestWorkflowXClient.java?rev=1485330&r1=1485329&r2=1485330&view=diff
==============================================================================
--- 
oozie/trunk/core/src/test/java/org/apache/oozie/client/TestWorkflowXClient.java 
(original)
+++ 
oozie/trunk/core/src/test/java/org/apache/oozie/client/TestWorkflowXClient.java 
Wed May 22 18:46:00 2013
@@ -118,6 +118,10 @@ public class TestWorkflowXClient extends
                 Path libPath = new Path(getFsTestCaseDir(), "lib");
                 getFileSystem().mkdirs(libPath);
 
+                String localPath = libPath.toUri().getPath();
+                int startPosition = libPath.toString().indexOf(localPath);
+                String nn = libPath.toString().substring(0, startPosition);
+
                 // try to submit without JT and NN
                 try {
                     wc.submitMapReduce(conf);
@@ -129,28 +133,32 @@ public class TestWorkflowXClient extends
                 conf.setProperty(XOozieClient.JT, "localhost:9001");
                 try {
                     wc.submitMapReduce(conf);
-                    fail("submit client without NN should throuhg exception");
+                    fail("submit client without NN should throw exception");
                 }
                 catch (RuntimeException exception) {
                     assertEquals("java.lang.RuntimeException: namenode is not 
specified in conf", exception.toString());
                 }
-                conf.setProperty(XOozieClient.NN, "hdfs://localhost:9000");
+                // set fs.default.name
+                conf.setProperty(XOozieClient.NN, nn);
                 try {
                     wc.submitMapReduce(conf);
-                    fail("submit client without LIBPATH should throuhg 
exception");
+                    fail("submit client without LIBPATH should throw 
exception");
+                }
+                catch (RuntimeException exception) {
+                    assertEquals("java.lang.RuntimeException: libpath is not 
specified in conf", exception.toString());
+                }
+                // set fs.defaultFS instead
+                conf.remove(XOozieClient.NN);
+                conf.setProperty(XOozieClient.NN_2, nn);
+                try {
+                    wc.submitMapReduce(conf);
+                    fail("submit client without LIBPATH should throw 
exception");
                 }
                 catch (RuntimeException exception) {
                     assertEquals("java.lang.RuntimeException: libpath is not 
specified in conf", exception.toString());
                 }
-
-                File tmp = new File("target");
-                int startPosition = 
libPath.toString().indexOf(tmp.getAbsolutePath());
-                String localPath = libPath.toString().substring(startPosition);
-
-                wc.setLib(conf, libPath.toString());
 
                 conf.setProperty(OozieClient.LIBPATH, localPath.substring(1));
-
                 try {
                     wc.submitMapReduce(conf);
                     fail("lib path can not be relative");
@@ -158,7 +166,8 @@ public class TestWorkflowXClient extends
                 catch (RuntimeException e) {
                     assertEquals("java.lang.RuntimeException: libpath should 
be absolute", e.toString());
                 }
-                wc.setLib(conf, libPath.toString());
+
+                conf.setProperty(OozieClient.LIBPATH, localPath);
 
                 assertEquals(MockDagEngineService.JOB_ID + wfCount + 
MockDagEngineService.JOB_ID_END,
                         wc.submitMapReduce(conf));

Modified: oozie/trunk/release-log.txt
URL: 
http://svn.apache.org/viewvc/oozie/trunk/release-log.txt?rev=1485330&r1=1485329&r2=1485330&view=diff
==============================================================================
--- oozie/trunk/release-log.txt (original)
+++ oozie/trunk/release-log.txt Wed May 22 18:46:00 2013
@@ -1,5 +1,6 @@
 -- Oozie 4.1.0 release (trunk - unreleased)
 
+OOZIE-1386 NPE in XOozieClient if fs.default.name is not defined but 
fs.defaultFS is (wypoon via rkanter)
 OOZIE-1387 Proxysubmission from the Oozie client doesn't allow the mapreduce 
API (rkanter)
 OOZIE-1244 SLA Support in Oozie (mona)
 OOZIE-1371 oozie.coord.action.notification.url has no documentation (rkanter)


Reply via email to