This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5070-root-action-model in repository https://gitbox.apache.org/repos/asf/struts.git
commit 48435c42095b201f606eb39e86137cb213bfbd4d Author: Lukasz Lenart <lukaszlen...@apache.org> AuthorDate: Mon Apr 27 08:19:29 2020 +0200 WW-5070 Uses else if to avoid double operation on stack --- plugins/json/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 bb35bf2..ba46d96 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(); } }