You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2025/01/05 08:19:01 UTC

(struts) branch fix/WW-5498-s7 created (now db9684e1c)

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

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


      at db9684e1c WW-5498 Adds devMode errors as action messages to avoid breaking validation logic

This branch includes the following new commits:

     new db9684e1c WW-5498 Adds devMode errors as action messages to avoid breaking validation logic

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-5498 Adds devMode errors as action messages to avoid breaking validation logic

Posted by lu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit db9684e1c12386548a5ac5dab31076a618db4a46
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Fri Jan 3 17:04:15 2025 +0100

    WW-5498 Adds devMode errors as action messages to avoid breaking validation logic
---
 core/src/main/java/org/apache/struts2/util/DebugUtils.java     |  2 +-
 .../interceptor/parameter/ParametersInterceptorTest.java       | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/core/src/main/java/org/apache/struts2/util/DebugUtils.java b/core/src/main/java/org/apache/struts2/util/DebugUtils.java
index a7cb8dcce..cc8ca5f5f 100644
--- a/core/src/main/java/org/apache/struts2/util/DebugUtils.java
+++ b/core/src/main/java/org/apache/struts2/util/DebugUtils.java
@@ -38,7 +38,7 @@ public final class DebugUtils {
         }
         log.error(message);
         if (action instanceof ValidationAware validationAware) {
-            validationAware.addActionError(message);
+            validationAware.addActionMessage(message);
         }
     }
 
diff --git a/core/src/test/java/org/apache/struts2/interceptor/parameter/ParametersInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/parameter/ParametersInterceptorTest.java
index c064e9269..11113237c 100644
--- a/core/src/test/java/org/apache/struts2/interceptor/parameter/ParametersInterceptorTest.java
+++ b/core/src/test/java/org/apache/struts2/interceptor/parameter/ParametersInterceptorTest.java
@@ -117,9 +117,9 @@ public class ParametersInterceptorTest extends XWorkTestCase {
         pi.applyParameters(action, vs, HttpParameters.create(params).build());
 
         // then
-        assertEquals(3, action.getActionErrors().size());
+        assertEquals(3, action.getActionMessages().size());
 
-        List<String> actionErrors = new ArrayList<>(action.getActionErrors());
+        List<String> actionErrors = new ArrayList<>(action.getActionMessages());
 
         String msg1 = actionErrors.get(0);
         String msg2 = actionErrors.get(1);
@@ -204,9 +204,9 @@ public class ParametersInterceptorTest extends XWorkTestCase {
         pi.applyParameters(action, vs, HttpParameters.create(params).build());
 
         // then
-        assertEquals(3, action.getActionErrors().size());
+        assertEquals(3, action.getActionMessages().size());
 
-        List<String> actionErrors = new ArrayList<>(action.getActionErrors());
+        List<String> actionErrors = new ArrayList<>(action.getActionMessages());
         String msg1 = actionErrors.get(0);
         String msg2 = actionErrors.get(1);
         String msg3 = actionErrors.get(2);
@@ -586,7 +586,7 @@ public class ParametersInterceptorTest extends XWorkTestCase {
         container.inject(config.getInterceptors().get(0).getInterceptor());
         ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME, null, extraContext.getContextMap());
         proxy.execute();
-        final String actionError = "" + ((SimpleAction) proxy.getAction()).getActionErrors().toArray()[0];
+        final String actionError = "" + ((SimpleAction) proxy.getAction()).getActionMessages().toArray()[0];
         assertTrue(actionError.contains("Error setting expression 'not_a_property' with value 'There is no action property named like this'"));
     }