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

kusal pushed a commit to branch 7.0.x/merge-master-2024-11-01
in repository https://gitbox.apache.org/repos/asf/struts.git

commit eab6d9ef89e9f522e9b6c290fbd103c870d8db73
Author: Kusal Kithul-Godage <g...@kusal.io>
AuthorDate: Fri Nov 1 16:01:19 2024 +1100

    Fix merge errors
---
 .../java/org/apache/struts2/ActionContext.java     |  8 ++--
 .../struts2/interceptor/AliasInterceptor.java      |  2 +-
 .../interceptor/StaticParametersInterceptor.java   |  2 +-
 .../ActionFileUploadInterceptorTest.java           | 46 ++++++++++------------
 4 files changed, 26 insertions(+), 32 deletions(-)

diff --git a/core/src/main/java/org/apache/struts2/ActionContext.java 
b/core/src/main/java/org/apache/struts2/ActionContext.java
index 79f7552d5..c17ff43e4 100644
--- a/core/src/main/java/org/apache/struts2/ActionContext.java
+++ b/core/src/main/java/org/apache/struts2/ActionContext.java
@@ -20,14 +20,14 @@ package org.apache.struts2;
 
 import com.opensymphony.xwork2.conversion.impl.ConversionData;
 import com.opensymphony.xwork2.inject.Container;
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.servlet.jsp.PageContext;
 import org.apache.struts2.dispatcher.HttpParameters;
 import org.apache.struts2.dispatcher.mapper.ActionMapping;
 import org.apache.struts2.util.ValueStack;
 
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.jsp.PageContext;
 import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Locale;
diff --git 
a/core/src/main/java/org/apache/struts2/interceptor/AliasInterceptor.java 
b/core/src/main/java/org/apache/struts2/interceptor/AliasInterceptor.java
index c5aa9fb3c..58c50e404 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/AliasInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/AliasInterceptor.java
@@ -21,7 +21,6 @@ package org.apache.struts2.interceptor;
 import com.opensymphony.xwork2.LocalizedTextProvider;
 import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.interceptor.ParametersInterceptor;
 import com.opensymphony.xwork2.security.AcceptedPatternsChecker;
 import com.opensymphony.xwork2.security.ExcludedPatternsChecker;
 import com.opensymphony.xwork2.util.ClearableValueStack;
@@ -35,6 +34,7 @@ import org.apache.struts2.ActionInvocation;
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.dispatcher.HttpParameters;
 import org.apache.struts2.dispatcher.Parameter;
+import org.apache.struts2.interceptor.parameter.ParametersInterceptor;
 import org.apache.struts2.util.ValueStack;
 
 import java.util.Map;
diff --git 
a/core/src/main/java/org/apache/struts2/interceptor/StaticParametersInterceptor.java
 
b/core/src/main/java/org/apache/struts2/interceptor/StaticParametersInterceptor.java
index 5b00ffca6..2f7ccac37 100644
--- 
a/core/src/main/java/org/apache/struts2/interceptor/StaticParametersInterceptor.java
+++ 
b/core/src/main/java/org/apache/struts2/interceptor/StaticParametersInterceptor.java
@@ -22,7 +22,6 @@ import com.opensymphony.xwork2.LocalizedTextProvider;
 import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.config.entities.Parameterizable;
 import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.interceptor.ParametersInterceptor;
 import com.opensymphony.xwork2.util.ClearableValueStack;
 import com.opensymphony.xwork2.util.TextParseUtil;
 import com.opensymphony.xwork2.util.ValueStackFactory;
@@ -34,6 +33,7 @@ import org.apache.struts2.ActionContext;
 import org.apache.struts2.ActionInvocation;
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.dispatcher.HttpParameters;
+import org.apache.struts2.interceptor.parameter.ParametersInterceptor;
 import org.apache.struts2.util.ValueStack;
 
 import java.util.Collections;
diff --git 
a/core/src/test/java/org/apache/struts2/interceptor/ActionFileUploadInterceptorTest.java
 
b/core/src/test/java/org/apache/struts2/interceptor/ActionFileUploadInterceptorTest.java
index 876aec960..8e9e7bd4d 100644
--- 
a/core/src/test/java/org/apache/struts2/interceptor/ActionFileUploadInterceptorTest.java
+++ 
b/core/src/test/java/org/apache/struts2/interceptor/ActionFileUploadInterceptorTest.java
@@ -269,12 +269,10 @@ public class ActionFileUploadInterceptorTest extends 
StrutsInternalTestCase {
     }
 
     public void testNoContentMultipartRequest() throws Exception {
-        MockHttpServletRequest req = new MockHttpServletRequest();
-
-        req.setCharacterEncoding(StandardCharsets.UTF_8.name());
-        req.setMethod("post");
-        req.addHeader("Content-type", "multipart/form-data");
-        req.setContent(null); // there is no content
+        request.setCharacterEncoding(StandardCharsets.UTF_8.name());
+        request.setMethod("post");
+        request.addHeader("Content-type", "multipart/form-data");
+        request.setContent(null); // there is no content
 
         MyFileUploadAction action = container.inject(MyFileUploadAction.class);
         MockActionInvocation mai = new MockActionInvocation();
@@ -326,10 +324,9 @@ public class ActionFileUploadInterceptorTest extends 
StrutsInternalTestCase {
     }
 
     public void testSuccessUploadOfATextFileMultipartRequestNoMaxParamsSet() 
throws Exception {
-        MockHttpServletRequest req = new MockHttpServletRequest();
-        req.setCharacterEncoding(StandardCharsets.UTF_8.name());
-        req.setMethod("post");
-        req.addHeader("Content-type", "multipart/form-data; boundary=---1234");
+        request.setCharacterEncoding(StandardCharsets.UTF_8.name());
+        request.setMethod("post");
+        request.addHeader("Content-type", "multipart/form-data; 
boundary=---1234");
 
         // inspired by the unit tests for jakarta commons fileupload
         String content = ("-----1234\r\n" +
@@ -339,7 +336,7 @@ public class ActionFileUploadInterceptorTest extends 
StrutsInternalTestCase {
             "Unit test of ActionFileUploadInterceptor" +
             "\r\n" +
             "-----1234--\r\n");
-        req.setContent(content.getBytes(StandardCharsets.US_ASCII));
+        request.setContent(content.getBytes(StandardCharsets.US_ASCII));
 
         MyFileUploadAction action = new MyFileUploadAction();
 
@@ -347,7 +344,7 @@ public class ActionFileUploadInterceptorTest extends 
StrutsInternalTestCase {
         mai.setAction(action);
         mai.setResultCode("success");
         mai.setInvocationContext(ActionContext.getContext());
-        
ActionContext.getContext().withServletRequest(createMultipartRequestNoMaxParamsSet(req));
+        
ActionContext.getContext().withServletRequest(createMultipartRequestNoMaxParamsSet());
 
         interceptor.intercept(mai);
 
@@ -362,10 +359,9 @@ public class ActionFileUploadInterceptorTest extends 
StrutsInternalTestCase {
     }
 
     public void 
testSuccessUploadOfATextFileMultipartRequestWithNormalFieldsMaxParamsSet() 
throws Exception {
-        MockHttpServletRequest req = new MockHttpServletRequest();
-        req.setCharacterEncoding(StandardCharsets.UTF_8.name());
-        req.setMethod("post");
-        req.addHeader("Content-type", "multipart/form-data; boundary=---1234");
+        request.setCharacterEncoding(StandardCharsets.UTF_8.name());
+        request.setMethod("post");
+        request.addHeader("Content-type", "multipart/form-data; 
boundary=---1234");
 
         // inspired by the unit tests for jakarta commons fileupload
         String content = ("-----1234\r\n" +
@@ -385,7 +381,7 @@ public class ActionFileUploadInterceptorTest extends 
StrutsInternalTestCase {
             "normal field 2" +
             "\r\n" +
             "-----1234--\r\n");
-        req.setContent(content.getBytes(StandardCharsets.US_ASCII));
+        request.setContent(content.getBytes(StandardCharsets.US_ASCII));
 
         MyFileUploadAction action = new MyFileUploadAction();
 
@@ -415,10 +411,9 @@ public class ActionFileUploadInterceptorTest extends 
StrutsInternalTestCase {
     }
 
     public void 
testSuccessUploadOfATextFileMultipartRequestWithNormalFieldsNoMaxParamsSet() 
throws Exception {
-        MockHttpServletRequest req = new MockHttpServletRequest();
-        req.setCharacterEncoding(StandardCharsets.UTF_8.name());
-        req.setMethod("post");
-        req.addHeader("Content-type", "multipart/form-data; boundary=---1234");
+        request.setCharacterEncoding(StandardCharsets.UTF_8.name());
+        request.setMethod("post");
+        request.addHeader("Content-type", "multipart/form-data; 
boundary=---1234");
 
         // inspired by the unit tests for jakarta commons fileupload
         String content = ("-----1234\r\n" +
@@ -438,7 +433,7 @@ public class ActionFileUploadInterceptorTest extends 
StrutsInternalTestCase {
             "normal field 2" +
             "\r\n" +
             "-----1234--\r\n");
-        req.setContent(content.getBytes(StandardCharsets.US_ASCII));
+        request.setContent(content.getBytes(StandardCharsets.US_ASCII));
 
         MyFileUploadAction action = new MyFileUploadAction();
 
@@ -446,7 +441,7 @@ public class ActionFileUploadInterceptorTest extends 
StrutsInternalTestCase {
         mai.setAction(action);
         mai.setResultCode("success");
         mai.setInvocationContext(ActionContext.getContext());
-        
ActionContext.getContext().withServletRequest(createMultipartRequestNoMaxParamsSet(req));
+        
ActionContext.getContext().withServletRequest(createMultipartRequestNoMaxParamsSet());
 
         interceptor.intercept(mai);
 
@@ -757,10 +752,9 @@ public class ActionFileUploadInterceptorTest extends 
StrutsInternalTestCase {
         return new MultiPartRequestWrapper(jak, request, 
tempDir.getAbsolutePath(), new DefaultLocaleProvider());
     }
 
-    private MultiPartRequestWrapper 
createMultipartRequestNoMaxParamsSet(HttpServletRequest req) {
-
+    private MultiPartRequestWrapper createMultipartRequestNoMaxParamsSet() {
         JakartaMultiPartRequest jak = new JakartaMultiPartRequest();
-        return new MultiPartRequestWrapper(jak, req, 
tempDir.getAbsolutePath(), new DefaultLocaleProvider());
+        return new MultiPartRequestWrapper(jak, request, 
tempDir.getAbsolutePath(), new DefaultLocaleProvider());
     }
 
     protected void setUp() throws Exception {

Reply via email to