You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/12/21 14:17:46 UTC
(commons-compress) 02/02: Reuse commons-codec, don't duplicate class XXHash32
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 7ac1cda4f818e5b1fe4347bb4f9a6442ed03a5be
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Dec 21 09:17:39 2023 -0500
Reuse commons-codec, don't duplicate class XXHash32
Deprecate Compress' XXHash32
---
src/changes/changes.xml | 3 ++-
.../compress/compressors/lz4/FramedLZ4CompressorInputStream.java | 6 +++---
.../compress/compressors/lz4/FramedLZ4CompressorOutputStream.java | 6 +++---
.../java/org/apache/commons/compress/compressors/lz4/XXHash32.java | 2 ++
4 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 7988155ed..60ae444e4 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -52,7 +52,8 @@ The <action> type attribute can be add,update,fix,remove.
<action type="fix" issue="COMPRESS-632" dev="ggregory" due-to="Yakov Shafranovich, Gary Gregory">Fixes for dump file parsing #442.</action>
<action type="fix" issue="COMPRESS-632" dev="ggregory" due-to="Yakov Shafranovich, Gary Gregory">Improve CPIO exception detection and handling #441.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate SkipShieldingInputStream without replacement (no longer used).</action>
- <action type="fix" dev="ggregory" due-to="Gary Gregory">Reuse commons-codec, don't duplicate package-private class PureJavaCrc32C.</action>
+ <action type="fix" dev="ggregory" due-to="Gary Gregory">Reuse commons-codec, don't duplicate class PureJavaCrc32C (removed package-private class).</action>
+ <action type="fix" dev="ggregory" due-to="Gary Gregory">Reuse commons-codec, don't duplicate class XXHash32 (deprecated class).</action>
<action type="fix" dev="ggregory" due-to="alumi, Gary Gregory">Add a null-check for the class loader of OsgiUtils #451.</action>
<action type="fix" dev="ggregory" due-to="alumi, Gary Gregory">Add a null-check in Pack200.newInstance(String, String).</action>
<!-- UPDATE -->
diff --git a/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorInputStream.java
index 345e0c132..4a8020ea1 100644
--- a/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorInputStream.java
@@ -112,10 +112,10 @@ public class FramedLZ4CompressorInputStream extends CompressorInputStream implem
private boolean endReached, inUncompressed;
// used for frame header checksum and content checksum, if present
- private final XXHash32 contentHash = new XXHash32();
+ private final org.apache.commons.codec.digest.XXHash32 contentHash = new org.apache.commons.codec.digest.XXHash32();
// used for block checksum, if present
- private final XXHash32 blockHash = new XXHash32();
+ private final org.apache.commons.codec.digest.XXHash32 blockHash = new org.apache.commons.codec.digest.XXHash32();
// only created if the frame doesn't set the block independence flag
private byte[] blockDependencyBuffer;
@@ -379,7 +379,7 @@ public class FramedLZ4CompressorInputStream extends CompressorInputStream implem
return read;
}
- private void verifyChecksum(final XXHash32 hash, final String kind) throws IOException {
+ private void verifyChecksum(final org.apache.commons.codec.digest.XXHash32 hash, final String kind) throws IOException {
final byte[] checksum = new byte[4];
final int read = IOUtils.readFully(inputStream, checksum);
count(read);
diff --git a/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStream.java b/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStream.java
index 9747f83a9..30659f716 100644
--- a/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStream.java
@@ -154,9 +154,9 @@ public class FramedLZ4CompressorOutputStream extends CompressorOutputStream {
private boolean finished;
// used for frame header checksum and content checksum, if requested
- private final XXHash32 contentHash = new XXHash32();
+ private final org.apache.commons.codec.digest.XXHash32 contentHash = new org.apache.commons.codec.digest.XXHash32();
// used for block checksum, if requested
- private final XXHash32 blockHash;
+ private final org.apache.commons.codec.digest.XXHash32 blockHash;
// only created if the config requires block dependency
private final byte[] blockDependencyBuffer;
@@ -185,7 +185,7 @@ public class FramedLZ4CompressorOutputStream extends CompressorOutputStream {
this.params = params;
blockData = new byte[params.blockSize.getSize()];
this.out = out;
- blockHash = params.withBlockChecksum ? new XXHash32() : null;
+ blockHash = params.withBlockChecksum ? new org.apache.commons.codec.digest.XXHash32() : null;
out.write(FramedLZ4CompressorInputStream.LZ4_SIGNATURE);
writeFrameDescriptor();
blockDependencyBuffer = params.withBlockDependency ? new byte[BlockLZ4CompressorInputStream.WINDOW_SIZE] : null;
diff --git a/src/main/java/org/apache/commons/compress/compressors/lz4/XXHash32.java b/src/main/java/org/apache/commons/compress/compressors/lz4/XXHash32.java
index 92974b3b8..31c72ab10 100644
--- a/src/main/java/org/apache/commons/compress/compressors/lz4/XXHash32.java
+++ b/src/main/java/org/apache/commons/compress/compressors/lz4/XXHash32.java
@@ -29,7 +29,9 @@ import java.util.zip.Checksum;
* @see <a href="http://cyan4973.github.io/xxHash/">xxHash</a>
* @NotThreadSafe
* @since 1.14
+ * @deprecated Use {@code org.apache.commons.codec.digest.XXHash32}.
*/
+@Deprecated
public class XXHash32 implements Checksum {
private static final int BUF_SIZE = 16;