提交 | 用户 | 时间
|
e57a89
|
1 |
package com.jcdm.common.exception.file; |
懒 |
2 |
|
|
3 |
import java.util.Arrays; |
|
4 |
|
|
5 |
/** |
|
6 |
* 文件上传 误异常类 |
|
7 |
* |
|
8 |
* @author jc |
|
9 |
*/ |
|
10 |
public class InvalidExtensionException extends FileUploadException |
|
11 |
{ |
|
12 |
private static final long serialVersionUID = 1L; |
|
13 |
|
|
14 |
private String[] allowedExtension; |
|
15 |
private String extension; |
|
16 |
private String filename; |
|
17 |
|
|
18 |
public InvalidExtensionException(String[] allowedExtension, String extension, String filename) |
|
19 |
{ |
|
20 |
super("文件[" + filename + "]后缀[" + extension + "]不正确,请上传" + Arrays.toString(allowedExtension) + "格式"); |
|
21 |
this.allowedExtension = allowedExtension; |
|
22 |
this.extension = extension; |
|
23 |
this.filename = filename; |
|
24 |
} |
|
25 |
|
|
26 |
public String[] getAllowedExtension() |
|
27 |
{ |
|
28 |
return allowedExtension; |
|
29 |
} |
|
30 |
|
|
31 |
public String getExtension() |
|
32 |
{ |
|
33 |
return extension; |
|
34 |
} |
|
35 |
|
|
36 |
public String getFilename() |
|
37 |
{ |
|
38 |
return filename; |
|
39 |
} |
|
40 |
|
|
41 |
public static class InvalidImageExtensionException extends InvalidExtensionException |
|
42 |
{ |
|
43 |
private static final long serialVersionUID = 1L; |
|
44 |
|
|
45 |
public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename) |
|
46 |
{ |
|
47 |
super(allowedExtension, extension, filename); |
|
48 |
} |
|
49 |
} |
|
50 |
|
|
51 |
public static class InvalidFlashExtensionException extends InvalidExtensionException |
|
52 |
{ |
|
53 |
private static final long serialVersionUID = 1L; |
|
54 |
|
|
55 |
public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename) |
|
56 |
{ |
|
57 |
super(allowedExtension, extension, filename); |
|
58 |
} |
|
59 |
} |
|
60 |
|
|
61 |
public static class InvalidMediaExtensionException extends InvalidExtensionException |
|
62 |
{ |
|
63 |
private static final long serialVersionUID = 1L; |
|
64 |
|
|
65 |
public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename) |
|
66 |
{ |
|
67 |
super(allowedExtension, extension, filename); |
|
68 |
} |
|
69 |
} |
|
70 |
|
|
71 |
public static class InvalidVideoExtensionException extends InvalidExtensionException |
|
72 |
{ |
|
73 |
private static final long serialVersionUID = 1L; |
|
74 |
|
|
75 |
public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename) |
|
76 |
{ |
|
77 |
super(allowedExtension, extension, filename); |
|
78 |
} |
|
79 |
} |
|
80 |
} |