You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Stefan Bodewig (JIRA)" <ji...@apache.org> on 2010/03/02 14:44:27 UTC
[jira] Commented: (COMPRESS-84) GZip corrupt files are partially
unzipped
[ https://issues.apache.org/jira/browse/COMPRESS-84?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12840171#action_12840171 ]
Stefan Bodewig commented on COMPRESS-84:
----------------------------------------
I've committed a simple testcase with svn revision 918032 where I remove the last byte of a stream and I do get an exception.
Maybe there is something special about your testfile, but in general it seems to work.
Also note that the stream is just a layer on top of java.util.zip.GZIPInputStream - if the later doesn't throw an exception for any reason, commons-conpress' stream won't either.
> GZip corrupt files are partially unzipped
> -----------------------------------------
>
> Key: COMPRESS-84
> URL: https://issues.apache.org/jira/browse/COMPRESS-84
> Project: Commons Compress
> Issue Type: Bug
> Affects Versions: 1.0
> Environment: Apache Maven 2.2.0 (r788681; 2009-06-26 15:04:01+0200)
> Java version: 1.6.0_14
> Java home: /opt/jdk1.6.0_14/jre
> Default locale: fr_FR, platform encoding: UTF-8
> OS name: "linux" version: "2.6.30.5-28.rc2.fc11.i586" arch: "i386" Family: "unix"
> In POM : {noformat}
> <dependency>
> <groupId>org.apache.commons</groupId>
> <artifactId>commons-compress</artifactId>
> <version>1.0</version>
> <type>jar</type>
> <scope>compile</scope>
> </dependency>{noformat}
> Reporter: Florent Charton
>
> While trying to decompres gzipped data with random removed bytes, no exceptions are thrown. Same file with zcat command line utility produces error below
> {noformat}gzip: badfiles-red-64/data.txt.gz: invalid compressed data--crc error
> gzip: badfiles-red-64/data.txt.gz: invalid compressed data--length error
> {noformat}
> The code below should throw an exception about corrupted file
> {code:title=Sample extraction code}
> CompressorInputStream cis = null;
> try {
> cis = new CompressorStreamFactory().createCompressorInputStream(
> "gz", new FileInputStream("badfiles-red-64/data.txt.gz"));
> } catch (CompressorException e) {
> // This will never happen unless "gz" is changed 2 lines above
> log.error(e.getMessage(), e);
> throw new ProcessingException(e);
> }
> try {
> while (cis.read() > 0) {
> }
> } catch (IOException e) {
> log.error(e.getMessage(), e);
> throw new ProcessingException(e);
> }
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.