Re: 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-tdU190EK5jihLBNe54raHVAibpdURL97x8s101SFCKmnVyQ@mail.gmail.com>
I was able to create issue COMPRESS-677 with these details. I did not see
any similar existing issues. Hopefully I followed the relevant
processes correctly.

On Wed, Apr 24, 2024 at 11:31 AM Jeffrey Adamson <
[email protected]> wrote:

> 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.
>


-- 
Jeff A.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.