(struts) 01/01: WW-5310 Fixes broken support for Fragments in tag

2024-06-18 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch fix/WW-5310-fragment
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 13916c8b843a6b1694302e437382d63f335dcc9c
Author: Lukasz Lenart 
AuthorDate: Tue Jun 18 09:39:17 2024 +0200

WW-5310 Fixes broken support for Fragments in  tag
---
 .../struts2/components/ServletUrlRenderer.java | 18 ++-
 .../struts2/url/StrutsQueryStringParserTest.java   |  8 +
 .../org/apache/struts2/views/jsp/URLTagTest.java   | 36 ++
 3 files changed, 55 insertions(+), 7 deletions(-)

diff --git 
a/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java 
b/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java
index 853c0a389..460aeebff 100644
--- a/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java
+++ b/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java
@@ -103,9 +103,9 @@ public class ServletUrlRenderer implements UrlRenderer {
 }
 result = urlHelper.buildUrl(_value, 
urlComponent.getHttpServletRequest(), urlComponent.getHttpServletResponse(), 
urlComponent.getParameters(), scheme, urlComponent.isIncludeContext(), 
urlComponent.isEncode(), urlComponent.isForceAddSchemeHostAndPort(), 
urlComponent.isEscapeAmp());
 }
-String anchor = urlComponent.getAnchor();
-if (StringUtils.isNotEmpty(anchor)) {
-result += '#' + urlComponent.findString(anchor);
+if (StringUtils.isNotEmpty(urlComponent.getAnchor())) {
+String anchor = urlComponent.findString(urlComponent.getAnchor());
+result += '#' + anchor;
 }
 
 if (urlComponent.isPutInContext()) {
@@ -292,7 +292,7 @@ public class ServletUrlRenderer implements UrlRenderer {
 private void includeGetParameters(UrlProvider urlComponent) {
 String query = extractQueryString(urlComponent);
 QueryStringParser.Result result = queryStringParser.parse(query);
-mergeRequestParameters(urlComponent.getValue(), 
urlComponent.getParameters(), result.getQueryParams());
+result = mergeRequestParameters(urlComponent.getValue(), 
urlComponent.getParameters(), result.getQueryParams());
 if (!result.getQueryFragment().isEmpty()) {
 urlComponent.setAnchor(result.getQueryFragment());
 }
@@ -331,10 +331,11 @@ public class ServletUrlRenderer implements UrlRenderer {
  * @param value the value attribute (URL to be generated by 
this component)
  * @param parameterscomponent parameters
  * @param contextParameters request parameters
+ * @return {@link QueryStringParser.Result} of value's ?query-string or 
empty()
  */
-protected void mergeRequestParameters(String value, Map 
parameters, Map contextParameters) {
-
+protected QueryStringParser.Result mergeRequestParameters(String value, 
Map parameters, Map contextParameters) {
 Map mergedParams = new 
LinkedHashMap<>(contextParameters);
+QueryStringParser.Result result = queryStringParser.empty();
 
 // Merge contextParameters (from current request) with parameters 
specified in value attribute
 // eg. value="someAction.action?id=someId&venue=someVenue"
@@ -343,7 +344,8 @@ public class ServletUrlRenderer implements UrlRenderer {
 if (StringUtils.contains(value, "?")) {
 String queryString = value.substring(value.indexOf('?') + 1);
 
-mergedParams = new 
LinkedHashMap<>(queryStringParser.parse(queryString).getQueryParams());
+result = queryStringParser.parse(queryString);
+mergedParams = new LinkedHashMap<>(result.getQueryParams());
 for (Map.Entry entry : contextParameters.entrySet()) {
 if (!mergedParams.containsKey(entry.getKey())) {
 mergedParams.put(entry.getKey(), entry.getValue());
@@ -362,6 +364,8 @@ public class ServletUrlRenderer implements UrlRenderer {
 parameters.put(entry.getKey(), entry.getValue());
 }
 }
+
+return result;
 }
 
 }
diff --git 
a/core/src/test/java/org/apache/struts2/url/StrutsQueryStringParserTest.java 
b/core/src/test/java/org/apache/struts2/url/StrutsQueryStringParserTest.java
index c8183725b..8108a8d01 100644
--- a/core/src/test/java/org/apache/struts2/url/StrutsQueryStringParserTest.java
+++ b/core/src/test/java/org/apache/struts2/url/StrutsQueryStringParserTest.java
@@ -112,6 +112,14 @@ public class StrutsQueryStringParserTest {
 assertEquals("test", queryParameters.getQueryFragment());
 }
 
+@Test
+public void shouldHandleOnlyFragment() {
+QueryStringParser.Result queryParameters = parser.parse("#test");
+
+assertTrue(queryParameters.getQueryParams().isEmpty());
+assertEquals("test", queryParameters.getQueryFragment());
+}
+
 @Before
 public vo

(struts) branch fix/WW-5310-fragment created (now 13916c8b8)

2024-06-18 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a change to branch fix/WW-5310-fragment
in repository https://gitbox.apache.org/repos/asf/struts.git


  at 13916c8b8 WW-5310 Fixes broken support for Fragments in  tag

This branch includes the following new commits:

 new 13916c8b8 WW-5310 Fixes broken support for Fragments in  tag

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




(struts) 01/01: WW-5429 Log parameter annotation issues at ERROR level when in DevMode

2024-06-18 Thread kusal
This is an automated email from the ASF dual-hosted git repository.

kusal pushed a commit to branch WW-5429-param-anno-log
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 3506020b8d5ac85cd12211c3ad7db11ae73c0ee4
Author: Kusal Kithul-Godage 
AuthorDate: Tue Jun 18 19:07:50 2024 +1000

WW-5429 Log parameter annotation issues at ERROR level when in DevMode
---
 .../com/opensymphony/xwork2/util/DebugUtils.java   | 24 +++
 .../parameter/ParametersInterceptor.java   | 49 --
 2 files changed, 52 insertions(+), 21 deletions(-)

diff --git a/core/src/main/java/com/opensymphony/xwork2/util/DebugUtils.java 
b/core/src/main/java/com/opensymphony/xwork2/util/DebugUtils.java
new file mode 100644
index 0..5978067f8
--- /dev/null
+++ b/core/src/main/java/com/opensymphony/xwork2/util/DebugUtils.java
@@ -0,0 +1,24 @@
+package com.opensymphony.xwork2.util;
+
+import com.opensymphony.xwork2.TextProvider;
+import com.opensymphony.xwork2.interceptor.ValidationAware;
+import org.apache.logging.log4j.Logger;
+
+/**
+ * @since 6.5.0
+ */
+public class DebugUtils {
+
+public static void notifyDeveloperOfError(Logger log, Object action, 
String message) {
+if (action instanceof TextProvider) {
+TextProvider tp = (TextProvider) action;
+message = tp.getText("devmode.notification", "Developer 
Notification:\n{0}", new String[]{message});
+}
+log.error(message);
+if (action instanceof ValidationAware) {
+ValidationAware validationAware = (ValidationAware) action;
+validationAware.addActionMessage(message);
+}
+}
+
+}
diff --git 
a/core/src/main/java/org/apache/struts2/interceptor/parameter/ParametersInterceptor.java
 
b/core/src/main/java/org/apache/struts2/interceptor/parameter/ParametersInterceptor.java
index e9215e533..8a9fb81f2 100644
--- 
a/core/src/main/java/org/apache/struts2/interceptor/parameter/ParametersInterceptor.java
+++ 
b/core/src/main/java/org/apache/struts2/interceptor/parameter/ParametersInterceptor.java
@@ -20,10 +20,8 @@ package org.apache.struts2.interceptor.parameter;
 
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.TextProvider;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
-import com.opensymphony.xwork2.interceptor.ValidationAware;
 import com.opensymphony.xwork2.security.AcceptedPatternsChecker;
 import com.opensymphony.xwork2.security.DefaultAcceptedPatternsChecker;
 import com.opensymphony.xwork2.security.ExcludedPatternsChecker;
@@ -56,7 +54,6 @@ import java.lang.reflect.Modifier;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.Comparator;
 import java.util.HashSet;
 import java.util.Map;
@@ -67,6 +64,8 @@ import java.util.regex.Pattern;
 
 import static 
com.opensymphony.xwork2.security.DefaultAcceptedPatternsChecker.NESTING_CHARS;
 import static 
com.opensymphony.xwork2.security.DefaultAcceptedPatternsChecker.NESTING_CHARS_STR;
+import static com.opensymphony.xwork2.util.DebugUtils.notifyDeveloperOfError;
+import static java.lang.String.format;
 import static java.util.Collections.unmodifiableSet;
 import static java.util.stream.Collectors.joining;
 import static org.apache.commons.lang3.StringUtils.indexOfAny;
@@ -318,18 +317,7 @@ public class ParametersInterceptor extends 
MethodFilterInterceptor {
 
 protected void notifyDeveloperParameterException(Object action, String 
property, String message) {
 String logMsg = "Unexpected Exception caught setting '" + property + 
"' on '" + action.getClass() + ": " + message;
-if (action instanceof TextProvider) {
-TextProvider tp = (TextProvider) action;
-logMsg = tp.getText("devmode.notification", "Developer 
Notification:\n{0}", new String[]{logMsg});
-}
-LOG.error(logMsg);
-
-if (action instanceof ValidationAware) {
-ValidationAware validationAware = (ValidationAware) action;
-Collection messages = validationAware.getActionMessages();
-messages.add(message);
-validationAware.setActionMessages(messages);
-}
+notifyDeveloperOfError(LOG, action, logMsg);
 }
 
 /**
@@ -388,23 +376,37 @@ public class ParametersInterceptor extends 
MethodFilterInterceptor {
 return hasValidAnnotatedField(action, rootProperty, paramDepth);
 }
 
-if (hasValidAnnotatedPropertyDescriptor(propDescOpt.get(), 
paramDepth)) {
+if (hasValidAnnotatedPropertyDescriptor(action, propDescOpt.get(), 
paramDepth)) {
 return true;
 }
 
 return hasValidAnnotatedField(action, rootProperty, paramDepth);
 }
 
+/**
+ * @deprecated since 6.5.0, use {@link 
#hasValidAnnotatedPrope

(struts) branch WW-5429-param-anno-log updated (3506020b8 -> 1ae4506ba)

2024-06-18 Thread kusal
This is an automated email from the ASF dual-hosted git repository.

kusal pushed a change to branch WW-5429-param-anno-log
in repository https://gitbox.apache.org/repos/asf/struts.git


 discard 3506020b8 WW-5429 Log parameter annotation issues at ERROR level when 
in DevMode
 add 1ae4506ba WW-5429 Log parameter annotation issues at ERROR level when 
in DevMode

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (3506020b8)
\
 N -- N -- N   refs/heads/WW-5429-param-anno-log (1ae4506ba)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

No new revisions were added by this update.

Summary of changes:
 .../com/opensymphony/xwork2/ognl/ErrorMessageBuilder.java|  4 ++--
 .../struts2/interceptor/parameter/ParametersInterceptor.java |  2 +-
 .../interceptor/parameter/ParametersInterceptorTest.java | 12 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)



(struts) branch WW-5429-param-anno-log updated (f1ddc88e8 -> 35ca03c3e)

2024-06-18 Thread kusal
This is an automated email from the ASF dual-hosted git repository.

kusal pushed a change to branch WW-5429-param-anno-log
in repository https://gitbox.apache.org/repos/asf/struts.git


omit f1ddc88e8 WW-5429 Log parameter annotation issues at ERROR level when 
in DevMode
 add 35ca03c3e WW-5429 Log parameter annotation issues at ERROR level when 
in DevMode

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (f1ddc88e8)
\
 N -- N -- N   refs/heads/WW-5429-param-anno-log (35ca03c3e)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

No new revisions were added by this update.

Summary of changes:
 core/src/main/java/com/opensymphony/xwork2/util/DebugUtils.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



(struts) branch WW-5429-param-anno-log created (now 3506020b8)

2024-06-18 Thread kusal
This is an automated email from the ASF dual-hosted git repository.

kusal pushed a change to branch WW-5429-param-anno-log
in repository https://gitbox.apache.org/repos/asf/struts.git


  at 3506020b8 WW-5429 Log parameter annotation issues at ERROR level when 
in DevMode

This branch includes the following new commits:

 new 3506020b8 WW-5429 Log parameter annotation issues at ERROR level when 
in DevMode

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




(struts) branch WW-5429-param-anno-log updated (35ca03c3e -> b96cf2c07)

2024-06-18 Thread kusal
This is an automated email from the ASF dual-hosted git repository.

kusal pushed a change to branch WW-5429-param-anno-log
in repository https://gitbox.apache.org/repos/asf/struts.git


omit 35ca03c3e WW-5429 Log parameter annotation issues at ERROR level when 
in DevMode
 add b96cf2c07 WW-5429 Log parameter annotation issues at ERROR level when 
in DevMode

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (35ca03c3e)
\
 N -- N -- N   refs/heads/WW-5429-param-anno-log (b96cf2c07)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

No new revisions were added by this update.

Summary of changes:
 .../xwork2/interceptor/ValidationAware.java|  6 ++-
 .../parameter/ParametersInterceptorTest.java   | 49 +-
 2 files changed, 33 insertions(+), 22 deletions(-)



(struts) branch WW-5429-param-anno-log updated (1ae4506ba -> f1ddc88e8)

2024-06-18 Thread kusal
This is an automated email from the ASF dual-hosted git repository.

kusal pushed a change to branch WW-5429-param-anno-log
in repository https://gitbox.apache.org/repos/asf/struts.git


 discard 1ae4506ba WW-5429 Log parameter annotation issues at ERROR level when 
in DevMode
 add f1ddc88e8 WW-5429 Log parameter annotation issues at ERROR level when 
in DevMode

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (1ae4506ba)
\
 N -- N -- N   refs/heads/WW-5429-param-anno-log (f1ddc88e8)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

No new revisions were added by this update.

Summary of changes:
 .../java/com/opensymphony/xwork2/util/DebugUtils.java  | 18 ++
 1 file changed, 18 insertions(+)