This is an automated email from the ASF dual-hosted git repository.

adelbene pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git


The following commit(s) were added to refs/heads/master by this push:
     new 664b24f2f5 Migrate to fileupload2-jakarta-servlet5 2.0.0-M4.
664b24f2f5 is described below

commit 664b24f2f5557209cae83ff4106afa37226bdb73
Author: Andrea Del Bene <[email protected]>
AuthorDate: Tue Jun 24 23:33:17 2025 +0200

    Migrate to fileupload2-jakarta-servlet5 2.0.0-M4.
---
 .../apache/wicket/markup/html/form/upload/FileUpload.java   |  9 ++++++++-
 .../http/servlet/MultipartServletWebRequestImpl.java        | 13 +++++++------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java
index c555f08f5c..3663230dd9 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java
@@ -95,7 +95,14 @@ public class FileUpload
         */
        public byte[] getBytes()
        {
-               return item.get();
+               try 
+               {
+                       return item.get();
+               } 
+               catch (IOException e)
+               {
+                       throw new WicketRuntimeException(e);
+               }
        }
 
        /**
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequestImpl.java
 
b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequestImpl.java
index 6ae48f25a6..8951e65aff 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequestImpl.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequestImpl.java
@@ -203,20 +203,21 @@ public class MultipartServletWebRequestImpl extends 
MultipartServletWebRequest
                        {
                                // Set parameter value
                                final String value;
-                               if (encoding != null)
+                               
+                               try 
                                {
-                                       try
+                                       if (encoding != null)
                                        {
                                                value = 
item.getString(Charset.forName(encoding));
                                        }
-                                       catch (IOException e)
+                                       else
                                        {
-                                               throw new 
WicketRuntimeException(e);
+                                               value = item.getString();
                                        }
                                }
-                               else
+                               catch (IOException e)
                                {
-                                       value = item.getString();
+                                       throw new WicketRuntimeException(e);
                                }
 
                                addParameter(item.getFieldName(), value);

Reply via email to