From: Marco Zanon Date: Wed, 1 Feb 2012 18:31:42 +0000 (+0000) Subject: Modified code to be slightly more logic. X-Git-Tag: SVN-to-Git~159 X-Git-Url: https://gitweb.marcozanon.com/?a=commitdiff_plain;h=08111d145c744a8161a7b6fd877a2e34b4da194c;p=Macaco Modified code to be slightly more logic. --- diff --git a/src/java/com/marcozanon/macaco/web/ui/MWebApplicationServlet.java b/src/java/com/marcozanon/macaco/web/ui/MWebApplicationServlet.java index c04a63c..8a08959 100644 --- a/src/java/com/marcozanon/macaco/web/ui/MWebApplicationServlet.java +++ b/src/java/com/marcozanon/macaco/web/ui/MWebApplicationServlet.java @@ -201,17 +201,17 @@ public abstract class MWebApplicationServlet extends MHttpServlet { // prepare response content byte[] responseContent = null; if (ajaxMode) { - MJsonObject returnValue = null; try { + MJsonObject returnValue = null; returnValue = new MJsonObject(); returnValue.setValue("errorMode", new MJsonNumber("" + MWebApplicationServlet.ErrorMode.CLEAN.ordinal())); MJsonString jsonParameter = new MJsonString(); jsonParameter.setValue(new String(content, MInformation.TEXT_ENCODING)); returnValue.setValue("parameter", jsonParameter); + responseContent = returnValue.getJsonValue().getBytes(MInformation.TEXT_ENCODING); } catch (MInvalidValueJsonException exception) { // cannot happen } - responseContent = returnValue.getJsonValue().getBytes(MInformation.TEXT_ENCODING); } else { responseContent = content; @@ -241,8 +241,8 @@ public abstract class MWebApplicationServlet extends MHttpServlet { try { if (MWebApplicationServlet.ErrorMode.DEBUG == errorMode) { if (ajaxMode) { - MJsonObject returnValue = null; try { + MJsonObject returnValue = null; returnValue = new MJsonObject(); returnValue.setValue("errorMode", new MJsonNumber("" + errorMode.ordinal())); MJsonString jsonParameter = new MJsonString(); @@ -253,10 +253,10 @@ public abstract class MWebApplicationServlet extends MHttpServlet { jsonParameter.setValue(content.getClass().getName()); } returnValue.setValue("parameter", jsonParameter); + responseContent = returnValue.getJsonValue().getBytes(MInformation.TEXT_ENCODING); } catch (MInvalidValueJsonException exception) { // should not happen } - responseContent = returnValue.getJsonValue().getBytes(MInformation.TEXT_ENCODING); } else { if (null != content.getMessage()) {