Return-Path: Delivered-To: apmail-tuscany-commits-archive@www.apache.org Received: (qmail 98726 invoked from network); 2 Oct 2010 18:48:15 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 2 Oct 2010 18:48:15 -0000 Received: (qmail 28457 invoked by uid 500); 2 Oct 2010 18:48:15 -0000 Delivered-To: apmail-tuscany-commits-archive@tuscany.apache.org Received: (qmail 28427 invoked by uid 500); 2 Oct 2010 18:48:14 -0000 Mailing-List: contact commits-help@tuscany.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tuscany.apache.org Delivered-To: mailing list commits@tuscany.apache.org Received: (qmail 28420 invoked by uid 99); 2 Oct 2010 18:48:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Oct 2010 18:48:14 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Oct 2010 18:48:14 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 6759D23889B9; Sat, 2 Oct 2010 18:47:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1003856 - /tuscany/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 Date: Sat, 02 Oct 2010 18:47:54 -0000 To: commits@tuscany.apache.org From: lresende@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101002184754.6759D23889B9@eris.apache.org> Author: lresende Date: Sat Oct 2 18:47:54 2010 New Revision: 1003856 URL: http://svn.apache.org/viewvc?rev=1003856&view=rev Log: Fixing databinding issue when submitting empty strings from js client to a json-rpc service Modified: tuscany/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 Modified: tuscany/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 URL: http://svn.apache.org/viewvc/tuscany/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?rev=1003856&r1=1003855&r2=1003856&view=diff ============================================================================== --- tuscany/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 (original) +++ tuscany/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 Sat Oct 2 18:47:54 2010 @@ -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 Pull 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) {