azkaban-aplcache

Details

diff --git a/azkaban-common/src/main/java/azkaban/jobExecutor/AbstractProcessJob.java b/azkaban-common/src/main/java/azkaban/jobExecutor/AbstractProcessJob.java
index b1c7c8d..831e49b 100644
--- a/azkaban-common/src/main/java/azkaban/jobExecutor/AbstractProcessJob.java
+++ b/azkaban-common/src/main/java/azkaban/jobExecutor/AbstractProcessJob.java
@@ -43,7 +43,7 @@ public abstract class AbstractProcessJob extends AbstractJob {
   public static final String JOB_PROP_ENV = "JOB_PROP_FILE";
   public static final String JOB_NAME_ENV = "JOB_NAME";
   public static final String JOB_OUTPUT_PROP_FILE = "JOB_OUTPUT_PROP_FILE";
-  private static final String SENSITIVE_JOB_PROP_NAME_SURFFIX = "_X";
+  private static final String SENSITIVE_JOB_PROP_NAME_SUFFIX = "_X";
   private static final String SENSITIVE_JOB_PROP_VALUE_PLACEHOLDER = "[MASKED]";
   private static final String JOB_DUMP_PROPERTIES_IN_LOG = "job.dump.properties";
 
@@ -88,16 +88,16 @@ public abstract class AbstractProcessJob extends AbstractJob {
    * prints the current Job props to the Job log.
    */
   protected void logJobProperties() {
-    if (this.jobProps != null && 
+    if (this.jobProps != null &&
         this.jobProps.getBoolean(JOB_DUMP_PROPERTIES_IN_LOG, false)){
       try {
         Map<String,String> flattenedProps = this.jobProps.getFlattened();
         this.info("******   Job properties   ******");
         this.info(String.format("- Note : value is masked if property name ends with '%s'.",
-            SENSITIVE_JOB_PROP_NAME_SURFFIX ));
+            SENSITIVE_JOB_PROP_NAME_SUFFIX ));
         for(Map.Entry<String, String> entry : flattenedProps.entrySet()){
           String key = entry.getKey();
-          String value = key.endsWith(SENSITIVE_JOB_PROP_NAME_SURFFIX)?
+          String value = key.endsWith(SENSITIVE_JOB_PROP_NAME_SUFFIX)?
                                       SENSITIVE_JOB_PROP_VALUE_PLACEHOLDER :
                                       entry.getValue();
           this.info(String.format("%s=%s",key,value));
diff --git a/azkaban-common/src/main/java/azkaban/utils/Props.java b/azkaban-common/src/main/java/azkaban/utils/Props.java
index df28056..68fcbd3 100644
--- a/azkaban-common/src/main/java/azkaban/utils/Props.java
+++ b/azkaban-common/src/main/java/azkaban/utils/Props.java
@@ -812,27 +812,16 @@ public class Props {
   }
 
   /**
-   * Returns a map of all the flattened properties
+   * Returns a map of all the flattened properties, the item in the returned map is sorted alphabetically
+   * by the key value.
+   *
    *
    * @Return
    */
   public Map<String,String> getFlattened(){
-
-    // creating a treeMap here so that the flattened list can be sorted
-    // alphabetically by the key value.
-    Map<String,String> returnVal = new TreeMap<String,String>();
-
-    // to keep the logic in sync with the rest piece of code,
-    // when there is a conflict, value from the child takes the priority.
-    for (Props curr = this; curr != null; curr = curr.getParent()) {
-      for (String key : curr.localKeySet()) {
-          if (!returnVal.containsKey(key)){
-            returnVal.put(key, curr.get(key));
-          }
-        }
-      }
-
-    return returnVal;
+    TreeMap<String,String> returnVal = new TreeMap<String,String>(); 
+    returnVal.putAll(getMapByPrefix(""));
+    return returnVal; 
   }
 
   /**
@@ -841,15 +830,10 @@ public class Props {
    * @param prefix The string prefix
    */
   public Map<String, String> getMapByPrefix(String prefix) {
-    Map<String, String> values = new HashMap<String, String>();
-
-    if (_parent != null) {
-      for (Map.Entry<String, String> entry : _parent.getMapByPrefix(prefix)
-          .entrySet()) {
-        values.put(entry.getKey(), entry.getValue());
-      }
-    }
+    Map<String, String> values = _parent == null ? new HashMap<String, String>():
+                                                   _parent.getMapByPrefix(prefix);
 
+    // when there is a conflict, value from the child takes the priority.
     for (String key : this.localKeySet()) {
       if (key.startsWith(prefix)) {
         values.put(key.substring(prefix.length()), get(key));