1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.compress.archivers.zip;
19
20 import java.io.Serializable;
21 import java.util.zip.ZipException;
22
23
24
25
26
27
28 public class UnsupportedZipFeatureException extends ZipException {
29
30
31
32
33
34
35 public static class Feature implements Serializable {
36
37 private static final long serialVersionUID = 4112582948775420359L;
38
39
40
41 public static final Feature ENCRYPTION = new Feature("encryption");
42
43
44
45 public static final Feature METHOD = new Feature("compression method");
46
47
48
49 public static final Feature DATA_DESCRIPTOR = new Feature("data descriptor");
50
51
52
53
54
55 public static final Feature SPLITTING = new Feature("splitting");
56
57
58
59
60
61
62 public static final Feature UNKNOWN_COMPRESSED_SIZE = new Feature("unknown compressed size");
63
64 private final String name;
65
66 private Feature(final String name) {
67 this.name = name;
68 }
69
70 @Override
71 public String toString() {
72 return name;
73 }
74 }
75
76 private static final long serialVersionUID = 20161219L;
77 private final Feature reason;
78
79 private final transient ZipArchiveEntry entry;
80
81
82
83
84
85
86
87 public UnsupportedZipFeatureException(final Feature reason) {
88 super("Unsupported feature " + reason + " used in archive.");
89 this.reason = reason;
90 this.entry = null;
91 }
92
93
94
95
96
97
98
99 public UnsupportedZipFeatureException(final Feature reason, final ZipArchiveEntry entry) {
100 super("Unsupported feature " + reason + " used in entry " + entry.getName());
101 this.reason = reason;
102 this.entry = entry;
103 }
104
105
106
107
108
109
110
111
112 public UnsupportedZipFeatureException(final ZipMethod method, final ZipArchiveEntry entry) {
113 super("Unsupported compression method " + entry.getMethod() + " (" + method.name() + ") used in entry " + entry.getName());
114 this.reason = Feature.METHOD;
115 this.entry = entry;
116 }
117
118
119
120
121
122
123 public ZipArchiveEntry getEntry() {
124 return entry;
125 }
126
127
128
129
130
131
132 public Feature getFeature() {
133 return reason;
134 }
135 }