You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/08/02 15:06:43 UTC
(commons-fileupload) branch 1.x updated (628a8af5 -> 34722bff)
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a change to branch 1.x
in repository https://gitbox.apache.org/repos/asf/commons-fileupload.git
from 628a8af5 Remove useless comments
new d1f579fe [1.x] Enable multipart/related on FileUpload #314
new 34722bff Replace use of Locale.ENGLISH with Locale.ROOT
The 2 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.
Summary of changes:
src/changes/changes.xml | 5 +++++
.../java/org/apache/commons/fileupload/FileUploadBase.java | 14 +++++++-------
.../org/apache/commons/fileupload/ParameterParser.java | 2 +-
.../commons/fileupload/util/FileItemHeadersImpl.java | 6 +++---
.../apache/commons/fileupload/util/mime/MimeUtility.java | 4 ++--
5 files changed, 18 insertions(+), 13 deletions(-)
(commons-fileupload) 01/02: [1.x] Enable multipart/related on FileUpload #314
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch 1.x
in repository https://gitbox.apache.org/repos/asf/commons-fileupload.git
commit d1f579fe2590edbd955093cd31395cf20cc5374f
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Aug 2 11:04:44 2024 -0400
[1.x] Enable multipart/related on FileUpload #314
---
src/changes/changes.xml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index ec703f4f..25c1efc4 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -44,6 +44,9 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<release version="1.6.0" date="YYYY-MM-DD" description="1.6.0 Release, requires Java 8.">
+ <!-- ADD -->
+ <action dev="ggregory" type="add" due-to="mufasa1976, Jochen Wiedmann, Gary Gregory">[1.x] Enable multipart/related on FileUpload #314.</action>
+ <!-- UPDATE -->
<action dev="ggregory" type="update">Bump Java from 6 to 8.</action>
<action dev="ggregory" type="update">Bump commons-parent from 62 to 70.</action>
<action dev="ggregory" type="update">Bump commons-io from 2.11.0 to 2.16.1.</action>
(commons-fileupload) 02/02: Replace use of Locale.ENGLISH with Locale.ROOT
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch 1.x
in repository https://gitbox.apache.org/repos/asf/commons-fileupload.git
commit 34722bff93a33e91f65e37ad1692e025e641f737
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Aug 2 11:06:38 2024 -0400
Replace use of Locale.ENGLISH with Locale.ROOT
---
src/changes/changes.xml | 2 ++
.../java/org/apache/commons/fileupload/FileUploadBase.java | 14 +++++++-------
.../org/apache/commons/fileupload/ParameterParser.java | 2 +-
.../commons/fileupload/util/FileItemHeadersImpl.java | 6 +++---
.../apache/commons/fileupload/util/mime/MimeUtility.java | 4 ++--
5 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 25c1efc4..b7ead35a 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,8 @@ The <action> type attribute can be add,update,fix,remove.
<release version="1.6.0" date="YYYY-MM-DD" description="1.6.0 Release, requires Java 8.">
<!-- ADD -->
<action dev="ggregory" type="add" due-to="mufasa1976, Jochen Wiedmann, Gary Gregory">[1.x] Enable multipart/related on FileUpload #314.</action>
+ <!-- FIX -->
+ <action type="fix" dev="ggregory" due-to="Gary Gregory">Replace use of Locale.ENGLISH with Locale.ROOT.</action>
<!-- UPDATE -->
<action dev="ggregory" type="update">Bump Java from 6 to 8.</action>
<action dev="ggregory" type="update">Bump commons-parent from 62 to 70.</action>
diff --git a/src/main/java/org/apache/commons/fileupload/FileUploadBase.java b/src/main/java/org/apache/commons/fileupload/FileUploadBase.java
index 7de61e04..035480ba 100644
--- a/src/main/java/org/apache/commons/fileupload/FileUploadBase.java
+++ b/src/main/java/org/apache/commons/fileupload/FileUploadBase.java
@@ -75,7 +75,7 @@ public abstract class FileUploadBase {
if (contentType == null) {
return false;
}
- return contentType.toLowerCase(Locale.ENGLISH).startsWith(MULTIPART);
+ return contentType.toLowerCase(Locale.ROOT).startsWith(MULTIPART);
}
/**
@@ -489,7 +489,7 @@ public abstract class FileUploadBase {
private String getFileName(final String pContentDisposition) {
String fileName = null;
if (pContentDisposition != null) {
- final String cdl = pContentDisposition.toLowerCase(Locale.ENGLISH);
+ final String cdl = pContentDisposition.toLowerCase(Locale.ROOT);
if (cdl.startsWith(FORM_DATA) || cdl.startsWith(ATTACHMENT)) {
final ParameterParser parser = new ParameterParser();
parser.setLowerCaseNames(true);
@@ -532,7 +532,7 @@ public abstract class FileUploadBase {
private String getFieldName(final String pContentDisposition) {
String fieldName = null;
if (pContentDisposition != null
- && pContentDisposition.toLowerCase(Locale.ENGLISH).startsWith(FORM_DATA)) {
+ && pContentDisposition.toLowerCase(Locale.ROOT).startsWith(FORM_DATA)) {
final ParameterParser parser = new ParameterParser();
parser.setLowerCaseNames(true);
// Parameter parser can handle null input
@@ -718,7 +718,7 @@ public abstract class FileUploadBase {
@Deprecated
protected final String getHeader(final Map<String, String> headers,
final String name) {
- return headers.get(name.toLowerCase(Locale.ENGLISH));
+ return headers.get(name.toLowerCase(Locale.ROOT));
}
/**
@@ -970,13 +970,13 @@ public abstract class FileUploadBase {
final String contentType = ctx.getContentType();
if (null == contentType
- || !contentType.toLowerCase(Locale.ENGLISH).startsWith(MULTIPART)) {
+ || !contentType.toLowerCase(Locale.ROOT).startsWith(MULTIPART)) {
throw new InvalidContentTypeException(
format("the request neither contains a %s nor a %s nor a %s stream, content type header is %s",
MULTIPART_FORM_DATA, MULTIPART_MIXED, MULTIPART_RELATED, contentType));
}
- multipartRelated = contentType.toLowerCase(Locale.ENGLISH).startsWith(MULTIPART_RELATED);
+ multipartRelated = contentType.toLowerCase(Locale.ROOT).startsWith(MULTIPART_RELATED);
@SuppressWarnings("deprecation") // still has to be backward compatible
final int contentLengthInt = ctx.getContentLength();
@@ -1084,7 +1084,7 @@ public abstract class FileUploadBase {
if (fieldName != null) {
final String subContentType = headers.getHeader(CONTENT_TYPE);
if (subContentType != null
- && subContentType.toLowerCase(Locale.ENGLISH)
+ && subContentType.toLowerCase(Locale.ROOT)
.startsWith(MULTIPART_MIXED)) {
currentFieldName = fieldName;
// Multiple files associated with this field name
diff --git a/src/main/java/org/apache/commons/fileupload/ParameterParser.java b/src/main/java/org/apache/commons/fileupload/ParameterParser.java
index 4ce5275a..2e93aacb 100644
--- a/src/main/java/org/apache/commons/fileupload/ParameterParser.java
+++ b/src/main/java/org/apache/commons/fileupload/ParameterParser.java
@@ -329,7 +329,7 @@ public class ParameterParser {
if (paramName != null && !paramName.isEmpty()) {
paramName = RFC2231Utility.stripDelimiter(paramName);
if (this.lowerCaseNames) {
- paramName = paramName.toLowerCase(Locale.ENGLISH);
+ paramName = paramName.toLowerCase(Locale.ROOT);
}
params.put(paramName, paramValue);
}
diff --git a/src/main/java/org/apache/commons/fileupload/util/FileItemHeadersImpl.java b/src/main/java/org/apache/commons/fileupload/util/FileItemHeadersImpl.java
index bf6067f7..ad504d04 100644
--- a/src/main/java/org/apache/commons/fileupload/util/FileItemHeadersImpl.java
+++ b/src/main/java/org/apache/commons/fileupload/util/FileItemHeadersImpl.java
@@ -47,7 +47,7 @@ public class FileItemHeadersImpl implements FileItemHeaders, Serializable {
@Override
public String getHeader(final String name) {
- final String nameLower = name.toLowerCase(Locale.ENGLISH);
+ final String nameLower = name.toLowerCase(Locale.ROOT);
final List<String> headerValueList = headerNameToValueListMap.get(nameLower);
if (null == headerValueList) {
return null;
@@ -62,7 +62,7 @@ public class FileItemHeadersImpl implements FileItemHeaders, Serializable {
@Override
public Iterator<String> getHeaders(final String name) {
- final String nameLower = name.toLowerCase(Locale.ENGLISH);
+ final String nameLower = name.toLowerCase(Locale.ROOT);
List<String> headerValueList = headerNameToValueListMap.get(nameLower);
if (null == headerValueList) {
headerValueList = Collections.emptyList();
@@ -77,7 +77,7 @@ public class FileItemHeadersImpl implements FileItemHeaders, Serializable {
* @param value value of this header
*/
public synchronized void addHeader(final String name, final String value) {
- final String nameLower = name.toLowerCase(Locale.ENGLISH);
+ final String nameLower = name.toLowerCase(Locale.ROOT);
List<String> headerValueList = headerNameToValueListMap.get(nameLower);
if (null == headerValueList) {
headerValueList = new ArrayList<>();
diff --git a/src/main/java/org/apache/commons/fileupload/util/mime/MimeUtility.java b/src/main/java/org/apache/commons/fileupload/util/mime/MimeUtility.java
index d0378a35..a4edb5c3 100644
--- a/src/main/java/org/apache/commons/fileupload/util/mime/MimeUtility.java
+++ b/src/main/java/org/apache/commons/fileupload/util/mime/MimeUtility.java
@@ -210,7 +210,7 @@ public final class MimeUtility {
}
// pull out the character set information (this is the MIME name at this point).
- final String charset = word.substring(2, charsetPos).toLowerCase(Locale.ENGLISH);
+ final String charset = word.substring(2, charsetPos).toLowerCase(Locale.ROOT);
// now pull out the encoding token the same way.
final int encodingPos = word.indexOf('?', charsetPos + 1);
@@ -269,7 +269,7 @@ public final class MimeUtility {
return null;
}
- final String mappedCharset = MIME2JAVA.get(charset.toLowerCase(Locale.ENGLISH));
+ final String mappedCharset = MIME2JAVA.get(charset.toLowerCase(Locale.ROOT));
// if there is no mapping, then the original name is used. Many of the MIME character set
// names map directly back into Java. The reverse isn't necessarily true.
if (mappedCharset == null) {