You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by pe...@apache.org on 2020/08/14 03:31:35 UTC

[commons-compress] branch master updated: COMPRESS-544 : minor bug fix

This is an automated email from the ASF dual-hosted git repository.

peterlee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git


The following commit(s) were added to refs/heads/master by this push:
     new 870b54c  COMPRESS-544 : minor bug fix
870b54c is described below

commit 870b54cd922cbeb73d945a24d4a5d6df49672ca8
Author: PeterAlfredLee <pe...@gmail.com>
AuthorDate: Fri Aug 14 11:30:46 2020 +0800

    COMPRESS-544 : minor bug fix
---
 .../apache/commons/compress/archivers/tar/TarArchiveInputStream.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
index 3b99366..17275de 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
@@ -278,11 +278,13 @@ public class TarArchiveInputStream extends ArchiveInputStream {
 
         if (!currEntry.isSparse()) {
             skipped = IOUtils.skip(inputStream, numToSkip);
+            // for non-sparse entry, we should get the bytes actually skipped bytes along with
+            // inputStream.available() if inputStream is instance of FileInputStream
+            skipped = getActuallySkipped(availableOfInputStream, skipped, numToSkip);
         } else {
             skipped = skipSparse(numToSkip);
         }
 
-        skipped = getActuallySkipped(availableOfInputStream, skipped, numToSkip);
 
         count(skipped);
         entryOffset += skipped;