You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by eb...@apache.org on 2019/05/23 12:26:40 UTC
[commons-compress] branch master updated: Harmonized the exception
thrown on zip entries using an unsupported compression method in ZipFile
and ZipArchiveInputStream
This is an automated email from the ASF dual-hosted git repository.
ebourg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git
The following commit(s) were added to refs/heads/master by this push:
new f4a190f Harmonized the exception thrown on zip entries using an unsupported compression method in ZipFile and ZipArchiveInputStream
f4a190f is described below
commit f4a190f56aef8b9a09a5c8b4bafae7cf0000c2b2
Author: Emmanuel Bourg <eb...@apache.org>
AuthorDate: Thu May 23 14:26:14 2019 +0200
Harmonized the exception thrown on zip entries using an unsupported compression method in ZipFile and ZipArchiveInputStream
---
.../compress/archivers/zip/UnsupportedZipFeatureException.java | 4 ++--
src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/UnsupportedZipFeatureException.java b/src/main/java/org/apache/commons/compress/archivers/zip/UnsupportedZipFeatureException.java
index a92f9c7..66cc0ef 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/UnsupportedZipFeatureException.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/UnsupportedZipFeatureException.java
@@ -53,8 +53,8 @@ public class UnsupportedZipFeatureException extends ZipException {
*/
public UnsupportedZipFeatureException(final ZipMethod method,
final ZipArchiveEntry entry) {
- super("unsupported feature method '" + method.name()
- + "' used in entry " + entry.getName());
+ super("unsupported compression method " + entry.getMethod()
+ + " (" + method.name() + ") used in entry " + entry.getName());
this.reason = Feature.METHOD;
this.entry = entry;
}
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
index 60205b2..f5aee2e 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
@@ -605,8 +605,7 @@ public class ZipFile implements Closeable {
case WAVPACK:
case XZ:
default:
- throw new ZipException("Found unsupported compression method "
- + ze.getMethod());
+ throw new UnsupportedZipFeatureException(ZipMethod.getMethodByCode(ze.getMethod()), ze);
}
}