falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From suh...@apache.org
Subject incubator-falcon git commit: FALCON-320. Whitespace has not been taken into consideration in runtime.properties. Contributed by Ajay Yadav via Suhas Vasu
Date Fri, 21 Nov 2014 07:10:07 GMT
Repository: incubator-falcon
Updated Branches:
  refs/heads/master b751da76f -> 7f795ca4b


FALCON-320. Whitespace has not been taken into consideration in runtime.properties. Contributed
by Ajay Yadav via Suhas Vasu


Project: http://git-wip-us.apache.org/repos/asf/incubator-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-falcon/commit/7f795ca4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-falcon/tree/7f795ca4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-falcon/diff/7f795ca4

Branch: refs/heads/master
Commit: 7f795ca4bd4032fb3e17726f8c8369154a23f55c
Parents: b751da7
Author: Suhas V <suhas.v@inmobi.com>
Authored: Fri Nov 21 12:39:45 2014 +0530
Committer: Suhas V <suhas.v@inmobi.com>
Committed: Fri Nov 21 12:39:45 2014 +0530

----------------------------------------------------------------------
 CHANGES.txt                                              |  2 ++
 .../org/apache/falcon/util/ApplicationProperties.java    | 11 +++++++++++
 .../apache/falcon/util/ApplicationPropertiesTest.java    | 11 +++++++++++
 .../apache/falcon/resource/AbstractEntityManager.java    |  3 +++
 4 files changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/7f795ca4/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 57d3f6c..81f6b80 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -59,6 +59,8 @@ Release Version: 0.6-incubating
    FALCON-263 API to get workflow parameters. (pavan kumar kolamuri via Shwetha GS)
 
   IMPROVEMENTS
+   FALCON-320 Whitespace has not been taken into consideration in runtime.properties
+
    FALCON-766 Falcon workflow rerun by default should rerun only Failed nodes
    and remove continue option (Shaik Idris Ali via Venkatesh Seetharam)
 

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/7f795ca4/common/src/main/java/org/apache/falcon/util/ApplicationProperties.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/falcon/util/ApplicationProperties.java b/common/src/main/java/org/apache/falcon/util/ApplicationProperties.java
index bd87e0d..6d89199 100644
--- a/common/src/main/java/org/apache/falcon/util/ApplicationProperties.java
+++ b/common/src/main/java/org/apache/falcon/util/ApplicationProperties.java
@@ -19,6 +19,7 @@
 package org.apache.falcon.util;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
 import org.apache.falcon.FalconException;
 import org.apache.falcon.expression.ExpressionHelper;
 import org.slf4j.Logger;
@@ -161,4 +162,14 @@ public abstract class ApplicationProperties extends Properties {
         }
         return keys;
     }
+
+    @Override
+    public String getProperty(String key) {
+        return StringUtils.trim(super.getProperty(key));
+    }
+
+    @Override
+    public String getProperty(String key, String defaultValue) {
+        return StringUtils.trim(super.getProperty(key, defaultValue));
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/7f795ca4/common/src/test/java/org/apache/falcon/util/ApplicationPropertiesTest.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/falcon/util/ApplicationPropertiesTest.java b/common/src/test/java/org/apache/falcon/util/ApplicationPropertiesTest.java
index c11481a..d899d53 100644
--- a/common/src/test/java/org/apache/falcon/util/ApplicationPropertiesTest.java
+++ b/common/src/test/java/org/apache/falcon/util/ApplicationPropertiesTest.java
@@ -55,6 +55,17 @@ public class ApplicationPropertiesTest {
         Assert.assertEquals(classPathLocation.get("test"), "hello world");
     }
 
+    @Test
+    public void testPropertiesWithSpaces() throws Exception{
+        ApplicationProperties properties = new ConfigLocation();
+        properties.put("key1", "value with trailing spaces.  ");
+        properties.put("key2", "  value with leading spaces.");
+        properties.put("key3", "  value with spaces on both ends. ");
+        Assert.assertEquals(properties.getProperty("key1"), "value with trailing spaces.");
+        Assert.assertEquals(properties.getProperty("key2"), "value with leading spaces.");
+        Assert.assertEquals(properties.getProperty("key3"), "value with spaces on both ends.");
+    }
+
     @Test (expectedExceptions = FalconException.class)
     public void testMissingLocation() throws FalconException {
         new MissingLocation().loadProperties();

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/7f795ca4/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java
----------------------------------------------------------------------
diff --git a/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java b/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java
index 7fce88c..8cf4701 100644
--- a/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java
+++ b/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java
@@ -86,6 +86,9 @@ public abstract class AbstractEntityManager {
             return DeploymentUtil.getDefaultColos();
         }
         String[] colos = RuntimeProperties.get().getProperty("all.colos", DeploymentUtil.getDefaultColo()).split(",");
+        for (int i = 0; i < colos.length; i++) {
+            colos[i] = colos[i].trim();
+        }
         return new HashSet<String>(Arrays.asList(colos));
     }
 


Mime
View raw message