You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2019/08/13 18:46:00 UTC

[commons-compress] branch master updated (0c4f64c -> 2bf678b)

This is an automated email from the ASF dual-hosted git repository.

bodewig pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git.


    from 0c4f64c  COMPRESS-479 introduce a parameter class for zip readers
     new 88e26c9  Revert "COMPRESS-479 introduce a parameter class for zip readers"
     new 73d237f  COMPRESS-479 control extra field parsing via ZipArchiveEntry
     new 2bf678b  another Arrays.copyOf case

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../compress/archivers/zip/ZipArchiveEntry.java    | 214 +++++++++++++++++++--
 .../archivers/zip/ZipArchiveInputStream.java       |  56 ++----
 .../compress/archivers/zip/ZipEncodingHelper.java  |   2 +-
 .../commons/compress/archivers/zip/ZipFile.java    | 122 +++++-------
 .../compress/archivers/zip/ZipReadingOptions.java  | 146 --------------
 .../commons/compress/archivers/zip/ZipUtil.java    |  10 +-
 .../archivers/ArchiveStreamFactoryTest.java        |  32 +--
 .../archivers/zip/Maven221MultiVolumeTest.java     |   2 +-
 .../compress/archivers/zip/UTF8ZipFilesTest.java   |  29 ++-
 .../archivers/zip/ZipArchiveEntryTest.java         |  17 ++
 .../zip/ZipFileIgnoringLocalFileHeaderTest.java    |   2 +-
 src/test/resources/COMPRESS-479.zip                | Bin 0 -> 557 bytes
 12 files changed, 329 insertions(+), 303 deletions(-)
 delete mode 100644 src/main/java/org/apache/commons/compress/archivers/zip/ZipReadingOptions.java
 create mode 100644 src/test/resources/COMPRESS-479.zip


[commons-compress] 02/03: COMPRESS-479 control extra field parsing via ZipArchiveEntry

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git

commit 73d237f35106a50d0230e1fc22c0ac5c78ebbba8
Author: Stefan Bodewig <bo...@apache.org>
AuthorDate: Tue Aug 13 20:45:19 2019 +0200

    COMPRESS-479 control extra field parsing via ZipArchiveEntry
---
 .../compress/archivers/zip/ZipArchiveEntry.java    | 204 ++++++++++++++++++++-
 .../commons/compress/archivers/zip/ZipUtil.java    |  10 +-
 .../compress/archivers/zip/UTF8ZipFilesTest.java   |  25 +++
 .../archivers/zip/ZipArchiveEntryTest.java         |  17 ++
 src/test/resources/COMPRESS-479.zip                | Bin 0 -> 557 bytes
 5 files changed, 242 insertions(+), 14 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
index 55ac51c..620fa7d 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
@@ -174,8 +174,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
         final byte[] extra = entry.getExtra();
         if (extra != null) {
             setExtraFields(ExtraFieldUtils.parse(extra, true,
-                                                 ExtraFieldUtils
-                                                 .UnparseableExtraField.READ));
+                ExtraFieldUtils.UnparseableExtraField.READ, ExtraFieldUtils.ParseErrorBehavior.MAKE_UNRECOGNIZED));
         } else {
             // initializes extra data to an empty byte array
             setExtra();
@@ -444,6 +443,50 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
                 getParseableExtraFields();
     }
 
+    /**
+     * Retrieves extra fields.
+     * @param includeUnparseable whether to also return unparseable
+     * extra fields as {@link UnparseableExtraFieldData} if such data
+     * exists.
+     * @return an array of the extra fields
+     *
+     * @throws ZipException if parsing fails, can not happen if {@code
+     * mode} is {@link ExtraFieldParsingMode.BEST_EFFORT}.
+     *
+     * @since 1.19
+     */
+    public ZipExtraField[] getExtraFields(final ExtraFieldParsingMode mode)
+        throws ZipException {
+        if (mode == ExtraFieldParsingMode.BEST_EFFORT) {
+            return getExtraFields(true);
+        }
+        byte[] local = getExtra();
+        List<ZipExtraField> localFields = new ArrayList<>(Arrays.asList(ExtraFieldUtils.parse(local, true,
+            mode.getOnUnparseableData(), mode.getOnParseError())));
+        byte[] central = ExtraFieldUtils.mergeCentralDirectoryData(getAllExtraFieldsNoCopy());
+        List<ZipExtraField> centralFields = new ArrayList<>(Arrays.asList(ExtraFieldUtils.parse(central, false,
+            mode.getOnUnparseableData(), mode.getOnParseError())));
+        List<ZipExtraField> merged = new ArrayList<>();
+        for (ZipExtraField l : localFields) {
+            ZipExtraField c = null;
+            if (l instanceof UnparseableExtraFieldData) {
+                c = findUnparseable(centralFields);
+            } else {
+                c = findMatching(l.getHeaderId(), centralFields);
+            }
+            if (c != null) {
+                byte[] cd = c.getCentralDirectoryData();
+                if (cd != null && cd.length > 0) {
+                    l.parseFromCentralDirectoryData(cd, 0, cd.length);
+                }
+                centralFields.remove(c);
+            }
+            merged.add(l);
+        }
+        merged.addAll(centralFields);
+        return merged.toArray(new ZipExtraField[0]);
+    }
+
     private ZipExtraField[] getParseableExtraFieldsNoCopy() {
         if (extraFields == null) {
             return noExtraFields;
@@ -491,6 +534,25 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
         final ZipExtraField[] allExtraFieldsNoCopy = getAllExtraFieldsNoCopy();
         return (allExtraFieldsNoCopy == extraFields) ? copyOf( allExtraFieldsNoCopy) : allExtraFieldsNoCopy;
     }
+
+    private ZipExtraField findUnparseable(List<ZipExtraField> fs) {
+        for (ZipExtraField f : fs) {
+            if (f instanceof UnparseableExtraFieldData) {
+                return f;
+            }
+        }
+        return null;
+    }
+
+    private ZipExtraField findMatching(ZipShort headerId, List<ZipExtraField> fs) {
+        for (ZipExtraField f : fs) {
+            if (headerId.equals(f.getHeaderId())) {
+                return f;
+            }
+        }
+        return null;
+    }
+
     /**
      * Adds an extra field - replacing an already present extra field
      * of the same type.
@@ -618,7 +680,8 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
         try {
             final ZipExtraField[] local =
                 ExtraFieldUtils.parse(extra, true,
-                                      ExtraFieldUtils.UnparseableExtraField.READ);
+                    ExtraFieldUtils.UnparseableExtraField.READ,
+                    ExtraFieldUtils.ParseErrorBehavior.MAKE_UNRECOGNIZED);
             mergeExtraFields(local, true);
         } catch (final ZipException e) {
             // actually this is not possible as of Commons Compress 1.1
@@ -645,9 +708,11 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
         try {
             final ZipExtraField[] central =
                 ExtraFieldUtils.parse(b, false,
-                                      ExtraFieldUtils.UnparseableExtraField.READ);
+                    ExtraFieldUtils.UnparseableExtraField.READ,
+                    ExtraFieldUtils.ParseErrorBehavior.MAKE_UNRECOGNIZED);
             mergeExtraFields(central, false);
         } catch (final ZipException e) {
+            // actually this is not possible as of Commons Compress 1.19
             throw new RuntimeException(e.getMessage(), e); //NOSONAR
         }
     }
@@ -850,12 +915,33 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
                 if (existing == null) {
                     addExtraField(element);
                 } else {
-                    if (local) {
-                        final byte[] b = element.getLocalFileDataData();
-                        existing.parseFromLocalFileData(b, 0, b.length);
-                    } else {
-                        final byte[] b = element.getCentralDirectoryData();
-                        existing.parseFromCentralDirectoryData(b, 0, b.length);
+                    byte[] b = null;
+                    try {
+                        if (local) {
+                            b = element.getLocalFileDataData();
+                            existing.parseFromLocalFileData(b, 0, b.length);
+                        } else {
+                            b = element.getCentralDirectoryData();
+                            existing.parseFromCentralDirectoryData(b, 0, b.length);
+                        }
+                    } catch (ZipException ex) {
+                        if (b == null) {
+                            throw ex;
+                        }
+                        // emulate ExtraFieldUtils.ParseErrorBehavior.MAKE_UNRECOGNIZED
+                        final UnrecognizedExtraField u = new UnrecognizedExtraField();
+                        u.setHeaderId(existing.getHeaderId());
+                        if (local) {
+                            final byte[] raw = existing.getCentralDirectoryData();
+                            u.parseFromLocalFileData(b, 0, b.length);
+                            u.parseFromCentralDirectoryData(raw, 0, raw.length);
+                        } else {
+                            final byte[] raw = existing.getLocalFileDataData();
+                            u.parseFromLocalFileData(raw, 0, raw.length);
+                            u.parseFromCentralDirectoryData(b, 0, b.length);
+                        }
+                        removeExtraField(existing.getHeaderId());
+                        addExtraField(u);
                     }
                 }
             }
@@ -1013,4 +1099,102 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
         this.commentSource = commentSource;
     }
 
+
+    /**
+     * How to try to parse the extra fields.
+     *
+     * <p>Configures the bahvior for:</p>
+     * <ul>
+     *   <li>What shall happen if the extra field content doesn't
+     *   follow the recommended pattern of two-byte id followed by a
+     *   two-byte length?</li>
+     *  <li>What shall happen if an extra field is generally supported
+     *  by Commons Compress but its content cannot be parsed
+     *  correctly? This may for example happen if the archive is
+     *  corrupt, it triggers a bug in Commons Compress or the extra
+     *  field uses a version not (yet) supported by Commons
+     *  Compress.</li>
+     * </ul>
+     *
+     * @since 1.19
+     */
+    public enum ExtraFieldParsingMode {
+        /**
+         * Try to parse as many extra fields as possible and wrap
+         * unknown extra fields as well as supported extra fields that
+         * cannot be parsed in {@link UnrecognizedExtraField}.
+         *
+         * <p>Wrap extra data that doesn't follow the recommended
+         * pattern in an {@link UnparseableExtraFieldData}
+         * instance.</p>
+         *
+         * <p>This is the default behavior starting with Commons Compress 1.19.</p>
+         */
+        BEST_EFFORT(ExtraFieldUtils.UnparseableExtraField.READ,
+            ExtraFieldUtils.ParseErrorBehavior.MAKE_UNRECOGNIZED),
+        /**
+         * Try to parse as many extra fields as possible and wrap
+         * unknown extra fields in {@link UnrecognizedExtraField}.
+         *
+         * <p>Wrap extra data that doesn't follow the recommended
+         * pattern in an {@link UnparseableExtraFieldData}
+         * instance.</p>
+         *
+         * <p>Throw an exception if an extra field that is generally
+         * supported cannot be parsed.</p>
+         *
+         * <p>This used to be the default behavior prior to Commons
+         * Compress 1.19.</p>
+         */
+        STRICT_FOR_KNOW_EXTRA_FIELDS(ExtraFieldUtils.UnparseableExtraField.READ,
+            ExtraFieldUtils.ParseErrorBehavior.THROW),
+        /**
+         * Try to parse as many extra fields as possible and wrap
+         * unknown extra fields as well as supported extra fields that
+         * cannot be parsed in {@link UnrecognizedExtraField}.
+         *
+         * <p>Ignore extra data that doesn't follow the recommended
+         * pattern.</p>
+         *
+         * <p>This used to be the default behavior prior to Commons
+         * Compress 1.19.</p>
+         */
+        ONLY_PARSEABLE_LENIENT(ExtraFieldUtils.UnparseableExtraField.SKIP,
+            ExtraFieldUtils.ParseErrorBehavior.THROW),
+        /**
+         * Try to parse as many extra fields as possible and wrap
+         * unknown extra fields in {@link UnrecognizedExtraField}.
+         *
+         * <p>Ignore extra data that doesn't follow the recommended
+         * pattern.</p>
+         *
+         * <p>Throw an exception if an extra field that is generally
+         * supported cannot be parsed.</p>
+         */
+        ONLY_PARSEABLE_STRICT(ExtraFieldUtils.UnparseableExtraField.SKIP,
+            ExtraFieldUtils.ParseErrorBehavior.THROW),
+        /**
+         * Throw an exception if any of the recognized extra fields
+         * cannot be parsed or any extra field violates the
+         * recommended pattern.
+         */
+        DRACONIC(ExtraFieldUtils.UnparseableExtraField.THROW,
+            ExtraFieldUtils.ParseErrorBehavior.THROW);
+
+        private final ExtraFieldUtils.UnparseableExtraField onUnparseableData;
+        private final ExtraFieldUtils.ParseErrorBehavior onParseError;
+
+        private ExtraFieldParsingMode(ExtraFieldUtils.UnparseableExtraField onUnparseableData,
+                                      ExtraFieldUtils.ParseErrorBehavior onParseError) {
+            this.onUnparseableData = onUnparseableData;
+            this.onParseError = onParseError;
+        }
+
+        public ExtraFieldUtils.UnparseableExtraField getOnUnparseableData() {
+            return onUnparseableData;
+        }
+        public ExtraFieldUtils.ParseErrorBehavior getOnParseError() {
+            return onParseError;
+        }
+    }
 }
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
index e086412..e6e1219 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
@@ -233,8 +233,9 @@ public abstract class ZipUtil {
     static void setNameAndCommentFromExtraFields(final ZipArchiveEntry ze,
                                                  final byte[] originalNameBytes,
                                                  final byte[] commentBytes) {
-        final UnicodePathExtraField name = (UnicodePathExtraField)
-            ze.getExtraField(UnicodePathExtraField.UPATH_ID);
+        final ZipExtraField nameCandidate = ze.getExtraField(UnicodePathExtraField.UPATH_ID);
+        final UnicodePathExtraField name = nameCandidate instanceof UnicodePathExtraField
+            ? (UnicodePathExtraField) nameCandidate : null;
         final String newName = getUnicodeStringIfOriginalMatches(name,
                                                            originalNameBytes);
         if (newName != null) {
@@ -243,8 +244,9 @@ public abstract class ZipUtil {
         }
 
         if (commentBytes != null && commentBytes.length > 0) {
-            final UnicodeCommentExtraField cmt = (UnicodeCommentExtraField)
-                ze.getExtraField(UnicodeCommentExtraField.UCOM_ID);
+            final ZipExtraField cmtCandidate = ze.getExtraField(UnicodeCommentExtraField.UCOM_ID);
+            final UnicodeCommentExtraField cmt = cmtCandidate instanceof UnicodeCommentExtraField
+                ? (UnicodeCommentExtraField) cmtCandidate : null;
             final String newComment =
                 getUnicodeStringIfOriginalMatches(cmt, commentBytes);
             if (newComment != null) {
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java
index 7c745a1..2ede577 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java
@@ -239,6 +239,31 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
         }
     }
 
+    /**
+     * @see https://issues.apache.org/jira/browse/COMPRESS-479
+     */
+    @Test
+    public void streamSkipsOverUnicodeExtraFieldWithUnsupportedVersion() throws IOException {
+        try (FileInputStream archive = new FileInputStream(getFile("COMPRESS-479.zip"));
+             ZipArchiveInputStream zi = new ZipArchiveInputStream(archive)) {
+            assertEquals(OIL_BARREL_TXT, zi.getNextEntry().getName());
+            assertEquals("%U20AC_for_Dollar.txt", zi.getNextEntry().getName());
+            assertEquals(ASCII_TXT, zi.getNextEntry().getName());
+        }
+    }
+
+    /**
+     * @see https://issues.apache.org/jira/browse/COMPRESS-479
+     */
+    @Test
+    public void zipFileSkipsOverUnicodeExtraFieldWithUnsupportedVersion() throws IOException {
+        try (ZipFile zf = new ZipFile(getFile("COMPRESS-479.zip"))) {
+            assertNotNull(zf.getEntry(ASCII_TXT));
+            assertNotNull(zf.getEntry("%U20AC_for_Dollar.txt"));
+            assertNotNull(zf.getEntry(OIL_BARREL_TXT));
+        }
+    }
+
     private static void testFileRoundtrip(final String encoding, final boolean withEFS,
                                           final boolean withExplicitUnicodeExtra)
         throws IOException {
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryTest.java
index 7bdf54c..584235f 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryTest.java
@@ -23,8 +23,11 @@ import static org.junit.Assert.*;
 
 import java.io.ByteArrayOutputStream;
 import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
 
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.ExpectedException;
 
 /**
  * JUnit testcases for org.apache.commons.compress.archivers.zip.ZipEntry.
@@ -32,6 +35,9 @@ import org.junit.Test;
  */
 public class ZipArchiveEntryTest {
 
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
     /**
      * test handling of extra fields
      */
@@ -290,4 +296,15 @@ public class ZipArchiveEntryTest {
         assertFalse(ze.isUnixSymlink());
     }
 
+    @Test
+    public void reparsingUnicodeExtraWithUnsupportedversionThrowsInStrictMode()
+        throws Exception {
+        thrown.expect(ZipException.class);
+        thrown.expectMessage("Unsupported version [116] for UniCode path extra data.");
+        try (ZipFile zf = new ZipFile(getFile("COMPRESS-479.zip"))) {
+            ZipArchiveEntry ze = zf.getEntry("%U20AC_for_Dollar.txt");
+            ze.getExtraFields(ZipArchiveEntry.ExtraFieldParsingMode.STRICT_FOR_KNOW_EXTRA_FIELDS);
+        }
+    }
+
 }
diff --git a/src/test/resources/COMPRESS-479.zip b/src/test/resources/COMPRESS-479.zip
new file mode 100644
index 0000000..e1547d9
Binary files /dev/null and b/src/test/resources/COMPRESS-479.zip differ


[commons-compress] 03/03: another Arrays.copyOf case

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git

commit 2bf678bbc6c6002569559b90ea29a031f035f067
Author: Stefan Bodewig <bo...@apache.org>
AuthorDate: Tue Aug 13 20:45:41 2019 +0200

    another Arrays.copyOf case
---
 .../apache/commons/compress/archivers/zip/ZipArchiveEntry.java | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
index 620fa7d..585dfb2 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
@@ -510,14 +510,12 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
         return unparseableExtra != null ? getMergedFields() : extraFields;
     }
 
-    private ZipExtraField[] copyOf(final ZipExtraField[] src){
+    private ZipExtraField[] copyOf(final ZipExtraField[] src) {
         return copyOf(src, src.length);
     }
 
     private ZipExtraField[] copyOf(final ZipExtraField[] src, final int length) {
-        final ZipExtraField[] cpy = new ZipExtraField[length];
-        System.arraycopy(src, 0, cpy, 0, Math.min(src.length, length));
-        return cpy;
+        return Arrays.copyOf(src, length);
     }
 
     private ZipExtraField[] getMergedFields() {
@@ -821,9 +819,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
      */
     public byte[] getRawName() {
         if (rawName != null) {
-            final byte[] b = new byte[rawName.length];
-            System.arraycopy(rawName, 0, b, 0, rawName.length);
-            return b;
+            return Arrays.copyOf(rawName, rawName.length);
         }
         return null;
     }


[commons-compress] 01/03: Revert "COMPRESS-479 introduce a parameter class for zip readers"

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git

commit 88e26c9ffac61713372378c6f0225cd1a8b676e9
Author: Stefan Bodewig <bo...@apache.org>
AuthorDate: Tue Aug 13 18:41:40 2019 +0200

    Revert "COMPRESS-479 introduce a parameter class for zip readers"
    
    This reverts commit 0c4f64c2bebd85a96be8a07b1ad700c7688cbe02.
---
 .../archivers/zip/ZipArchiveInputStream.java       |  56 ++------
 .../compress/archivers/zip/ZipEncodingHelper.java  |   2 +-
 .../commons/compress/archivers/zip/ZipFile.java    | 122 +++++++----------
 .../compress/archivers/zip/ZipReadingOptions.java  | 146 ---------------------
 .../archivers/ArchiveStreamFactoryTest.java        |  32 ++---
 .../archivers/zip/Maven221MultiVolumeTest.java     |   2 +-
 .../compress/archivers/zip/UTF8ZipFilesTest.java   |   4 +-
 .../zip/ZipFileIgnoringLocalFileHeaderTest.java    |   2 +-
 8 files changed, 84 insertions(+), 282 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
index 58b006e..3d33fa4 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
@@ -27,7 +27,6 @@ import java.io.PushbackInputStream;
 import java.math.BigInteger;
 import java.nio.ByteBuffer;
 import java.util.Arrays;
-import java.util.Objects;
 import java.util.zip.CRC32;
 import java.util.zip.DataFormatException;
 import java.util.zip.Inflater;
@@ -81,11 +80,15 @@ import static org.apache.commons.compress.archivers.zip.ZipConstants.ZIP64_MAGIC
  */
 public class ZipArchiveInputStream extends ArchiveInputStream implements InputStreamStatistics {
 
-    private final ZipReadingOptions options;
+    /** The zip encoding to use for file names and the file comment. */
+    private final ZipEncoding zipEncoding;
 
     // the provided encoding (for unit tests)
     final String encoding;
 
+    /** Whether to look for and use Unicode extra fields. */
+    private final boolean useUnicodeExtraFields;
+
     /** Wrapped stream, will always be a PushbackInputStream. */
     private final InputStream in;
 
@@ -165,11 +168,11 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt
     private int entriesRead = 0;
 
     /**
-     * Create an instance using the {@link ZipReadingOptions#DEFAULT default reading options}.
+     * Create an instance using UTF-8 encoding
      * @param inputStream the stream to wrap
      */
     public ZipArchiveInputStream(final InputStream inputStream) {
-        this(inputStream, ZipReadingOptions.DEFAULT);
+        this(inputStream, ZipEncodingHelper.UTF8);
     }
 
     /**
@@ -180,7 +183,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt
      * @since 1.5
      */
     public ZipArchiveInputStream(final InputStream inputStream, final String encoding) {
-        this(inputStream, ZipReadingOptions.builder().withEncoding(encoding).build());
+        this(inputStream, encoding, true);
     }
 
     /**
@@ -192,9 +195,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt
      * Extra Fields (if present) to set the file names.
      */
     public ZipArchiveInputStream(final InputStream inputStream, final String encoding, final boolean useUnicodeExtraFields) {
-        this(inputStream, ZipReadingOptions.builder()
-             .withEncoding(encoding).withUseUnicodeExtraFields(useUnicodeExtraFields)
-             .build(), false);
+        this(inputStream, encoding, useUnicodeExtraFields, false);
     }
 
     /**
@@ -212,37 +213,9 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt
                                  final String encoding,
                                  final boolean useUnicodeExtraFields,
                                  final boolean allowStoredEntriesWithDataDescriptor) {
-        this(inputStream, ZipReadingOptions.builder()
-             .withEncoding(encoding).withUseUnicodeExtraFields(useUnicodeExtraFields)
-             .build(), allowStoredEntriesWithDataDescriptor);
-    }
-
-    /**
-     * Create an instance using the specified reading options.
-     * @param inputStream the stream to wrap
-     * @param options the reading options
-     * @throws NullPointerException if {@code options} is null
-     * @since 1.19
-     */
-    public ZipArchiveInputStream(final InputStream inputStream, final ZipReadingOptions options) {
-        this(inputStream, options, false);
-    }
-
-    /**
-     * Create an instance using the specified reading options.
-     * @param inputStream the stream to wrap
-     * @param options the reading options
-     * @param allowStoredEntriesWithDataDescriptor whether the stream
-     * will try to read STORED entries that use a data descriptor
-     * @throws NullPointerException if {@code options} is null
-     * @since 1.19
-     */
-    public ZipArchiveInputStream(final InputStream inputStream, final ZipReadingOptions options,
-                                 final boolean allowStoredEntriesWithDataDescriptor) {
-        this.options = Objects.requireNonNull(options, "options must not be null");
-        this.encoding = options.getZipEncoding() instanceof NioZipEncoding
-            ? ((NioZipEncoding) options.getZipEncoding()).getCharset().name()
-            : null;
+        this.encoding = encoding;
+        zipEncoding = ZipEncodingHelper.getZipEncoding(encoding);
+        this.useUnicodeExtraFields = useUnicodeExtraFields;
         in = new PushbackInputStream(inputStream, buf.capacity());
         this.allowStoredEntriesWithDataDescriptor =
             allowStoredEntriesWithDataDescriptor;
@@ -296,8 +269,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt
 
         final GeneralPurposeBit gpFlag = GeneralPurposeBit.parse(lfhBuf, off);
         final boolean hasUTF8Flag = gpFlag.usesUTF8ForNames();
-        final ZipEncoding entryEncoding = hasUTF8Flag ? ZipEncodingHelper.UTF8_ZIP_ENCODING
-            : options.getZipEncoding();
+        final ZipEncoding entryEncoding = hasUTF8Flag ? ZipEncodingHelper.UTF8_ZIP_ENCODING : zipEncoding;
         current.hasDataDescriptor = gpFlag.usesDataDescriptor();
         current.entry.setGeneralPurposeBit(gpFlag);
 
@@ -342,7 +314,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt
         readFully(extraData);
         current.entry.setExtra(extraData);
 
-        if (!hasUTF8Flag && options.getUseUnicodeExtraFields()) {
+        if (!hasUTF8Flag && useUnicodeExtraFields) {
             ZipUtil.setNameAndCommentFromExtraFields(current.entry, fileName, null);
         }
 
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java
index d47d31b..0dd605e 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java
@@ -32,7 +32,7 @@ public abstract class ZipEncodingHelper {
     /**
      * name of the encoding UTF-8
      */
-    static final String UTF8 = "UTF-8";
+    static final String UTF8 = "UTF8";
 
     /**
      * the encoding UTF-8
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 5f5662d..152272b 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
@@ -39,7 +39,6 @@ import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.Objects;
 import java.util.zip.Inflater;
 import java.util.zip.ZipException;
 
@@ -110,7 +109,19 @@ public class ZipFile implements Closeable {
     private final Map<String, LinkedList<ZipArchiveEntry>> nameMap =
         new HashMap<>(HASH_SIZE);
 
-    private final ZipReadingOptions options;
+    /**
+     * The encoding to use for file names and the file comment.
+     *
+     * <p>For a list of possible values see <a
+     * href="http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html">http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html</a>.
+     * Defaults to UTF-8.</p>
+     */
+    private final String encoding;
+
+    /**
+     * The zip encoding to use for file names and the file comment.
+     */
+    private final ZipEncoding zipEncoding;
 
     /**
      * File name of actual source.
@@ -123,6 +134,11 @@ public class ZipFile implements Closeable {
     private final SeekableByteChannel archive;
 
     /**
+     * Whether to look for and use Unicode extra fields.
+     */
+    private final boolean useUnicodeExtraFields;
+
+    /**
      * Whether the file is closed.
      */
     private volatile boolean closed = true;
@@ -137,27 +153,25 @@ public class ZipFile implements Closeable {
     private final ByteBuffer cfhBbuf = ByteBuffer.wrap(cfhBuf);
 
     /**
-     * Opens the given file for reading using {@link
-     * ZipReadingOptions#DEFAULT default reading options}.
+     * Opens the given file for reading, assuming "UTF8" for file names.
      *
      * @param f the archive.
      *
      * @throws IOException if an error occurs while reading the file.
      */
     public ZipFile(final File f) throws IOException {
-        this(f, ZipReadingOptions.DEFAULT);
+        this(f, ZipEncodingHelper.UTF8);
     }
 
     /**
-     * Opens the given file for reading using {@link
-     * ZipReadingOptions#DEFAULT default reading options}.
+     * Opens the given file for reading, assuming "UTF8".
      *
      * @param name name of the archive.
      *
      * @throws IOException if an error occurs while reading the file.
      */
     public ZipFile(final String name) throws IOException {
-        this(new File(name));
+        this(new File(name), ZipEncodingHelper.UTF8);
     }
 
     /**
@@ -171,7 +185,7 @@ public class ZipFile implements Closeable {
      * @throws IOException if an error occurs while reading the file.
      */
     public ZipFile(final String name, final String encoding) throws IOException {
-        this(new File(name), ZipReadingOptions.builder().withEncoding(encoding).build());
+        this(new File(name), encoding, true);
     }
 
     /**
@@ -185,7 +199,7 @@ public class ZipFile implements Closeable {
      * @throws IOException if an error occurs while reading the file.
      */
     public ZipFile(final File f, final String encoding) throws IOException {
-        this(f, ZipReadingOptions.builder().withEncoding(encoding).build());
+        this(f, encoding, true);
     }
 
     /**
@@ -202,25 +216,7 @@ public class ZipFile implements Closeable {
      */
     public ZipFile(final File f, final String encoding, final boolean useUnicodeExtraFields)
         throws IOException {
-        this(f, ZipReadingOptions.builder()
-             .withEncoding(encoding).withUseUnicodeExtraFields(useUnicodeExtraFields)
-             .build());
-    }
-
-    /**
-     * Opens the given file for reading, assuming the specified
-     * options.
-     *
-     * @param f the archive.
-     * @param options the reading options
-     *
-     * @throws IOException if an error occurs while reading the file.
-     * @throws NullPointerException if {@code options} is null
-     * @since 1.19
-     */
-    public ZipFile(final File f, final ZipReadingOptions options)
-        throws IOException {
-        this(f, options, false);
+        this(f, encoding, useUnicodeExtraFields, false);
     }
 
     /**
@@ -238,24 +234,25 @@ public class ZipFile implements Closeable {
      * true}.</p>
      *
      * @param f the archive.
-     * @param options the reading options
+     * @param encoding the encoding to use for file names, use null
+     * for the platform's default encoding
+     * @param useUnicodeExtraFields whether to use InfoZIP Unicode
+     * Extra Fields (if present) to set the file names.
      * @param ignoreLocalFileHeader whether to ignore information
      * stored inside the local file header (see the notes in this method's javadoc)
      *
      * @throws IOException if an error occurs while reading the file.
-     * @throws NullPointerException if {@code options} is null
      * @since 1.19
      */
-    public ZipFile(final File f, final ZipReadingOptions options,
+    public ZipFile(final File f, final String encoding, final boolean useUnicodeExtraFields,
                    final boolean ignoreLocalFileHeader)
         throws IOException {
         this(Files.newByteChannel(f.toPath(), EnumSet.of(StandardOpenOption.READ)),
-             f.getAbsolutePath(), options, true, ignoreLocalFileHeader);
+             f.getAbsolutePath(), encoding, useUnicodeExtraFields, true, ignoreLocalFileHeader);
     }
 
     /**
-     * Opens the given channel for reading using {@link
-     * ZipReadingOptions#DEFAULT default reading options}.
+     * Opens the given channel for reading, assuming "UTF8" for file names.
      *
      * <p>{@link
      * org.apache.commons.compress.utils.SeekableInMemoryByteChannel}
@@ -268,7 +265,7 @@ public class ZipFile implements Closeable {
      */
     public ZipFile(final SeekableByteChannel channel)
             throws IOException {
-        this(channel, "unknown archive", ZipReadingOptions.DEFAULT);
+        this(channel, "unknown archive", ZipEncodingHelper.UTF8, true);
     }
 
     /**
@@ -288,7 +285,7 @@ public class ZipFile implements Closeable {
      */
     public ZipFile(final SeekableByteChannel channel, final String encoding)
         throws IOException {
-        this(channel, "unknown archive", ZipReadingOptions.builder().withEncoding(encoding).build());
+        this(channel, "unknown archive", encoding, true);
     }
 
     /**
@@ -312,30 +309,7 @@ public class ZipFile implements Closeable {
     public ZipFile(final SeekableByteChannel channel, final String archiveName,
                    final String encoding, final boolean useUnicodeExtraFields)
         throws IOException {
-        this(channel, archiveName, ZipReadingOptions.builder()
-             .withEncoding(encoding).withUseUnicodeExtraFields(useUnicodeExtraFields)
-             .build());
-    }
-
-    /**
-     * Opens the given channel for reading, assuming the specified
-     * reading options.
-     *
-     * <p>{@link
-     * org.apache.commons.compress.utils.SeekableInMemoryByteChannel}
-     * allows you to read from an in-memory archive.</p>
-     *
-     * @param channel the archive.
-     * @param archiveName name of the archive, used for error messages only.
-     * @param options the reading options
-     *
-     * @throws IOException if an error occurs while reading the file.
-     * @throws NullPointerException if {@code options} is null
-     * @since 1.19
-     */
-    public ZipFile(final SeekableByteChannel channel, final String archiveName,
-                   final ZipReadingOptions options) throws IOException {
-        this(channel, archiveName, options, false);
+        this(channel, archiveName, encoding, useUnicodeExtraFields, false, false);
     }
 
     /**
@@ -357,27 +331,31 @@ public class ZipFile implements Closeable {
      *
      * @param channel the archive.
      * @param archiveName name of the archive, used for error messages only.
-     * @param options the reading options
+     * @param encoding the encoding to use for file names, use null
+     * for the platform's default encoding
+     * @param useUnicodeExtraFields whether to use InfoZIP Unicode
+     * Extra Fields (if present) to set the file names.
      * @param ignoreLocalFileHeader whether to ignore information
      * stored inside the local file header (see the notes in this method's javadoc)
      *
      * @throws IOException if an error occurs while reading the file.
-     * @throws NullPointerException if {@code options} is null
      * @since 1.19
      */
     public ZipFile(final SeekableByteChannel channel, final String archiveName,
-                   final ZipReadingOptions options,
+                   final String encoding, final boolean useUnicodeExtraFields,
                    final boolean ignoreLocalFileHeader)
         throws IOException {
-        this(channel, archiveName, options, false, ignoreLocalFileHeader);
+        this(channel, archiveName, encoding, useUnicodeExtraFields, false, ignoreLocalFileHeader);
     }
 
     private ZipFile(final SeekableByteChannel channel, final String archiveName,
-                    final ZipReadingOptions options,
+                    final String encoding, final boolean useUnicodeExtraFields,
                     final boolean closeOnError, final boolean ignoreLocalFileHeader)
         throws IOException {
         this.archiveName = archiveName;
-        this.options = Objects.requireNonNull(options, "options must not be null");
+        this.encoding = encoding;
+        this.zipEncoding = ZipEncodingHelper.getZipEncoding(encoding);
+        this.useUnicodeExtraFields = useUnicodeExtraFields;
         archive = channel;
         boolean success = false;
         try {
@@ -402,9 +380,7 @@ public class ZipFile implements Closeable {
      * @return null if using the platform's default character encoding.
      */
     public String getEncoding() {
-        return options.getZipEncoding() instanceof NioZipEncoding
-            ? ((NioZipEncoding) options.getZipEncoding()).getCharset().name()
-            : null;
+        return encoding;
     }
 
     /**
@@ -650,7 +626,7 @@ public class ZipFile implements Closeable {
     public String getUnixSymlink(final ZipArchiveEntry entry) throws IOException {
         if (entry != null && entry.isUnixSymlink()) {
             try (InputStream in = getInputStream(entry)) {
-                return options.getZipEncoding().decode(IOUtils.toByteArray(in));
+                return zipEncoding.decode(IOUtils.toByteArray(in));
             }
         }
         return null;
@@ -763,7 +739,7 @@ public class ZipFile implements Closeable {
         final GeneralPurposeBit gpFlag = GeneralPurposeBit.parse(cfhBuf, off);
         final boolean hasUTF8Flag = gpFlag.usesUTF8ForNames();
         final ZipEncoding entryEncoding =
-            hasUTF8Flag ? ZipEncodingHelper.UTF8_ZIP_ENCODING : options.getZipEncoding();
+            hasUTF8Flag ? ZipEncodingHelper.UTF8_ZIP_ENCODING : zipEncoding;
         if (hasUTF8Flag) {
             ze.setNameSource(ZipArchiveEntry.NameSource.NAME_WITH_EFS_FLAG);
         }
@@ -826,7 +802,7 @@ public class ZipFile implements Closeable {
         IOUtils.readFully(archive, ByteBuffer.wrap(comment));
         ze.setComment(entryEncoding.decode(comment));
 
-        if (!hasUTF8Flag && options.getUseUnicodeExtraFields()) {
+        if (!hasUTF8Flag && useUnicodeExtraFields) {
             noUTF8Flag.put(ze, new NameAndComment(fileName, comment));
         }
 
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipReadingOptions.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipReadingOptions.java
deleted file mode 100644
index 386490e..0000000
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipReadingOptions.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-
-package org.apache.commons.compress.archivers.zip;
-
-import java.util.Objects;
-
-/**
- * Collects options that control parsing of ZIP archives.
- *
- * @since 1.19
- */
-public final class ZipReadingOptions {
-    private static final ZipEncoding DEFAULT_ZIPENCODING = ZipEncodingHelper.UTF8_ZIP_ENCODING;
-    private static final boolean DEFAULT_USEUNICODEEXTRAFIELDS = true;
-    private static final ExtraFieldUtils.ParseErrorBehavior DEFAULT_EXTRAFIELDPARSEERRORBEHAVIOR =
-        ExtraFieldUtils.ParseErrorBehavior.MAKE_UNRECOGNIZED;
-
-    private final ZipEncoding zipEncoding;
-    private final boolean useUnicodeExtraFields;
-    private final ExtraFieldUtils.ParseErrorBehavior extraFieldParseErrorBehavior;
-
-    /**
-     * The default reading options.
-     *
-     * <ul>
-     * <li>UTF-8 encoding</li>
-     * <li>use unicode extra fields when available</li>
-     * <li>convert invalid extra fields into {@link UnparseableExtraFieldData}</li>
-     * </ul>
-     */
-    public static final ZipReadingOptions DEFAULT = new ZipReadingOptions(DEFAULT_ZIPENCODING,
-        DEFAULT_USEUNICODEEXTRAFIELDS, DEFAULT_EXTRAFIELDPARSEERRORBEHAVIOR);
-
-    private ZipReadingOptions(ZipEncoding zipEncoding, boolean useUnicodeExtraFields,
-        ExtraFieldUtils.ParseErrorBehavior extraFieldParseErrorBehavior) {
-        this.zipEncoding = zipEncoding;
-        this.useUnicodeExtraFields = useUnicodeExtraFields;
-        this.extraFieldParseErrorBehavior = extraFieldParseErrorBehavior;
-    }
-
-    /**
-     * The zip encoding to use for file names and the file comment.
-     */
-    public ZipEncoding getZipEncoding() {
-        return zipEncoding;
-    }
-
-    /**
-     * Whether to look for and use Unicode extra fields.
-     */
-    public boolean getUseUnicodeExtraFields() {
-        return useUnicodeExtraFields;
-    }
-
-    /**
-     * How to handle extra fields that are generally supported by
-     * Commons Compress but cannot be parsed in an archive.
-     *
-     * <p>The archive may contain corrupt extra fields or use a
-     * version not supported by Commons Compress.</p>
-     */
-    public ExtraFieldUtils.ParseErrorBehavior getExtraFieldParseErrorBehavior() {
-        return extraFieldParseErrorBehavior;
-    }
-
-    /**
-     * Obtains a builder for {@link ZipReadingOptions}.
-     */
-    public static Builder builder() {
-        return new Builder();
-    }
-
-    /**
-     * Builder for {@link ZipReadingOptions}.
-     */
-    public static class Builder {
-        private ZipEncoding zipEncoding = DEFAULT_ZIPENCODING;
-        private boolean useUnicodeExtraFields = DEFAULT_USEUNICODEEXTRAFIELDS;
-        private ExtraFieldUtils.ParseErrorBehavior extraFieldParseErrorBehavior =
-            DEFAULT_EXTRAFIELDPARSEERRORBEHAVIOR;
-
-        /**
-         * Configures the ZIP encoding.
-         *
-         * @throws NullPointException if {@code zipEncoding} is null
-         */
-        public Builder withZipEncoding(ZipEncoding zipEncoding) {
-            this.zipEncoding = Objects.requireNonNull(zipEncoding, "zipEncoding must not be null");
-            return this;
-        }
-
-        /**
-         * Configures the encoding.
-         *
-         * @param encoding name of the encoding to use, {@code null}
-         * means to use the platform's default encoding
-         */
-        public Builder withEncoding(String encoding) {
-            return withZipEncoding(ZipEncodingHelper.getZipEncoding(encoding));
-        }
-
-        /**
-         * Configures whether to use unicode extra fields to configure names and comments.
-         */
-        public Builder withUseUnicodeExtraFields(boolean useUnicodeExtraFields) {
-            this.useUnicodeExtraFields = useUnicodeExtraFields;
-            return this;
-        }
-
-        /**
-         * Configures how to handle extra fields that are generally
-         * supported by Commons Compress but cannot be parsed in an
-         * archive.
-         *
-         * @throws NullPointException if {@code extraFieldParseErrorBehavior} is null
-         */
-        public Builder withextraFieldParseErrorBehavior(ExtraFieldUtils.ParseErrorBehavior extraFieldParseErrorBehavior) {
-            this.extraFieldParseErrorBehavior = Objects.requireNonNull(extraFieldParseErrorBehavior,
-                "extraFieldParseErrorBehavior must not be null");
-            return this;
-        }
-
-        /**
-         * Create the configured {@link ZipReadingOptions}.
-         */
-        public ZipReadingOptions build() {
-            return new ZipReadingOptions(zipEncoding, useUnicodeExtraFields, extraFieldParseErrorBehavior);
-        }
-    }
-}
diff --git a/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java b/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
index 3f3e3f7..f7113ac 100644
--- a/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
@@ -195,9 +195,9 @@ public class ArchiveStreamFactoryTest {
     // The different factory types
     private static final ArchiveStreamFactory FACTORY = new ArchiveStreamFactory();
     private static final ArchiveStreamFactory FACTORY_UTF8 = new ArchiveStreamFactory("UTF-8");
-    private static final ArchiveStreamFactory FACTORY_ASCII = new ArchiveStreamFactory("US-ASCII");
+    private static final ArchiveStreamFactory FACTORY_ASCII = new ArchiveStreamFactory("ASCII");
     private static final ArchiveStreamFactory FACTORY_SET_UTF8 = getFactory("UTF-8");
-    private static final ArchiveStreamFactory FACTORY_SET_ASCII = getFactory("US-ASCII");
+    private static final ArchiveStreamFactory FACTORY_SET_ASCII = getFactory("ASCII");
 
     // Default encoding if none is provided (not even null)
     // The test currently assumes that the output default is the same as the input default
@@ -275,39 +275,39 @@ public class ArchiveStreamFactoryTest {
     static final TestData[] TESTS = {
         new TestData("bla.arj", ArchiveStreamFactory.ARJ, false, ARJ_DEFAULT, FACTORY, "charsetName"),
         new TestData("bla.arj", ArchiveStreamFactory.ARJ, false, "UTF-8", FACTORY_UTF8, "charsetName"),
-        new TestData("bla.arj", ArchiveStreamFactory.ARJ, false, "US-ASCII", FACTORY_ASCII, "charsetName"),
+        new TestData("bla.arj", ArchiveStreamFactory.ARJ, false, "ASCII", FACTORY_ASCII, "charsetName"),
         new TestData("bla.arj", ArchiveStreamFactory.ARJ, false, "UTF-8", FACTORY_SET_UTF8, "charsetName"),
-        new TestData("bla.arj", ArchiveStreamFactory.ARJ, false, "US-ASCII", FACTORY_SET_ASCII, "charsetName"),
+        new TestData("bla.arj", ArchiveStreamFactory.ARJ, false, "ASCII", FACTORY_SET_ASCII, "charsetName"),
 
         new TestData("bla.cpio", ArchiveStreamFactory.CPIO, true, CPIO_DEFAULT, FACTORY, "encoding"),
         new TestData("bla.cpio", ArchiveStreamFactory.CPIO, true, "UTF-8", FACTORY_UTF8, "encoding"),
-        new TestData("bla.cpio", ArchiveStreamFactory.CPIO, true, "US-ASCII", FACTORY_ASCII, "encoding"),
+        new TestData("bla.cpio", ArchiveStreamFactory.CPIO, true, "ASCII", FACTORY_ASCII, "encoding"),
         new TestData("bla.cpio", ArchiveStreamFactory.CPIO, true, "UTF-8", FACTORY_SET_UTF8, "encoding"),
-        new TestData("bla.cpio", ArchiveStreamFactory.CPIO, true, "US-ASCII", FACTORY_SET_ASCII, "encoding"),
+        new TestData("bla.cpio", ArchiveStreamFactory.CPIO, true, "ASCII", FACTORY_SET_ASCII, "encoding"),
 
         new TestData("bla.dump", ArchiveStreamFactory.DUMP, false, DUMP_DEFAULT, FACTORY, "encoding"),
         new TestData("bla.dump", ArchiveStreamFactory.DUMP, false, "UTF-8", FACTORY_UTF8, "encoding"),
-        new TestData("bla.dump", ArchiveStreamFactory.DUMP, false, "US-ASCII", FACTORY_ASCII, "encoding"),
+        new TestData("bla.dump", ArchiveStreamFactory.DUMP, false, "ASCII", FACTORY_ASCII, "encoding"),
         new TestData("bla.dump", ArchiveStreamFactory.DUMP, false, "UTF-8", FACTORY_SET_UTF8, "encoding"),
-        new TestData("bla.dump", ArchiveStreamFactory.DUMP, false, "US-ASCII", FACTORY_SET_ASCII, "encoding"),
+        new TestData("bla.dump", ArchiveStreamFactory.DUMP, false, "ASCII", FACTORY_SET_ASCII, "encoding"),
 
         new TestData("bla.tar", ArchiveStreamFactory.TAR, true, TAR_DEFAULT, FACTORY, "encoding"),
         new TestData("bla.tar", ArchiveStreamFactory.TAR, true, "UTF-8", FACTORY_UTF8, "encoding"),
-        new TestData("bla.tar", ArchiveStreamFactory.TAR, true, "US-ASCII", FACTORY_ASCII, "encoding"),
+        new TestData("bla.tar", ArchiveStreamFactory.TAR, true, "ASCII", FACTORY_ASCII, "encoding"),
         new TestData("bla.tar", ArchiveStreamFactory.TAR, true, "UTF-8", FACTORY_SET_UTF8, "encoding"),
-        new TestData("bla.tar", ArchiveStreamFactory.TAR, true, "US-ASCII", FACTORY_SET_ASCII, "encoding"),
+        new TestData("bla.tar", ArchiveStreamFactory.TAR, true, "ASCII", FACTORY_SET_ASCII, "encoding"),
 
         new TestData("bla.jar", ArchiveStreamFactory.JAR, true, JAR_DEFAULT, FACTORY, "encoding"),
         new TestData("bla.jar", ArchiveStreamFactory.JAR, true, "UTF-8", FACTORY_UTF8, "encoding"),
-        new TestData("bla.jar", ArchiveStreamFactory.JAR, true, "US-ASCII", FACTORY_ASCII, "encoding"),
+        new TestData("bla.jar", ArchiveStreamFactory.JAR, true, "ASCII", FACTORY_ASCII, "encoding"),
         new TestData("bla.jar", ArchiveStreamFactory.JAR, true, "UTF-8", FACTORY_SET_UTF8, "encoding"),
-        new TestData("bla.jar", ArchiveStreamFactory.JAR, true, "US-ASCII", FACTORY_SET_ASCII, "encoding"),
+        new TestData("bla.jar", ArchiveStreamFactory.JAR, true, "ASCII", FACTORY_SET_ASCII, "encoding"),
 
         new TestData("bla.zip", ArchiveStreamFactory.ZIP, true, ZIP_DEFAULT, FACTORY, "encoding"),
         new TestData("bla.zip", ArchiveStreamFactory.ZIP, true, "UTF-8", FACTORY_UTF8, "encoding"),
-        new TestData("bla.zip", ArchiveStreamFactory.ZIP, true, "US-ASCII", FACTORY_ASCII, "encoding"),
+        new TestData("bla.zip", ArchiveStreamFactory.ZIP, true, "ASCII", FACTORY_ASCII, "encoding"),
         new TestData("bla.zip", ArchiveStreamFactory.ZIP, true, "UTF-8", FACTORY_SET_UTF8, "encoding"),
-        new TestData("bla.zip", ArchiveStreamFactory.ZIP, true, "US-ASCII", FACTORY_SET_ASCII, "encoding"),
+        new TestData("bla.zip", ArchiveStreamFactory.ZIP, true, "ASCII", FACTORY_SET_ASCII, "encoding"),
     };
 
     @Test
@@ -354,8 +354,8 @@ public class ArchiveStreamFactoryTest {
         for(int i = 1; i <= TESTS.length; i++) {
             final TestData test = TESTS[i-1];
             if (test.hasOutputStream) {
-                try (final ArchiveOutputStream aos = getOutputStreamFor(test.type, test.fac)) {
-                    final String field = getField(aos, test.fieldName);
+                try (final ArchiveOutputStream ais = getOutputStreamFor(test.type, test.fac)) {
+                    final String field = getField(ais, test.fieldName);
                     if (!eq(test.expectedEncoding, field)) {
                         System.out.println("Failed test " + i + ". expected: " + test.expectedEncoding + " actual: "
                                 + field + " type: " + test.type);
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/Maven221MultiVolumeTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/Maven221MultiVolumeTest.java
index 4ce4f56..0a905e3 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/Maven221MultiVolumeTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/Maven221MultiVolumeTest.java
@@ -72,7 +72,7 @@ public class Maven221MultiVolumeTest {
             new FileInputStream(getFile("apache-maven-2.2.1.zip.001"));
         ZipArchiveInputStream zi = null;
         try {
-            zi = new ZipArchiveInputStream(archive, (String) null, false);
+            zi = new ZipArchiveInputStream(archive,null,false);
 
             // these are the entries that are supposed to be processed
             // correctly without any problems
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java
index c7ff05b..7c745a1 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java
@@ -134,7 +134,7 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
         final File archive = getFile("utf8-winzip-test.zip");
         ZipFile zf = null;
         try {
-            zf = new ZipFile(archive, (String) null, true);
+            zf = new ZipFile(archive, null, true);
             assertCanRead(zf, ASCII_TXT);
             assertCanRead(zf, EURO_FOR_DOLLAR_TXT);
             assertCanRead(zf, OIL_BARREL_TXT);
@@ -161,7 +161,7 @@ public class UTF8ZipFilesTest extends AbstractTestCase {
             new FileInputStream(getFile("utf8-winzip-test.zip"));
         ZipArchiveInputStream zi = null;
         try {
-            zi = new ZipArchiveInputStream(archive, (String) null, true);
+            zi = new ZipArchiveInputStream(archive, null, true);
             assertEquals(EURO_FOR_DOLLAR_TXT, zi.getNextEntry().getName());
             assertEquals(OIL_BARREL_TXT, zi.getNextEntry().getName());
             assertEquals(ASCII_TXT, zi.getNextEntry().getName());
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileIgnoringLocalFileHeaderTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileIgnoringLocalFileHeaderTest.java
index 457192d..3d40c03 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileIgnoringLocalFileHeaderTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileIgnoringLocalFileHeaderTest.java
@@ -103,6 +103,6 @@ public class ZipFileIgnoringLocalFileHeaderTest {
     }
 
     private static ZipFile openZipWithoutLFH(String fileName) throws IOException {
-        return new ZipFile(AbstractTestCase.getFile(fileName), ZipReadingOptions.DEFAULT, true);
+        return new ZipFile(AbstractTestCase.getFile(fileName), ZipEncodingHelper.UTF8, true, true);
     }
 }