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