You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by ku...@apache.org on 2023/09/04 06:02:50 UTC
[struts] 07/15: CONFSRVDEV-26354 Port legacy WebWork syntax support (partial revert 7840fa1)
This is an automated email from the ASF dual-hosted git repository.
kusal pushed a commit to branch fork/6.3
in repository https://gitbox.apache.org/repos/asf/struts.git
commit 4762b6c7dab0eddfe2217cc3592a8915192989b4
Author: Kusal Kithul-Godage <kk...@atlassian.com>
AuthorDate: Thu Mar 30 18:19:56 2023 +1100
CONFSRVDEV-26354 Port legacy WebWork syntax support (partial revert 7840fa1)
---
.../org/apache/struts2/components/Component.java | 26 ++++++----------------
.../struts2/components/DoubleListUIBean.java | 4 +++-
.../org/apache/struts2/components/FormButton.java | 5 +++--
.../java/org/apache/struts2/components/Label.java | 13 ++++++-----
.../java/org/apache/struts2/components/UIBean.java | 5 +++--
5 files changed, 23 insertions(+), 30 deletions(-)
diff --git a/core/src/main/java/org/apache/struts2/components/Component.java b/core/src/main/java/org/apache/struts2/components/Component.java
index ba0d672bf..8c649276c 100644
--- a/core/src/main/java/org/apache/struts2/components/Component.java
+++ b/core/src/main/java/org/apache/struts2/components/Component.java
@@ -22,7 +22,6 @@ import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.security.NotExcludedAcceptedPatternsChecker;
-import com.opensymphony.xwork2.util.TextParseUtil;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
@@ -319,14 +318,9 @@ public class Component {
* @return the modified expression wrapped with %{...}
*/
protected String completeExpression(String expr) {
- if (expr == null) {
- return null;
- }
- if (ComponentUtils.isExpression(expr)) {
- LOG.warn("Expression {} is already an expression!", expr);
- return expr;
- }
- return "%{" + expr + "}";
+ // Start forked modification
+ return expr;
+ // End modification
}
/**
@@ -378,16 +372,10 @@ public class Component {
* @return the Object found, or <tt>null</tt> if not found.
*/
protected Object findValue(String expression, Class<?> toType) {
- if (toType == String.class) {
- if (ComponentUtils.containsExpression(expression)) {
- return TextParseUtil.translateVariables('%', expression, stack);
- } else {
- return expression;
- }
- } else {
- String strippedExpression = stripExpression(expression);
- return getStack().findValue(strippedExpression, toType, throwExceptionOnELFailure);
- }
+ // Start forked modification
+ String strippedExpression = stripExpression(expression);
+ return getStack().findValue(strippedExpression, toType, throwExceptionOnELFailure);
+ // End modification
}
/**
diff --git a/core/src/main/java/org/apache/struts2/components/DoubleListUIBean.java b/core/src/main/java/org/apache/struts2/components/DoubleListUIBean.java
index 9c4e30a0c..484997df1 100644
--- a/core/src/main/java/org/apache/struts2/components/DoubleListUIBean.java
+++ b/core/src/main/java/org/apache/struts2/components/DoubleListUIBean.java
@@ -186,7 +186,9 @@ public abstract class DoubleListUIBean extends ListUIBean {
Form form = (Form) findAncestor(Form.class);
if (doubleId != null) {
- addParameter("doubleId", findString(doubleId));
+ // Start forked modification
+ addParameter("doubleId", doubleId);
+ // End modification
} else if (form != null) {
addParameter("doubleId", form.getParameters().get("id") + "_" + escape(doubleName != null ? findString(doubleName) : null));
} else {
diff --git a/core/src/main/java/org/apache/struts2/components/FormButton.java b/core/src/main/java/org/apache/struts2/components/FormButton.java
index 0ed08d47b..0a12f36b3 100644
--- a/core/src/main/java/org/apache/struts2/components/FormButton.java
+++ b/core/src/main/java/org/apache/struts2/components/FormButton.java
@@ -98,8 +98,9 @@ public abstract class FormButton extends ClosingUIBean {
protected void populateComponentHtmlId(Form form) {
String tmpId = "";
if (id != null) {
- // this check is needed for backwards compatibility with 2.1.x
- tmpId = findString(id);
+ // Start forked modification
+ tmpId = id;
+ // End modification
} else {
if (form != null && form.getParameters().get("id") != null) {
tmpId = tmpId + form.getParameters().get("id").toString() + "_";
diff --git a/core/src/main/java/org/apache/struts2/components/Label.java b/core/src/main/java/org/apache/struts2/components/Label.java
index c09b88c80..03b2129a0 100644
--- a/core/src/main/java/org/apache/struts2/components/Label.java
+++ b/core/src/main/java/org/apache/struts2/components/Label.java
@@ -18,14 +18,13 @@
*/
package org.apache.struts2.components;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
+import com.opensymphony.xwork2.util.ValueStack;
+import org.apache.struts2.util.TextProviderHelper;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
-import org.apache.struts2.util.TextProviderHelper;
-import com.opensymphony.xwork2.util.ValueStack;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
/**
* <!-- START SNIPPET: javadoc -->
@@ -89,7 +88,9 @@ public class Label extends UIBean {
}
} else if (name != null) {
String expr = completeExpression(name);
- addParameter("nameValue", findString(expr));
+ // Start forked modification
+ addParameter("nameValue", expr);
+ // End modification
}
}
diff --git a/core/src/main/java/org/apache/struts2/components/UIBean.java b/core/src/main/java/org/apache/struts2/components/UIBean.java
index 9dc4807f3..be5a33af2 100644
--- a/core/src/main/java/org/apache/struts2/components/UIBean.java
+++ b/core/src/main/java/org/apache/struts2/components/UIBean.java
@@ -1032,8 +1032,9 @@ public abstract class UIBean extends Component {
String tryId;
String generatedId;
if (id != null) {
- // this check is needed for backwards compatibility with 2.1.x
- tryId = findString(id);
+ // Start forked modification
+ tryId = id;
+ // End modification
} else if (null == (generatedId = escape(name != null ? findString(name) : null))) {
LOG.debug("Cannot determine id attribute for [{}], consider defining id, name or key attribute!", this);
tryId = null;