diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-10-02 18:47:54 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-10-02 18:47:54 +0000 |
commit | 553e343a0dd37a5c83bb3fe4b09bd1dd28230cd2 (patch) | |
tree | 809f55f70d31eadfc4efc7afac5e451311fcc4c5 /sca-java-2.x/branches/sca-java-2.0-M5/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/jackson/JSON2Object.java | |
parent | 3415d6a774a65984893639921ce8d3665102e53e (diff) |
Fixing databinding issue when submitting empty strings from js client to a json-rpc service
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1003856 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/branches/sca-java-2.0-M5/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/jackson/JSON2Object.java')
-rw-r--r-- | sca-java-2.x/branches/sca-java-2.0-M5/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/jackson/JSON2Object.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sca-java-2.x/branches/sca-java-2.0-M5/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/jackson/JSON2Object.java b/sca-java-2.x/branches/sca-java-2.0-M5/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/jackson/JSON2Object.java index 3620fc117f..ca28ec5833 100644 --- a/sca-java-2.x/branches/sca-java-2.0-M5/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/jackson/JSON2Object.java +++ b/sca-java-2.x/branches/sca-java-2.0-M5/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/jackson/JSON2Object.java @@ -6,15 +6,15 @@ * 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. See the License for the * specific language governing permissions and limitations - * under the License. + * under the License. */ package org.apache.tuscany.sca.databinding.json.jackson; @@ -49,7 +49,12 @@ public class JSON2Object implements PullTransformer<Object, Object> { try { JavaType javaType = TypeFactory.type(context.getTargetDataType().getGenericType()); if (source instanceof String) { - return mapper.readValue((String)source, javaType); + String sourceString = (String) source; + if(sourceString.isEmpty()) { + return sourceString; + } else { + return mapper.readValue((String)source, javaType); + } } else if (source instanceof JsonNode) { return mapper.treeToValue((JsonNode)source, context.getTargetDataType().getPhysical()); } else if (source instanceof JsonParser) { |