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 2019/12/01 11:35:03 UTC
[struts] branch struts-2-5-x updated: Fix incorrect encoding
strings provided in FileUPloadInterceptorTest - Tests were using
"text/html" which is not a valid character encoding. No impact currently,
but the tests could fail in the future if this is not corrected. If the code
is re-used elsewhere for a test of an action a valid encoding will be
needed. - Switch to a predefined constant CharSet to get the string
instead.
This is an automated email from the ASF dual-hosted git repository.
lukaszlenart pushed a commit to branch struts-2-5-x
in repository https://gitbox.apache.org/repos/asf/struts.git
The following commit(s) were added to refs/heads/struts-2-5-x by this push:
new ce467b7 Fix incorrect encoding strings provided in FileUPloadInterceptorTest - Tests were using "text/html" which is not a valid character encoding. No impact currently, but the tests could fail in the future if this is not corrected. If the code is re-used elsewhere for a test of an action a valid encoding will be needed. - Switch to a predefined constant CharSet to get the string instead.
new 47c87bc Merge pull request #385 from JCgH4164838Gh792C124B5/local_25x_TstFix1
ce467b7 is described below
commit ce467b7fa51d8cd98d19665c965a4bcc88553778
Author: JCgH4164838Gh792C124B5 <43...@users.noreply.github.com>
AuthorDate: Sat Nov 30 16:06:05 2019 -0500
Fix incorrect encoding strings provided in FileUPloadInterceptorTest
- Tests were using "text/html" which is not a valid character encoding.
No impact currently, but the tests could fail in the future if this is not
corrected. If the code is re-used elsewhere for a test of an action a
valid encoding will be needed.
- Switch to a predefined constant CharSet to get the string instead.
---
.../apache/struts2/interceptor/FileUploadInterceptorTest.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java
index 9b67535..3e621b1 100644
--- a/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java
+++ b/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java
@@ -40,6 +40,7 @@ import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -244,7 +245,7 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase {
public void testNoContentMultipartRequest() throws Exception {
MockHttpServletRequest req = new MockHttpServletRequest();
- req.setCharacterEncoding("text/html");
+ req.setCharacterEncoding(StandardCharsets.UTF_8.name());
req.setMethod("post");
req.addHeader("Content-type", "multipart/form-data");
req.setContent(null); // there is no content
@@ -265,7 +266,7 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase {
public void testSuccessUploadOfATextFileMultipartRequest() throws Exception {
MockHttpServletRequest req = new MockHttpServletRequest();
- req.setCharacterEncoding("text/html");
+ req.setCharacterEncoding(StandardCharsets.UTF_8.name());
req.setMethod("post");
req.addHeader("Content-type", "multipart/form-data; boundary=---1234");
@@ -322,7 +323,7 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase {
final String endline = "\r\n";
MockHttpServletRequest req = new MockHttpServletRequest();
- req.setCharacterEncoding("text/html");
+ req.setCharacterEncoding(StandardCharsets.UTF_8.name());
req.setMethod("POST");
req.addHeader("Content-type", "multipart/form-data; boundary=" + bondary);
StringBuilder content = new StringBuilder(128);
@@ -371,7 +372,7 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase {
public void testMultipartRequestLocalizedError() throws Exception {
MockHttpServletRequest req = new MockHttpServletRequest();
- req.setCharacterEncoding("text/html");
+ req.setCharacterEncoding(StandardCharsets.UTF_8.name());
req.setMethod("post");
req.addHeader("Content-type", "multipart/form-data; boundary=---1234");