apex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vro...@apache.org
Subject [12/50] [abbrv] incubator-apex-core git commit: APEX-112 #resolve null values should not converted to the string "null", and added null check on the beanutils converters
Date Thu, 24 Sep 2015 02:37:31 GMT
APEX-112 #resolve null values should not converted to the string "null", and added null check
on the beanutils converters


Project: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/commit/ac25fbaa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/tree/ac25fbaa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/diff/ac25fbaa

Branch: refs/heads/feature-module
Commit: ac25fbaa63844e6760a90711a956402388cd22fa
Parents: 6c24259
Author: David Yan <david@datatorrent.com>
Authored: Thu Sep 10 16:27:46 2015 -0700
Committer: David Yan <david@datatorrent.com>
Committed: Thu Sep 10 16:49:52 2015 -0700

----------------------------------------------------------------------
 .../src/main/java/com/datatorrent/stram/StringCodecs.java   | 9 ++++++---
 .../java/com/datatorrent/stram/webapp/StramWebServices.java | 4 ++--
 2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/ac25fbaa/engine/src/main/java/com/datatorrent/stram/StringCodecs.java
----------------------------------------------------------------------
diff --git a/engine/src/main/java/com/datatorrent/stram/StringCodecs.java b/engine/src/main/java/com/datatorrent/stram/StringCodecs.java
index eb31c3d..0d5e359 100644
--- a/engine/src/main/java/com/datatorrent/stram/StringCodecs.java
+++ b/engine/src/main/java/com/datatorrent/stram/StringCodecs.java
@@ -54,6 +54,9 @@ public class StringCodecs
       @SuppressWarnings("unchecked")
       public Object convert(Class type, Object value)
       {
+        if (value == null) {
+          return null;
+        }
         for (Class<?> clazz = value.getClass(); clazz != null; clazz = clazz.getSuperclass())
{
           Class<? extends StringCodec> codec = codecs.get(clazz);
           if (codec == null) {
@@ -84,7 +87,7 @@ public class StringCodecs
       @Override
       public Object convert(Class type, Object value)
       {
-        return URI.create(value.toString());
+        return value == null ? null : URI.create(value.toString());
       }
     }, URI.class);
   }
@@ -124,7 +127,7 @@ public class StringCodecs
             @Override
             public Object convert(Class type, Object value)
             {
-              return codecInstance.fromString(value.toString());
+              return value == null ? null : codecInstance.fromString(value.toString());
             }
 
           }, entry.getKey());
@@ -150,7 +153,7 @@ public class StringCodecs
       @Override
       public Object convert(Class type, Object value)
       {
-        return codecInstance.fromString(value.toString());
+        return value == null ? null : codecInstance.fromString(value.toString());
       }
 
     }, clazz);

http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/ac25fbaa/engine/src/main/java/com/datatorrent/stram/webapp/StramWebServices.java
----------------------------------------------------------------------
diff --git a/engine/src/main/java/com/datatorrent/stram/webapp/StramWebServices.java b/engine/src/main/java/com/datatorrent/stram/webapp/StramWebServices.java
index 97edf39..117681e 100644
--- a/engine/src/main/java/com/datatorrent/stram/webapp/StramWebServices.java
+++ b/engine/src/main/java/com/datatorrent/stram/webapp/StramWebServices.java
@@ -554,7 +554,7 @@ public class StramWebServices
       Iterator<String> keys = request.keys();
       while (keys.hasNext()) {
         String key = keys.next();
-        String val = request.getString(key);
+        String val = request.isNull(key) ? null : request.getString(key);
         LOG.debug("Setting property for {}: {}={}", operatorName, key, val);
         dagManager.setOperatorProperty(operatorName, key, val);
       }
@@ -582,7 +582,7 @@ public class StramWebServices
       Iterator<String> keys = request.keys();
       while (keys.hasNext()) {
         String key = keys.next();
-        String val = request.getString(key);
+        String val = request.isNull(key) ? null : request.getString(key);
         dagManager.setPhysicalOperatorProperty(operatorId, key, val);
       }
     }


Mime
View raw message