You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by ge...@apache.org on 2017/03/22 20:31:38 UTC

oozie git commit: fix issues from reviewboard

Repository: oozie
Updated Branches:
  refs/heads/oya 8315fb749 -> bec5536a9


fix issues from reviewboard


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

Branch: refs/heads/oya
Commit: bec5536a9ee84ab7c632c1331c26ce1d67b80ff7
Parents: 8315fb7
Author: Gezapeti Cseh <ge...@gmail.com>
Authored: Wed Mar 22 21:31:31 2017 +0100
Committer: Gezapeti Cseh <ge...@gmail.com>
Committed: Wed Mar 22 21:31:31 2017 +0100

----------------------------------------------------------------------
 .../hadoop/CredentialsProviderFactory.java      |  4 ++--
 .../oozie/action/hadoop/JavaActionExecutor.java |  2 +-
 .../action/hadoop/MapReduceActionExecutor.java  |  8 +++++---
 .../java/org/apache/oozie/service/Services.java |  3 ++-
 .../src/main/resources/META-INF/persistence.xml |  9 ++++-----
 .../action/hadoop/TestJavaActionExecutor.java   | 14 +++++++------
 .../apache/oozie/command/wf/HangServlet.java    |  2 +-
 .../apache/oozie/action/hadoop/JavaMain.java    |  5 +----
 .../oozie/action/hadoop/LauncherMain.java       | 21 ++++++++++++++++++++
 .../action/hadoop/LauncherAMTestMainClass.java  | 19 +++++++++---------
 .../apache/oozie/action/hadoop/SqoopMain.java   |  6 +-----
 11 files changed, 56 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/bec5536a/core/src/main/java/org/apache/oozie/action/hadoop/CredentialsProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/action/hadoop/CredentialsProviderFactory.java b/core/src/main/java/org/apache/oozie/action/hadoop/CredentialsProviderFactory.java
index aa849ad..43905b1 100644
--- a/core/src/main/java/org/apache/oozie/action/hadoop/CredentialsProviderFactory.java
+++ b/core/src/main/java/org/apache/oozie/action/hadoop/CredentialsProviderFactory.java
@@ -34,7 +34,7 @@ public class CredentialsProviderFactory {
     public CredentialsProviderFactory(String type) {
         this.type = type;
         this.cred = null;
-        LOG.debug("Credentials Provider is created for Type: " + type);
+        LOG.debug("Credentials Provider is created for Type: {0}", type);
     }
 
     /**
@@ -54,7 +54,7 @@ public class CredentialsProviderFactory {
                 type = str[0];
                 classname = str[1];
                 if (classname != null) {
-                    LOG.debug("Creating Credential type : '" + type + "', class Name : '" + classname + "'");
+                    LOG.debug("Creating Credential type : '{0}', class Name : '{1}'", type, classname);
                     if (this.type.equalsIgnoreCase(str[0])) {
                         Class<?> klass = null;
                         try {

http://git-wip-us.apache.org/repos/asf/oozie/blob/bec5536a/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java b/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
index 3a05730..4dc4abd 100644
--- a/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
+++ b/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
@@ -1374,7 +1374,7 @@ public class JavaActionExecutor extends ActionExecutor {
                 }
 
             } catch (Exception ye) {
-                LOG.debug("Exception occurred while checking Launcher AM status; will try checking action data file instead ", ye);
+                LOG.info("Exception occurred while checking Launcher AM status; will try checking action data file instead ", ye);
                 // Fallback to action data file if we can't find the Launcher AM (maybe it got purged)
                 fallback = true;
             }

http://git-wip-us.apache.org/repos/asf/oozie/blob/bec5536a/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java b/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java
index 72695f3..a6f69eb 100644
--- a/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java
+++ b/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java
@@ -63,6 +63,7 @@ public class MapReduceActionExecutor extends JavaActionExecutor {
     public static final String HADOOP_COUNTERS = "hadoop.counters";
     public static final String OOZIE_MAPREDUCE_UBER_JAR_ENABLE = "oozie.action.mapreduce.uber.jar.enable";
     private static final String STREAMING_MAIN_CLASS_NAME = "org.apache.oozie.action.hadoop.StreamingMain";
+    public static final String JOB_END_NOTIFICATION_URL = "job.end.notification.url";
     private XLog log = XLog.getLog(getClass());
 
     public MapReduceActionExecutor() {
@@ -315,10 +316,11 @@ public class MapReduceActionExecutor extends JavaActionExecutor {
     protected void injectCallback(Context context, Configuration conf) {
         // add callback for the MapReduce job
         String callback = context.getCallbackUrl("$jobStatus");
-        if (conf.get("job.end.notification.url") != null) {
-            LOG.warn("Overriding the action job end notification URI");
+        String oriiginalCallbackURL = conf.get(JOB_END_NOTIFICATION_URL);
+        if (oriiginalCallbackURL != null) {
+            LOG.warn("Overriding the action job end notification URI. Original value: {0}", oriiginalCallbackURL);
         }
-        conf.set("job.end.notification.url", callback);
+        conf.set(JOB_END_NOTIFICATION_URL, callback);
 
         super.injectCallback(context, conf);
     }

http://git-wip-us.apache.org/repos/asf/oozie/blob/bec5536a/core/src/main/java/org/apache/oozie/service/Services.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/service/Services.java b/core/src/main/java/org/apache/oozie/service/Services.java
index 573960c..f5c89b3 100644
--- a/core/src/main/java/org/apache/oozie/service/Services.java
+++ b/core/src/main/java/org/apache/oozie/service/Services.java
@@ -305,7 +305,8 @@ public class Services {
             }
         } catch (RuntimeException rex) {
             rex.printStackTrace();
-            log.fatal("Runtime Exception during Services Load. Check your list of '" + CONF_SERVICE_CLASSES + "' or '" + CONF_SERVICE_EXT_CLASSES + "'");
+            log.fatal("Runtime Exception during Services Load. Check your list of '{0}' or '{1}'", CONF_SERVICE_CLASSES, CONF_SERVICE_EXT_CLASSES);
+            log.fatal("Runtime Exception during Services load: {0}", rex);
             throw new ServiceException(ErrorCode.E0103, rex.getMessage(), rex);
         }
     }

http://git-wip-us.apache.org/repos/asf/oozie/blob/bec5536a/core/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/persistence.xml b/core/src/main/resources/META-INF/persistence.xml
index a2b0f2b..bad9278 100644
--- a/core/src/main/resources/META-INF/persistence.xml
+++ b/core/src/main/resources/META-INF/persistence.xml
@@ -7,9 +7,9 @@
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at
-  
+
        http://www.apache.org/licenses/LICENSE-2.0
-  
+
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -76,7 +76,6 @@
             <property name="openjpa.jdbc.DBDictionary" value="batchLimit=50"/>
             <property name="openjpa.RuntimeUnenhancedClasses" value="unsupported"/>
             <property name="openjpa.Log" value="log4j"/>
-            <property name="openjpa.ConnectionFactoryProperties" value="PrintParameters=true" />
         </properties>
     </persistence-unit>
 
@@ -124,7 +123,7 @@
                              org.apache.oozie.client.rest.JsonCoordinatorAction;
                              org.apache.oozie.client.rest.JsonBundleJob;
                              org.apache.oozie.util.db.ValidateConnectionBean)"></property>
-                             
+
             <property name="openjpa.DetachState" value="fetch-groups(DetachedStateField=true)"/>
             <property name="openjpa.LockManager" value="pessimistic"/>
             <property name="openjpa.ReadLockLevel" value="read"/>
@@ -227,7 +226,7 @@
 
             <property name="openjpa.ConnectionProperties" value="**INVALID**"/> <!--Set by StoreService at init time -->
 
-            <property name="openjpa.MetaDataFactory" 
+            <property name="openjpa.MetaDataFactory"
                       value="jpa(Types=org.apache.oozie.WorkflowActionBean;
                 org.apache.oozie.WorkflowJobBean;
                 org.apache.oozie.CoordinatorJobBean;

http://git-wip-us.apache.org/repos/asf/oozie/blob/bec5536a/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java b/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
index 89f3099..d6a44a0 100644
--- a/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
+++ b/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
@@ -76,6 +76,8 @@ import org.junit.Test;
 
 public class TestJavaActionExecutor extends ActionExecutorTestCase {
 
+    public static final String YARN_RESOURCEMANAGER_ADDRESS = "yarn.resourcemanager.address";
+
     @Override
     protected void beforeSetUp() throws Exception {
         super.beforeSetUp();
@@ -110,7 +112,7 @@ public class TestJavaActionExecutor extends ActionExecutorTestCase {
         }
 
         conf = new XConfiguration();
-        conf.set("yarn.resourcemanager.address", "a");
+        conf.set(YARN_RESOURCEMANAGER_ADDRESS, "a");
         try {
             JavaActionExecutor.checkForDisallowedProps(conf, "x");
             fail();
@@ -197,7 +199,7 @@ public class TestJavaActionExecutor extends ActionExecutorTestCase {
 
         conf = ae.createBaseHadoopConf(context, actionXml);
         assertEquals(protoConf.get(WorkflowAppService.HADOOP_USER), conf.get(WorkflowAppService.HADOOP_USER));
-        assertEquals(getJobTrackerUri(), conf.get("yarn.resourcemanager.address"));
+        assertEquals(getJobTrackerUri(), conf.get(YARN_RESOURCEMANAGER_ADDRESS));
         assertEquals(getNameNodeUri(), conf.get("fs.default.name"));
 
         conf = ae.createBaseHadoopConf(context, actionXml);
@@ -2253,9 +2255,9 @@ public class TestJavaActionExecutor extends ActionExecutorTestCase {
 
         Configuration conf = new Configuration(false);
         Assert.assertEquals(0, conf.size());
-        conf.set("yarn.resourcemanager.address", getJobTrackerUri());
+        conf.set(YARN_RESOURCEMANAGER_ADDRESS, getJobTrackerUri());
         ae.setupLauncherConf(conf, actionXmlWithConfiguration, null, null);
-        assertEquals(getJobTrackerUri(), conf.get("yarn.resourcemanager.address"));
+        assertEquals(getJobTrackerUri(), conf.get(YARN_RESOURCEMANAGER_ADDRESS));
         assertEquals("AA", conf.get("oozie.launcher.a"));
         assertEquals("AA", conf.get("a"));
         assertEquals("action.barbar", conf.get("oozie.launcher.action.foofoo"));
@@ -2264,9 +2266,9 @@ public class TestJavaActionExecutor extends ActionExecutorTestCase {
 
         conf = new Configuration(false);
         Assert.assertEquals(0, conf.size());
-        conf.set("yarn.resourcemanager.address", getJobTrackerUri());
+        conf.set(YARN_RESOURCEMANAGER_ADDRESS, getJobTrackerUri());
         ae.setupLauncherConf(conf, actionXmlWithoutConfiguration, null, null);
-        assertEquals(getJobTrackerUri(), conf.get("yarn.resourcemanager.address"));
+        assertEquals(getJobTrackerUri(), conf.get(YARN_RESOURCEMANAGER_ADDRESS));
         assertEquals("action.barbar", conf.get("oozie.launcher.action.foofoo"));
         assertEquals("action.barbar", conf.get("action.foofoo"));
         assertEquals(3, conf.size());

http://git-wip-us.apache.org/repos/asf/oozie/blob/bec5536a/core/src/test/java/org/apache/oozie/command/wf/HangServlet.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/oozie/command/wf/HangServlet.java b/core/src/test/java/org/apache/oozie/command/wf/HangServlet.java
index d90aeb6..c1bca16 100644
--- a/core/src/test/java/org/apache/oozie/command/wf/HangServlet.java
+++ b/core/src/test/java/org/apache/oozie/command/wf/HangServlet.java
@@ -46,7 +46,7 @@ public class HangServlet extends HttpServlet {
                     XLog.getLog(HangServlet.class).error("Invalid sleep time, using default (200)", nfe);
                 }
             }
-            XLog.getLog(HangServlet.class).info("Sleeping for " + time + " ms");
+            XLog.getLog(HangServlet.class).info("Sleeping for {0} ms", time);
             Thread.sleep(time);
         }
         catch (Exception ex) {

http://git-wip-us.apache.org/repos/asf/oozie/blob/bec5536a/sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/JavaMain.java
----------------------------------------------------------------------
diff --git a/sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/JavaMain.java b/sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/JavaMain.java
index 0815318..3b4e0a6 100644
--- a/sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/JavaMain.java
+++ b/sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/JavaMain.java
@@ -48,10 +48,7 @@ public class JavaMain extends LauncherMain {
 
         Class<?> klass = actionConf.getClass(JAVA_MAIN_CLASS, Object.class);
         System.out.println("Java action main class        : " + klass.getName());
-        System.out.println("Java action arguments         :");
-        for (String arg : args) {
-            System.out.println("                    " + arg);
-        }
+        printArgs("Java action arguments         :", args);
         System.out.println();
         Method mainMethod = klass.getMethod("main", String[].class);
         try {

http://git-wip-us.apache.org/repos/asf/oozie/blob/bec5536a/sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/LauncherMain.java
----------------------------------------------------------------------
diff --git a/sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/LauncherMain.java b/sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/LauncherMain.java
index d21b49a..58051d1 100644
--- a/sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/LauncherMain.java
+++ b/sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/LauncherMain.java
@@ -349,6 +349,27 @@ public abstract class LauncherMain {
         }
         copyFileMultiplex(actionXmlFile, dstFiles);
     }
+    /**
+     * Print arguments to standard output stream. Mask out argument values to option with name 'password' in them.
+     * @param banner source banner
+     * @param args arguments to be printed
+     */
+    void printArgs(String banner, String[] args) {
+        System.out.println(banner);
+        boolean maskNextArg = false;
+        for (String arg : args) {
+            if (maskNextArg) {
+                System.out.println("             " + "********");
+                maskNextArg = false;
+            }
+            else {
+                System.out.println("             " + arg);
+                if (arg.toLowerCase().contains("password")) {
+                    maskNextArg = true;
+                }
+            }
+        }
+    }
 }
 
 class LauncherMainException extends Exception {

http://git-wip-us.apache.org/repos/asf/oozie/blob/bec5536a/sharelib/oozie/src/test/java/org/apache/oozie/action/hadoop/LauncherAMTestMainClass.java
----------------------------------------------------------------------
diff --git a/sharelib/oozie/src/test/java/org/apache/oozie/action/hadoop/LauncherAMTestMainClass.java b/sharelib/oozie/src/test/java/org/apache/oozie/action/hadoop/LauncherAMTestMainClass.java
index 8752684..6deca64 100644
--- a/sharelib/oozie/src/test/java/org/apache/oozie/action/hadoop/LauncherAMTestMainClass.java
+++ b/sharelib/oozie/src/test/java/org/apache/oozie/action/hadoop/LauncherAMTestMainClass.java
@@ -32,15 +32,16 @@ public class LauncherAMTestMainClass {
     public static void main(String args[]) throws Throwable {
         System.out.println("Invocation of TestMain");
 
-        if (args != null && args.length > 0) {
-            if (args[0].equals(JAVA_EXCEPTION)) {
-                throw new JavaMainException(new RuntimeException(JAVA_EXCEPTION_MESSAGE));
-            } else if (args[0].equals(LAUNCHER_EXCEPTION)) {
-                throw new LauncherMainException(LAUNCHER_ERROR_CODE);
-            } else if (args[0].equals(SECURITY_EXCEPTION)) {
-                throw new SecurityException(SECURITY_EXCEPTION_MESSAGE);
-            } else if (args[0].equals(THROWABLE)) {
-                throw new Throwable(THROWABLE_MESSAGE);
+        if (args != null && args.length == 1) {
+            switch (args[0]){
+                case JAVA_EXCEPTION:
+                    throw new JavaMainException(new RuntimeException(JAVA_EXCEPTION_MESSAGE));
+                case LAUNCHER_EXCEPTION:
+                    throw new LauncherMainException(LAUNCHER_ERROR_CODE);
+                case SECURITY_EXCEPTION:
+                    throw new SecurityException(SECURITY_EXCEPTION_MESSAGE);
+                case THROWABLE:
+                    throw new Throwable(THROWABLE_MESSAGE);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/oozie/blob/bec5536a/sharelib/sqoop/src/main/java/org/apache/oozie/action/hadoop/SqoopMain.java
----------------------------------------------------------------------
diff --git a/sharelib/sqoop/src/main/java/org/apache/oozie/action/hadoop/SqoopMain.java b/sharelib/sqoop/src/main/java/org/apache/oozie/action/hadoop/SqoopMain.java
index ebb94cc..bebd95d 100644
--- a/sharelib/sqoop/src/main/java/org/apache/oozie/action/hadoop/SqoopMain.java
+++ b/sharelib/sqoop/src/main/java/org/apache/oozie/action/hadoop/SqoopMain.java
@@ -170,11 +170,7 @@ public class SqoopMain extends LauncherMain {
             throw new RuntimeException("Action Configuration does not have [" + SqoopActionExecutor.SQOOP_ARGS + "] property");
         }
 
-        System.out.println("Sqoop command arguments :");
-        for (String arg : sqoopArgs) {
-            System.out.println("             " + arg);
-        }
-
+        printArgs("Sqoop command arguments :", sqoopArgs);
         LauncherMain.killChildYarnJobs(sqoopConf);
 
         System.out.println("=================================================================");