From issues-return-68475-archive-asf-public=cust-asf.ponee.io@commons.apache.org Thu Jun 28 18:03:08 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id AE83918066B for ; Thu, 28 Jun 2018 18:03:07 +0200 (CEST) Received: (qmail 35260 invoked by uid 500); 28 Jun 2018 16:03: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 35108 invoked by uid 99); 28 Jun 2018 16:03: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; Thu, 28 Jun 2018 16:03: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 3570C1A3FF1 for ; Thu, 28 Jun 2018 16:03:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id LbEx8P65OrzN for ; Thu, 28 Jun 2018 16:03:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 9C3905F398 for ; Thu, 28 Jun 2018 16:03: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 0025EE0FB8 for ; Thu, 28 Jun 2018 16:03:01 +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 477D023F9F for ; Thu, 28 Jun 2018 16:03:00 +0000 (UTC) Date: Thu, 28 Jun 2018 16:03:00 +0000 (UTC) From: "Stefan Bodewig (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: =?utf-8?Q?[jira]_[Comment_Edited]_(COMPRESS-457)_When_there_is_no_sp?= =?utf-8?Q?ace_in_the_disk=EF=BC=8Cthe_method_cl?= =?utf-8?Q?oseArchiveEntry()_cannot_work?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COMPRESS-457?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16= 526464#comment-16526464 ]=20 Stefan Bodewig edited comment on COMPRESS-457 at 6/28/18 4:02 PM: ------------------------------------------------------------------ {quote}By the way "how to=C2=A0close the underlying stream=C2=A0even if the= re is an error?" {quote} I'm not sure I understand what you are asking. If there is an underlying er= ror in the file system then there probably is no way of closing the underly= ing stream at all. What I meant when I said "The thing that we might want t= o do is modify {{close}} to close the underlying stream even if there is an= error in {{finish}}" applies only to cases where there is a logical error = in {{finish}} like when you forgot to write enough data to the entry (so cl= osing the real stream can actually work). was (Author: bodewig): > By the way "how to=C2=A0close the underlying stream=C2=A0even if there is= an error?" I'm not sure I understand what you are asking. If there is an underlying er= ror in the file system then there probably is no way of closing the underly= ing stream at all. What I meant when I said "The thing that we might want t= o do is modify {{close}} to close the underlying stream even if there is an= error in {{finish}}" applies only to cases where there is a logical error = in {{finish}} like when you forgot to write enough data to the entry (so cl= osing the real stream can actually work). > When there is no space in the disk=EF=BC=8Cthe method closeArchiveEntry()= cannot work > -------------------------------------------------------------------------= ---- > > Key: COMPRESS-457 > URL: https://issues.apache.org/jira/browse/COMPRESS-457 > Project: Commons Compress > Issue Type: Improvement > Components: Compressors > Affects Versions: 1.16, 1.17 > Environment: all are environment=C2=A0can recurring this problems > Reporter: zhangxinyue > Priority: Minor > > When there is no space in the disk=EF=BC=8CI want=C2=A0 to delete the=C2= =A0Compressed half file=EF=BC=8C in my code=EF=BC=8CI close=C2=A0 the archi= veEntry use method closeArchiveEntry() of the=C2=A0TarArchiveOutputStream c= lass=EF=BC=8Cbut because follow code=C2=A0fragments=EF=BC=8CcloseArchiveEnt= ry() is not work=EF=BC=8CI cannoot close io stream TarArchiveOutputStream= =EF=BC=8Cso that the tmp *.tar.gz cannot be delete. > {code:java} > // code placeholder > public void closeArchiveEntry() throws IOException { > if (this.finished) { > throw new IOException("Stream has already been finished"); > } else if (!this.haveUnclosedEntry) { > throw new IOException("No current entry to close"); > } else { > this.out.flushBlock(); > if (this.currBytes < this.currSize) { > throw new IOException("entry '" + this.currName + "' closed a= t '" + this.currBytes + "' before the '" + this.currSize + "' bytes specifi= ed in the header were written"); > } else { > this.recordsWritten =3D (int)((long)this.recordsWritten + thi= s.currSize / 512L); > if (0L !=3D this.currSize % 512L) { > ++this.recordsWritten; > } > this.haveUnclosedEntry =3D false; > } > } > } > {code} > I think this is a bug, when=C2=A0closeArchiveEntry() called=EF=BC=8Cshoul= d not throw the follow=C2=A0 IOException("entry '" + this.currName + "' clo= sed at '" + this.currBytes + "' before the '" + this.currSize + "' bytes sp= ecified in the header were written"). > {code:java} > // code placeholder > if (this.currBytes < this.currSize) > { throw new IOException("entry '" + this.currName + "' closed at '" + thi= s.currBytes + "' before the '" + this.currSize + "' bytes specified in the = header were written"); } > {code} > =C2=A0 > Please help, thk!!! -- This message was sent by Atlassian JIRA (v7.6.3#76005)