This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit 2f211e562ca755c823cb9dafd15de3426cd1f958 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sat May 31 08:03:25 2025 -0400 Rename internal method - Don't use a fully qualified class name - Reduce vertical whitespace --- .../apache/commons/compress/archivers/tar/TarUtils.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java index 82c0fe979..76c4577ad 100644 --- a/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java +++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java @@ -108,7 +108,6 @@ private static String exceptionMessage(final byte[] buffer, final int offset, fi // course) and dealing with the fact that ZipEncoding#decode // can throw an IOException which parseOctal* doesn't declare String string = new String(buffer, offset, length, Charset.defaultCharset()); - string = string.replace("\0", "{NUL}"); // Replace NULs to allow string to be printed return "Invalid byte " + currentByte + " at offset " + (current - offset) + " in '" + string + "' len=" + length; } @@ -312,7 +311,6 @@ public static void formatUnsignedOctalString(final long value, final byte[] buff throw new IllegalArgumentException(value + "=" + Long.toOctalString(value) + " will not fit in octal number buffer of length " + length); } } - for (; remaining >= 0; --remaining) { // leading zeros buffer[offset + remaining] = (byte) '0'; } @@ -554,7 +552,7 @@ protected static List<TarArchiveStructSparse> parsePAX1XSparseHeaders(final Inpu // for 1.X PAX Headers final List<TarArchiveStructSparse> sparseHeaders = new ArrayList<>(); long bytesRead = 0; - long[] readResult = readLineOfNumberForPax1X(inputStream); + long[] readResult = readLineOfNumberForPax1x(inputStream); long sparseHeadersCount = readResult[0]; if (sparseHeadersCount < 0) { // overflow while reading number? @@ -562,14 +560,14 @@ protected static List<TarArchiveStructSparse> parsePAX1XSparseHeaders(final Inpu } bytesRead += readResult[1]; while (sparseHeadersCount-- > 0) { - readResult = readLineOfNumberForPax1X(inputStream); + readResult = readLineOfNumberForPax1x(inputStream); final long sparseOffset = readResult[0]; if (sparseOffset < 0) { throw new IOException("Corrupted TAR archive. Sparse header block offset contains negative value"); } bytesRead += readResult[1]; - readResult = readLineOfNumberForPax1X(inputStream); + readResult = readLineOfNumberForPax1x(inputStream); final long sparseNumbytes = readResult[0]; if (sparseNumbytes < 0) { throw new IOException("Corrupted TAR archive. Sparse header block numbytes contains negative value"); @@ -579,7 +577,7 @@ protected static List<TarArchiveStructSparse> parsePAX1XSparseHeaders(final Inpu } // skip the rest of this record data final long bytesToSkip = recordSize - bytesRead % recordSize; - org.apache.commons.io.IOUtils.skip(inputStream, bytesToSkip); + IOUtils.skip(inputStream, bytesToSkip); return sparseHeaders; } @@ -756,14 +754,14 @@ public static TarArchiveStructSparse parseSparse(final byte[] buffer, final int } /** - * For 1.X PAX Format, the sparse headers are stored in the file data block, preceding the actual file data. It consists of a series of decimal numbers + * For 1.x PAX Format, the sparse headers are stored in the file data block, preceding the actual file data. It consists of a series of decimal numbers * delimited by newlines. * * @param inputStream the input stream of the tar file * @return the decimal number delimited by '\n', and the bytes read from input stream * @throws IOException if an I/O error occurs. */ - private static long[] readLineOfNumberForPax1X(final InputStream inputStream) throws IOException { + private static long[] readLineOfNumberForPax1x(final InputStream inputStream) throws IOException { int number; long result = 0; long bytesRead = 0;