Defect in commons-compress 1.26.1 null handling of ZipArchiveOutputStream:setEncoding(String)
Jeffrey Adamson <[email protected]>
| Newsgroups | gmane.comp.jakarta.commons.user |
|---|---|
| Message-ID | <CAG-tdU0_KJex+YjvubnGbCfse7SKdXeCovW3K61vCf4YhNhgfw@mail.gmail.com> |
The following code prints out "Success" with commons-compress 1.26.0 and
earlier and a stack trace with 1.26.1.
The javadocs specify that passing a null parameter value to.
ZipArchiveOutputStream.html#setEncoding(java.lang.String)
<https://commons.apache.org/proper/commons-compress/apidocs/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.html#setEncoding(java.lang.String)>
should use the platform's default encoding and not result in an
IllegalArgumentException
> import java.io.File;
> import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
>
> public class Main {
>
> public static void main(String[] args)
> throws Exception {
> ZipArchiveOutputStream zaos = new ZipArchiveOutputStream(new
> File("/dev/null"));
> zaos.setEncoding((String)null);
> System.out.println("Success");
> }
> }
>
The 1.26.1 stack trace is:
Exception in thread "main" java.lang.IllegalArgumentException: Null charset
> name
> at java.base/java.nio.charset.Charset.lookup(Charset.java:455)
> at java.base/java.nio.charset.Charset.forName(Charset.java:526)
> at
> org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.setEncoding(ZipArchiveOutputStream.java:1340)
> at Main.main(Test:11)
>
How can one go about filing a bug report for this to be fixed.
--
Jeff A.