You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2010/08/31 14:29:46 UTC

svn commit: r991170 - /tuscany/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultWireFormatServiceInterceptor.java

Author: antelder
Date: Tue Aug 31 12:29:46 2010
New Revision: 991170

URL: http://svn.apache.org/viewvc?rev=991170&view=rev
Log:
Correctly increment the type index, and handle null response

Modified:
    tuscany/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultWireFormatServiceInterceptor.java

Modified: tuscany/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultWireFormatServiceInterceptor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultWireFormatServiceInterceptor.java?rev=991170&r1=991169&r2=991170&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultWireFormatServiceInterceptor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultWireFormatServiceInterceptor.java Tue Aug 31 12:29:46 2010
@@ -154,7 +154,7 @@ public class HTTPDefaultWireFormatServic
         for (String name : getOrderedParameterNames(servletRequest)) {
             String jsonRequest = "";
             // quote string parameters so clients work in the usual javascript way               
-            if (typesIndex < types.size() && String.class.equals(types.get(typesIndex).getGenericType())) {
+            if (typesIndex < types.size() && String.class.equals(types.get(typesIndex++).getGenericType())) {
                 String x = servletRequest.getParameter(name);
                 if (x.startsWith("\"") || x.startsWith("'")) {
                     jsonRequest += x;
@@ -219,7 +219,7 @@ public class HTTPDefaultWireFormatServic
      * add wrap it for return.
      */
     protected String getResponseAsString(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Object response) {
-        String jsonResponse = response.toString();
+        String jsonResponse = response == null ? "" : response.toString();
 
         if ("GET".equals(servletRequest.getMethod())) {
             // handle JSONP callback name padding