From 1ef82d75b1d4db1570ce15ede8f06aad8f2fb1a8 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 21 Feb 2023 22:55:51 +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/ruoyi-common-core/pom.xml | 6 -- .../exception/file/FileUploadException.java | 61 +++++++++++++++++++ .../file/InvalidExtensionException.java | 1 - 4 files changed, 61 insertions(+), 15 deletions(-) create mode 100644 ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/file/FileUploadException.java diff --git a/pom.xml b/pom.xml index c68b6815f..900700034 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,6 @@ 1.2.16 3.5.2 2.11.0 - 1.4 2.3 2.0.23 0.9.1 @@ -116,13 +115,6 @@ ${poi.version} - - - commons-fileupload - commons-fileupload - ${commons.fileupload.version} - - org.apache.velocity diff --git a/ruoyi-common/ruoyi-common-core/pom.xml b/ruoyi-common/ruoyi-common-core/pom.xml index fedae396c..159293777 100644 --- a/ruoyi-common/ruoyi-common-core/pom.xml +++ b/ruoyi-common/ruoyi-common-core/pom.xml @@ -95,12 +95,6 @@ commons-io - - - commons-fileupload - commons-fileupload - - org.apache.poi diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/file/FileUploadException.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/file/FileUploadException.java new file mode 100644 index 000000000..c0f57cb5d --- /dev/null +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/file/FileUploadException.java @@ -0,0 +1,61 @@ +package com.ruoyi.common.core.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/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/file/InvalidExtensionException.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/file/InvalidExtensionException.java index 33b6912a9..2e978da36 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/file/InvalidExtensionException.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/file/InvalidExtensionException.java @@ -1,7 +1,6 @@ package com.ruoyi.common.core.exception.file; import java.util.Arrays; -import org.apache.commons.fileupload.FileUploadException; /** * 文件上传 误异常类