You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Jeffrey Adamson <je...@hcl-software.com> on 2024/04/24 15:31:56 UTC

Defect in commons-compress 1.26.1 null handling of ZipArchiveOutputStream:setEncoding(String)

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.

Re: Defect in commons-compress 1.26.1 null handling of ZipArchiveOutputStream:setEncoding(String)

Posted by Gary Gregory <ga...@gmail.com>.
On Wed, Apr 24, 2024 at 12:34 PM Jeffrey Adamson
<je...@hcl-software.com> wrote:
>
> 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.

You did and thank you.

Gary

>
> On Wed, Apr 24, 2024 at 11:31 AM Jeffrey Adamson <
> jeffrey.adamson@hcl-software.com> 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.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: Defect in commons-compress 1.26.1 null handling of ZipArchiveOutputStream:setEncoding(String)

Posted by Jeffrey Adamson <je...@hcl-software.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 <
jeffrey.adamson@hcl-software.com> 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.