You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ro...@apache.org on 2025/03/03 20:36:50 UTC

(axis-axis2-java-core) 02/04: Code clean up in JSONMessageHandler classes

This is an automated email from the ASF dual-hosted git repository.

robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit 3fadd47dfc432398839d2250286892b04aa04526
Author: Robert Lazarski <ro...@gmail.com>
AuthorDate: Mon Mar 3 10:02:44 2025 -1000

    Code clean up in JSONMessageHandler classes
---
 modules/json/src/org/apache/axis2/json/gson/JSONMessageHandler.java  | 3 +--
 modules/json/src/org/apache/axis2/json/moshi/JSONMessageHandler.java | 4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/modules/json/src/org/apache/axis2/json/gson/JSONMessageHandler.java b/modules/json/src/org/apache/axis2/json/gson/JSONMessageHandler.java
index 9a5e72732f..f64c90999f 100644
--- a/modules/json/src/org/apache/axis2/json/gson/JSONMessageHandler.java
+++ b/modules/json/src/org/apache/axis2/json/gson/JSONMessageHandler.java
@@ -75,8 +75,7 @@ public class JSONMessageHandler extends AbstractHandler {
             } else {
                 log.debug("JSON MessageReceiver found, proceeding with the JSON request");
                 Object tempObj = msgContext.getProperty(JsonConstant.IS_JSON_STREAM);
-                if (tempObj != null) {
-                    boolean isJSON = Boolean.valueOf(tempObj.toString());
+                if (tempObj != null && Boolean.valueOf(tempObj.toString()) {
                     Object o = msgContext.getProperty(JsonConstant.GSON_XML_STREAM_READER);
                     if (o != null) {
                         GsonXMLStreamReader gsonXMLStreamReader = (GsonXMLStreamReader) o;
diff --git a/modules/json/src/org/apache/axis2/json/moshi/JSONMessageHandler.java b/modules/json/src/org/apache/axis2/json/moshi/JSONMessageHandler.java
index fdacd5da8e..7ad41bb1c8 100644
--- a/modules/json/src/org/apache/axis2/json/moshi/JSONMessageHandler.java
+++ b/modules/json/src/org/apache/axis2/json/moshi/JSONMessageHandler.java
@@ -76,7 +76,6 @@ public class JSONMessageHandler extends AbstractHandler {
                 log.debug("JSON MessageReceiver found, proceeding with the JSON request");
                 Object tempObj = msgContext.getProperty(JsonConstant.IS_JSON_STREAM);
                 if (tempObj != null) {
-                    boolean isJSON = Boolean.valueOf(tempObj.toString());
                     Object o = msgContext.getProperty(JsonConstant.MOSHI_XML_STREAM_READER);
                     if (o != null) {
                         MoshiXMLStreamReader moshiXMLStreamReader = (MoshiXMLStreamReader) o;
@@ -100,8 +99,7 @@ public class JSONMessageHandler extends AbstractHandler {
                 log.debug("On enableJSONOnly=true Axis operation is null on JSON request, message hasn't been dispatched to an operation, proceeding on JSON message name discovery and AxisOperation mapping");
                 try{
                     Object tempObj = msgContext.getProperty(JsonConstant.IS_JSON_STREAM);
-                    if (tempObj != null) {
-                        boolean isJSON = Boolean.valueOf(tempObj.toString());
+                    if (tempObj != null && Boolean.valueOf(tempObj.toString()) {
                         Object o = msgContext.getProperty(JsonConstant.MOSHI_XML_STREAM_READER);
                         if (o != null) {
                             MoshiXMLStreamReader moshiXMLStreamReader = (MoshiXMLStreamReader) o;