You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by jo...@apache.org on 2020/05/04 20:13:40 UTC
[commons-fileupload] branch master updated: Documenting a possible
incompatibility in a try...catch statement.
This is an automated email from the ASF dual-hosted git repository.
jochen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-fileupload.git
The following commit(s) were added to refs/heads/master by this push:
new bf4458f Documenting a possible incompatibility in a try...catch statement.
bf4458f is described below
commit bf4458fd37aa9ef6c95e8cdb9964cdf193e47c94
Author: Jochen Wiedmann <jo...@gmail.com>
AuthorDate: Mon May 4 22:13:28 2020 +0200
Documenting a possible incompatibility in a try...catch statement.
---
src/site/apt/migration.apt.vm | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/site/apt/migration.apt.vm b/src/site/apt/migration.apt.vm
index d443e1f..d362496 100644
--- a/src/site/apt/migration.apt.vm
+++ b/src/site/apt/migration.apt.vm
@@ -33,7 +33,7 @@ Migration
2. In your dependency declaration, change the groupId to org.apache.commons, the artifactId to
commons-fileupload2, and the version number to ${project.version}.
- 2. Change namespace org.apache.commons.fileupload to org.apache.commons.fileupload2.
+ 3. Change namespace org.apache.commons.fileupload to org.apache.commons.fileupload2.
Example: Change
@@ -47,6 +47,24 @@ Migration
import org.apache.commons.fileupload2.servlet.ServletFileUpload;
+-------------------------------------------
+ 4. Existing code like the following might give compiler errors, although it
+ looks perfectly valid:
+
++-------------------------------------------
+ try {
+ // Parse a Fileupload request here.
+ } catch (IOException e) {
+ // Handle the IOException
+ } catch (FileUploadException e) {
+ // Handle the FileUploadException
+ }
++-------------------------------------------
+
+ With FileUpload 2, this is invalid, because the FileUploadException is now a
+ subclass of the IOException. The solution is simple: Just switch the order,
+ and handle the FileUploadException in the first catch clause, and the IOException
+ in the second clause.
+
# Migrating to Jakarta Servlet API, Version 5, or later.
Most existing projects, that are using Commons Fileupload, are based on the Java Servlet API, version