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/06/11 14:20:58 UTC

[commons-fileupload] 03/03: ItemSkippedException now extends FileUploadException

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 b0bc5628e5532c08460f65655421388b1c47ad82
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 11 10:20:50 2023 -0400

    ItemSkippedException now extends FileUploadException
---
 .../java/org/apache/commons/fileupload2/FileItemStream.java   | 11 ++++++++++-
 .../java/org/apache/commons/fileupload2/MultipartStream.java  |  2 +-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/FileItemStream.java b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/FileItemStream.java
index a706099..9f460a9 100644
--- a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/FileItemStream.java
+++ b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/FileItemStream.java
@@ -39,7 +39,16 @@ public interface FileItemStream extends FileItemHeadersSupport {
      * {@link FileItemStream#getInputStream()}, after {@link java.util.Iterator#hasNext()} has been invoked on the iterator, which created the
      * {@link FileItemStream}.
      */
-    class ItemSkippedException extends IOException {
+    class ItemSkippedException extends FileUploadException {
+
+        /**
+         * Constructs an instance with a given detail message.
+         *
+         * @param message The detail message (which is saved for later retrieval by the {@link #getMessage()} method)
+         */
+        ItemSkippedException(final String message) {
+            super(message);
+        }
 
         /**
          * The exceptions serial version UID, which is being used when serializing an exception instance.
diff --git a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/MultipartStream.java b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/MultipartStream.java
index c003d24..c25bea8 100644
--- a/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/MultipartStream.java
+++ b/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/MultipartStream.java
@@ -231,7 +231,7 @@ public final class MultipartStream {
 
         private void checkOpen() throws ItemSkippedException {
             if (closed) {
-                throw new FileItemStream.ItemSkippedException();
+                throw new FileItemStream.ItemSkippedException("checkOpen");
             }
         }