From 48435c42095b201f606eb39e86137cb213bfbd4d Mon Sep 17 00:00:00 2001 From: Lukasz Lenart Date: Mon, 27 Apr 2020 08:19:29 +0200 Subject: [PATCH] WW-5070 Uses else if to avoid double operation on stack --- .../src/main/java/org/apache/struts2/json/JSONResult.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/json/src/main/java/org/apache/struts2/json/JSONResult.java b/plugins/json/src/main/java/org/apache/struts2/json/JSONResult.java index bb35bf2de..ba46d96be 100644 --- a/plugins/json/src/main/java/org/apache/struts2/json/JSONResult.java +++ b/plugins/json/src/main/java/org/apache/struts2/json/JSONResult.java @@ -224,9 +224,8 @@ public class JSONResult implements Result { if (rootObject instanceof ModelDriven) { LOG.debug("Action is an instance of ModelDriven, assuming model is on the top of the stack and using it"); rootObject = stack.peek(); - } - if (rootObject == null) { - LOG.debug("Neither #action nor ModelDriven, peeking up object from top of the stack"); + } else if (rootObject == null) { + LOG.debug("Neither #action nor ModelDriven, peeking up object from the top of the stack"); rootObject = stack.peek(); } }