commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Bodewig (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COMPRESS-401) Index out of bound when using FramedLZ4CompressorOutputStream or BlockLZ4CompressorOutputStream
Date Sat, 10 Jun 2017 18:07:19 GMT

    [ https://issues.apache.org/jira/browse/COMPRESS-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16045638#comment-16045638
] 

Stefan Bodewig commented on COMPRESS-401:
-----------------------------------------

Thanks [~manuel.pagliai.visokio], unfortunately I don't get any exception when compressing
the file (using your code, except I'm doing a try-with-resources):

{code}
        try (FileInputStream fis = new FileInputStream("orders_5m.csv");
             FileOutputStream fos = new FileOutputStream(new File("orders_5m.csv.lz4"));
             BufferedOutputStream out = new BufferedOutputStream(fos);
             FramedLZ4CompressorOutputStream lzOut = new FramedLZ4CompressorOutputStream(out))
{
            final byte[] buffer = new byte[1024 * 1024];
            int n = 0;
            while (-1 != (n = fis.read(buffer))) {
                lzOut.write(buffer, 0, n);
            }
        }
{code}

it takes almost an hour on my machine but finishes without any exception.

Can you show us the stack trace you see?


> Index out of bound when using FramedLZ4CompressorOutputStream or BlockLZ4CompressorOutputStream
> -----------------------------------------------------------------------------------------------
>
>                 Key: COMPRESS-401
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-401
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Compressors
>    Affects Versions: 1.14
>            Reporter: Manuel Pagliai
>         Attachments: orders_5m.7z
>
>
> The following java snippets fail with an index out of bound exception
>     FileInputStream fis = new FileInputStream(new File("P:\\Data\\orders_5m.csv"));
>         FileOutputStream fos = new FileOutputStream(new File("P:\\Data\\orders_5m.csv.lz4"));
>         BufferedOutputStream out = new BufferedOutputStream(fos);
>         FramedLZ4CompressorOutputStream lzOut = new FramedLZ4CompressorOutputStream(out);
>         
>         final byte[] buffer = new byte[1 * 1024 * 1024];
>         int n = 0;
>         while (-1 != (n = fis.read(buffer))) {
>             lzOut.write(buffer, 0, n);
>         }
>         lzOut.close();
>         fis.close();
> Also the Lz4 Example in https://commons.apache.org/proper/commons-compress/examples.html
contains errors



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message