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 2023/04/02 15:53:14 UTC
[commons-fileupload] branch master updated (786d994 -> 3ee89c5)
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-fileupload.git
from 786d994 Remove unused exceptions from test method signature
new 4281920 Reuse Apache Commons Lang for testing
new 3ee89c5 Fix method name
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:
pom.xml | 6 ++++++
.../java/org/apache/commons/fileupload2/MultipartStream.java | 6 +++---
.../apache/commons/fileupload2/DiskFileItemSerializeTest.java | 9 ++-------
3 files changed, 11 insertions(+), 10 deletions(-)
[commons-fileupload] 01/02: Reuse Apache Commons Lang for testing
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-fileupload.git
commit 428192078ed8eca296a7dbaf7a50a83d931ea9fb
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Apr 2 11:53:01 2023 -0400
Reuse Apache Commons Lang for testing
---
pom.xml | 6 ++++++
.../apache/commons/fileupload2/DiskFileItemSerializeTest.java | 9 ++-------
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/pom.xml b/pom.xml
index c6e74ca..1e74afd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -277,6 +277,12 @@
<version>5.0.0</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.12.0</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/src/test/java/org/apache/commons/fileupload2/DiskFileItemSerializeTest.java b/src/test/java/org/apache/commons/fileupload2/DiskFileItemSerializeTest.java
index e04c7ec..8d913c7 100644
--- a/src/test/java/org/apache/commons/fileupload2/DiskFileItemSerializeTest.java
+++ b/src/test/java/org/apache/commons/fileupload2/DiskFileItemSerializeTest.java
@@ -34,6 +34,7 @@ import java.io.UncheckedIOException;
import org.apache.commons.fileupload2.disk.DiskFileItemFactory;
import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -121,13 +122,7 @@ public class DiskFileItemSerializeTest {
* Do deserialization
*/
private Object deserialize(final ByteArrayOutputStream baos) throws Exception {
- final ByteArrayInputStream bais =
- new ByteArrayInputStream(baos.toByteArray());
- final ObjectInputStream ois = new ObjectInputStream(bais);
- final Object result = ois.readObject();
- bais.close();
-
- return result;
+ return SerializationUtils.deserialize(baos.toByteArray());
}
/**
[commons-fileupload] 02/02: Fix method name
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-fileupload.git
commit 3ee89c581234c1627fe85db9ba24c95ed938b088
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Apr 2 11:53:09 2023 -0400
Fix method name
---
src/main/java/org/apache/commons/fileupload2/MultipartStream.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/fileupload2/MultipartStream.java b/src/main/java/org/apache/commons/fileupload2/MultipartStream.java
index 61f8fab..fbb2f60 100644
--- a/src/main/java/org/apache/commons/fileupload2/MultipartStream.java
+++ b/src/main/java/org/apache/commons/fileupload2/MultipartStream.java
@@ -502,7 +502,7 @@ public class MultipartStream {
*
* @return {@code true} if {@code count} first bytes in arrays {@code a} and {@code b} are equal.
*/
- public static boolean arrayequals(final byte[] a, final byte[] b, final int count) {
+ public static boolean arrayEquals(final byte[] a, final byte[] b, final int count) {
for (int i = 0; i < count; i++) {
if (a[i] != b[i]) {
return false;
@@ -776,9 +776,9 @@ public class MultipartStream {
}
marker[1] = readByte();
- if (arrayequals(marker, STREAM_TERMINATOR, 2)) {
+ if (arrayEquals(marker, STREAM_TERMINATOR, 2)) {
nextChunk = false;
- } else if (arrayequals(marker, FIELD_SEPARATOR, 2)) {
+ } else if (arrayEquals(marker, FIELD_SEPARATOR, 2)) {
nextChunk = true;
} else {
throw new MalformedStreamException("Unexpected characters follow a boundary");