懒羊羊
2024-01-31 e57a8990ae56f657a59c435a0613c5f7a8728003
提交 | 用户 | 时间
e57a89 1 package com.jcdm.common.exception.file;
2
3 import java.io.PrintStream;
4 import java.io.PrintWriter;
5
6 /**
7  * 文件上传异常类
8  * 
9  * @author jc
10  */
11 public class FileUploadException extends Exception
12 {
13
14     private static final long serialVersionUID = 1L;
15
16     private final Throwable cause;
17
18     public FileUploadException()
19     {
20         this(null, null);
21     }
22
23     public FileUploadException(final String msg)
24     {
25         this(msg, null);
26     }
27
28     public FileUploadException(String msg, Throwable cause)
29     {
30         super(msg);
31         this.cause = cause;
32     }
33
34     @Override
35     public void printStackTrace(PrintStream stream)
36     {
37         super.printStackTrace(stream);
38         if (cause != null)
39         {
40             stream.println("Caused by:");
41             cause.printStackTrace(stream);
42         }
43     }
44
45     @Override
46     public void printStackTrace(PrintWriter writer)
47     {
48         super.printStackTrace(writer);
49         if (cause != null)
50         {
51             writer.println("Caused by:");
52             cause.printStackTrace(writer);
53         }
54     }
55
56     @Override
57     public Throwable getCause()
58     {
59         return cause;
60     }
61 }