ApiResponseSerializer: Skip extra boxing for Auth responses

Signed-off-by: Rohit Yadav <rohit.ya...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b587291d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b587291d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b587291d

Branch: refs/heads/master
Commit: b587291d55aa734fcae1ac99c19f62edb5e18691
Parents: d29f467
Author: Rohit Yadav <rohit.ya...@shapeblue.com>
Authored: Tue Aug 12 07:32:38 2014 +0200
Committer: Rohit Yadav <rohit.ya...@shapeblue.com>
Committed: Tue Aug 12 12:01:30 2014 +0200

----------------------------------------------------------------------
 .../api/response/ApiResponseSerializer.java     | 44 ++++++++++----------
 1 file changed, 21 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b587291d/server/src/com/cloud/api/response/ApiResponseSerializer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/response/ApiResponseSerializer.java 
b/server/src/com/cloud/api/response/ApiResponseSerializer.java
index 482834a..5b0a46b 100644
--- a/server/src/com/cloud/api/response/ApiResponseSerializer.java
+++ b/server/src/com/cloud/api/response/ApiResponseSerializer.java
@@ -16,40 +16,38 @@
 // under the License.
 package com.cloud.api.response;
 
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.log4j.Logger;
-
+import com.cloud.api.ApiDBUtils;
+import com.cloud.api.ApiResponseGsonHelper;
+import com.cloud.api.ApiServer;
+import com.cloud.serializer.Param;
+import com.cloud.user.Account;
+import com.cloud.utils.encoding.URLEncoder;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.utils.exception.ExceptionProxyObject;
 import com.google.gson.Gson;
 import com.google.gson.annotations.SerializedName;
-
 import org.apache.cloudstack.acl.RoleType;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.ResponseObject;
 import org.apache.cloudstack.api.response.AsyncJobResponse;
+import org.apache.cloudstack.api.response.AuthenticationCmdResponse;
 import org.apache.cloudstack.api.response.CreateCmdResponse;
 import org.apache.cloudstack.api.response.ExceptionResponse;
 import org.apache.cloudstack.api.response.ListResponse;
 import org.apache.cloudstack.api.response.SuccessResponse;
 import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
 
-import com.cloud.api.ApiDBUtils;
-import com.cloud.api.ApiResponseGsonHelper;
-import com.cloud.api.ApiServer;
-import com.cloud.serializer.Param;
-import com.cloud.user.Account;
-import com.cloud.utils.encoding.URLEncoder;
-import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.exception.ExceptionProxyObject;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 public class ApiResponseSerializer {
     private static final Logger s_logger = 
Logger.getLogger(ApiResponseSerializer.class.getName());
@@ -120,7 +118,7 @@ public class ApiResponseSerializer {
                 String jsonStr = gson.toJson(result);
                 if ((jsonStr != null) && !"".equals(jsonStr)) {
                     jsonStr = unescape(jsonStr);
-                    if (result instanceof AsyncJobResponse || result 
instanceof CreateCmdResponse) {
+                    if (result instanceof AsyncJobResponse || result 
instanceof CreateCmdResponse || result instanceof AuthenticationCmdResponse) {
                         sb.append(jsonStr);
                     } else {
                         sb.append(" { 
\"").append(result.getObjectName()).append("\" : ").append(jsonStr).append(" } 
");
@@ -153,7 +151,7 @@ public class ApiResponseSerializer {
                 }
             }
         } else {
-            if (result instanceof CreateCmdResponse || result instanceof 
AsyncJobResponse) {
+            if (result instanceof CreateCmdResponse || result instanceof 
AsyncJobResponse || result instanceof AuthenticationCmdResponse) {
                 serializeResponseObjFieldsXML(sb, result);
             } else {
                 serializeResponseObjXML(sb, result);

Reply via email to