From 49eeea3e9ce83c3e583c04a9bbc2b4ff307ec994 Mon Sep 17 00:00:00 2001 From: antelder Date: Tue, 31 Aug 2010 12:29:46 +0000 Subject: Correctly increment the type index, and handle null response git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@991170 13f79535-47bb-0310-9956-ffa450edef68 --- .../binding/http/format/HTTPDefaultWireFormatServiceInterceptor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sca-java-2.x/trunk') diff --git a/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultWireFormatServiceInterceptor.java b/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultWireFormatServiceInterceptor.java index ccd4e03ca6..fcbf8015f8 100644 --- a/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultWireFormatServiceInterceptor.java +++ b/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultWireFormatServiceInterceptor.java @@ -154,7 +154,7 @@ public class HTTPDefaultWireFormatServiceInterceptor implements Interceptor { 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 HTTPDefaultWireFormatServiceInterceptor implements Interceptor { * 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 -- cgit v1.2.3