From 3402b695561d52f3b6f10f54bdb6979d5a93a3d2 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 21 Feb 2023 18:06:28 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4apache/commons-fileupload?= =?UTF-8?q?=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 8 --- ruoyi-common/pom.xml | 6 -- .../exception/file/FileUploadException.java | 61 +++++++++++++++++++ .../file/InvalidExtensionException.java | 1 - 4 files changed, 61 insertions(+), 15 deletions(-) create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileUploadException.java diff --git a/pom.xml b/pom.xml index de13f2ef..79129216 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,6 @@ 2.0.23 6.4.0 2.11.0 - 1.4 3.2.2 4.1.2 2.3 @@ -94,13 +93,6 @@ ${commons.io.version} - - - commons-fileupload - commons-fileupload - ${commons.fileupload.version} - - org.apache.poi diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index bd62a982..a517e267 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -78,12 +78,6 @@ commons-io - - - commons-fileupload - commons-fileupload - - org.apache.poi diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileUploadException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileUploadException.java new file mode 100644 index 00000000..f45e7ef4 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileUploadException.java @@ -0,0 +1,61 @@ +package com.ruoyi.common.exception.file; + +import java.io.PrintStream; +import java.io.PrintWriter; + +/** + * 文件上传异常类 + * + * @author ruoyi + */ +public class FileUploadException extends Exception +{ + + private static final long serialVersionUID = 1L; + + private final Throwable cause; + + public FileUploadException() + { + this(null, null); + } + + public FileUploadException(final String msg) + { + this(msg, null); + } + + public FileUploadException(String msg, Throwable cause) + { + super(msg); + this.cause = cause; + } + + @Override + public void printStackTrace(PrintStream stream) + { + super.printStackTrace(stream); + if (cause != null) + { + stream.println("Caused by:"); + cause.printStackTrace(stream); + } + } + + @Override + public void printStackTrace(PrintWriter writer) + { + super.printStackTrace(writer); + if (cause != null) + { + writer.println("Caused by:"); + cause.printStackTrace(writer); + } + } + + @Override + public Throwable getCause() + { + return cause; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java index e70f6261..f3e9c331 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java @@ -1,7 +1,6 @@ package com.ruoyi.common.exception.file; import java.util.Arrays; -import org.apache.commons.fileupload.FileUploadException; /** * 文件上传 误异常类