Uploaded image for project: 'Commons Compress'
  1. Commons Compress
  2. COMPRESS-457

When there is no space in the disk,the method closeArchiveEntry() cannot work

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.16, 1.17
    • Fix Version/s: 1.18
    • Component/s: Compressors
    • Labels:
      None
    • Environment:

      all are environment can recurring this problems

    • Flags:
      Important

      Description

      When there is no space in the disk,I want  to delete the Compressed half file, in my code,I close  the archiveEntry use method closeArchiveEntry() of the TarArchiveOutputStream class,but because follow code fragments,closeArchiveEntry() is not work,I cannoot close io stream TarArchiveOutputStream,so that the tmp *.tar.gz cannot be delete.

      // 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 at '" + this.currBytes + "' before the '" + this.currSize + "' bytes specified in the header were written");
              } else {
                  this.recordsWritten = (int)((long)this.recordsWritten + this.currSize / 512L);
                  if (0L != this.currSize % 512L) {
                      ++this.recordsWritten;
                  }
      
                  this.haveUnclosedEntry = false;
              }
          }
      }
      

      I think this is a bug, when closeArchiveEntry() called,should not throw the follow  IOException("entry '" + this.currName + "' closed at '" + this.currBytes + "' before the '" + this.currSize + "' bytes specified in the header were written").

      // code placeholder
      if (this.currBytes < this.currSize)
      
      { throw new IOException("entry '" + this.currName + "' closed at '" + this.currBytes + "' before the '" + this.currSize + "' bytes specified in the header were written"); }
      

       

      Please help, thk!!!

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              zhagnxinyue zhangxinyue
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: