This is an automated email from the ASF dual-hosted git repository.
bodewig 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 24788a9 looks as if we may forget flipping the buffer for sparse
entries
24788a9 is described below
commit 24788a9c0616cb160c29657db499e9690528e36e
Author: Stefan Bodewig <[email protected]>
AuthorDate: Fri May 21 22:05:03 2021 +0200
looks as if we may forget flipping the buffer for sparse entries
---
src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git
a/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java
b/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java
index 1c25ca8..34d9351 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java
@@ -689,6 +689,7 @@ public class TarFile implements Closeable {
setAtEOF(true);
} else {
entryOffset += totalRead;
+ buf.flip();
}
return totalRead;
}
@@ -741,9 +742,7 @@ public class TarFile implements Closeable {
private int readArchive(final long pos, final ByteBuffer buf) throws
IOException {
channel.position(pos);
- final int read = channel.read(buf);
- buf.flip();
- return read;
+ return channel.read(buf);
}
}
}