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 2026/02/08 13:16:45 UTC
(commons-fileupload) branch 1.x updated (61d367b6 -> 85e64d78)
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 61d367b6 org.apache.commons.fileupload.util.Closeable now extends java.io.Closeable.
new b3412554 Make literal constant more readable
new d3418e68 Better internal name
new 85e64d78 Use StandardCharsets instead of a magic string
The 3 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:
.../java/org/apache/commons/fileupload/disk/DiskFileItem.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
(commons-fileupload) 02/03: Better internal name
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 d3418e688211042b624f3f7d52a894a60183678c
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 8 08:14:56 2026 -0500
Better internal name
---
src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java b/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java
index cc8ac86e..357941b6 100644
--- a/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java
+++ b/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java
@@ -84,11 +84,10 @@ public class DiskFileItem implements FileItem {
*
* @return A String with the non-random looking instance identifier.
*/
- private static String getUniqueId() {
+ private static String nextUniqueId() {
final int limit = 100_000_000;
final int current = COUNTER.getAndIncrement();
String id = Integer.toString(current);
-
// If you manage to get more than 100 million of ids, you'll
// start getting ids longer than 8 characters.
if (current < limit) {
@@ -438,7 +437,7 @@ public class DiskFileItem implements FileItem {
tempDir = new File(System.getProperty("java.io.tmpdir"));
}
- final String tempFileName = String.format("upload_%s_%s.tmp", UID, getUniqueId());
+ final String tempFileName = String.format("upload_%s_%s.tmp", UID, nextUniqueId());
tempFile = new File(tempDir, tempFileName);
}
(commons-fileupload) 03/03: Use StandardCharsets instead of a magic string
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 85e64d7827eeb235e6fd73d81e3c35f1784e7d09
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 8 08:16:41 2026 -0500
Use StandardCharsets instead of a magic string
---
src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java b/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java
index 357941b6..f1262ba9 100644
--- a/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java
+++ b/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java
@@ -24,6 +24,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.UncheckedIOException;
import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.Map;
import java.util.UUID;
@@ -71,7 +72,7 @@ public class DiskFileItem implements FileItem {
* "text" type are defined to have a default charset value of
* "ISO-8859-1" when received via HTTP.
*/
- public static final String DEFAULT_CHARSET = "ISO-8859-1";
+ public static final String DEFAULT_CHARSET = StandardCharsets.ISO_8859_1.name();
/**
* UID used in unique file name generation.
(commons-fileupload) 01/03: Make literal constant more readable
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 b3412554fe52dbaa776c728ea51bd370d4bae384
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 8 08:10:28 2026 -0500
Make literal constant more readable
---
src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java b/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java
index 8338f39e..cc8ac86e 100644
--- a/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java
+++ b/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java
@@ -85,7 +85,7 @@ public class DiskFileItem implements FileItem {
* @return A String with the non-random looking instance identifier.
*/
private static String getUniqueId() {
- final int limit = 100000000;
+ final int limit = 100_000_000;
final int current = COUNTER.getAndIncrement();
String id = Integer.toString(current);