Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E2C64200CC6 for ; Tue, 18 Jul 2017 17:20:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E172B1670BC; Tue, 18 Jul 2017 15:20:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 32BD21670BA for ; Tue, 18 Jul 2017 17:20:05 +0200 (CEST) Received: (qmail 97418 invoked by uid 500); 18 Jul 2017 15:20:03 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 97407 invoked by uid 99); 18 Jul 2017 15:20:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jul 2017 15:20:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 4D3DD1A0A63 for ; Tue, 18 Jul 2017 15:20:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id OHFWlXnNTswZ for ; Tue, 18 Jul 2017 15:20:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 381E25FCFA for ; Tue, 18 Jul 2017 15:20:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 6AEFFE0D85 for ; Tue, 18 Jul 2017 15:20:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 24B8721E8F for ; Tue, 18 Jul 2017 15:20:00 +0000 (UTC) Date: Tue, 18 Jul 2017 15:20:00 +0000 (UTC) From: "Stefan Bodewig (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (COMPRESS-417) Decompress tar.gz file failed. java.io.Exception:Error detected parsing the header MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 18 Jul 2017 15:20:06 -0000 [ https://issues.apache.org/jira/browse/COMPRESS-417?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16091703#comment-16091703 ] Stefan Bodewig commented on COMPRESS-417: ----------------------------------------- Many thanks. Have you tried unarchiving the file without gzip compression, i.e. gunzip on the command line and read the resulting tar? That way we may know whether gzip or tar is to blame. I should be able to look into this sometime later this week, but maybe the experiment may provide a useful workaround. > Decompress tar.gz file failed. java.io.Exception:Error detected parsing the header > ---------------------------------------------------------------------------------- > > Key: COMPRESS-417 > URL: https://issues.apache.org/jira/browse/COMPRESS-417 > Project: Commons Compress > Issue Type: Bug > Components: Compressors > Affects Versions: 1.14 > Reporter: alphacome > Priority: Critical > Attachments: 20000102.0000+0800-20000102.0015+0800_0.tar.gz > > > {code:java} > public static void deGzipArchive(String filepath,String dir) > throws Exception { > final File input = new File(filepath); > final InputStream is = new FileInputStream(input); > final CompressorInputStream in = new GzipCompressorInputStream(is, true); > TarArchiveInputStream tin = new TarArchiveInputStream(in); > TarArchiveEntry entry = tin.getNextTarEntry(); > while (entry != null) { > File archiveEntry = new File(dir, entry.getName()); > archiveEntry.getParentFile().mkdirs(); > if (entry.isDirectory()) { > archiveEntry.mkdir(); > entry = tin.getNextTarEntry(); > continue; > } > OutputStream out = new FileOutputStream(archiveEntry); > IOUtils.copy(tin, out); > out.close(); > entry = tin.getNextTarEntry(); > } > in.close(); > tin.close(); > } > public static void main(String[] args) throws Exception { > Gztest.deGzipArchive("D:/20000102.0000+0800-20000102.0015+0800_0.tar.gz","D:/"); > } > {code} > the tar.gz file can be decompressed in linux environment use 'tar' command. > The error log: > Exception in thread "main" java.io.IOException: Error detected parsing the header > at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextTarEntry(TarArchiveInputStream.java:286) > at gztest.deGzipArchive(gztest.java:23) > at gztest.main(gztest.java:149) > Caused by: java.lang.IllegalArgumentException: Invalid byte 100 at offset 0 in 'dos{NUL}{NUL}{NUL}{NUL}{NUL}' len=8 > at org.apache.commons.compress.archivers.tar.TarUtils.parseOctal(TarUtils.java:141) > at org.apache.commons.compress.archivers.tar.TarUtils.parseOctalOrBinary(TarUtils.java:171) > at org.apache.commons.compress.archivers.tar.TarArchiveEntry.parseTarHeader(TarArchiveEntry.java:1128) > at org.apache.commons.compress.archivers.tar.TarArchiveEntry.parseTarHeader(TarArchiveEntry.java:1091) > at org.apache.commons.compress.archivers.tar.TarArchiveEntry.(TarArchiveEntry.java:368) > at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextTarEntry(TarArchiveInputStream.java:284) > ... 2 more > -- This message was sent by Atlassian JIRA (v6.4.14#64029)