This is an automated email from the ASF dual-hosted git repository.
szetszwo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ratis.git
The following commit(s) were added to refs/heads/master by this push:
new 3febe367d RATIS-1648. Fix EI_EXPOSE_REP in MD5Hash. (#992)
3febe367d is described below
commit 3febe367d56ef3c89f07844b26037241d85be6f1
Author: Nandakumar Vadivelu <[email protected]>
AuthorDate: Thu Dec 14 00:07:07 2023 +0530
RATIS-1648. Fix EI_EXPOSE_REP in MD5Hash. (#992)
---
ratis-common/src/main/java/org/apache/ratis/io/MD5Hash.java | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/ratis-common/src/main/java/org/apache/ratis/io/MD5Hash.java
b/ratis-common/src/main/java/org/apache/ratis/io/MD5Hash.java
index 76be2d570..e60bef965 100644
--- a/ratis-common/src/main/java/org/apache/ratis/io/MD5Hash.java
+++ b/ratis-common/src/main/java/org/apache/ratis/io/MD5Hash.java
@@ -18,8 +18,6 @@
package org.apache.ratis.io;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
@@ -53,12 +51,11 @@ public class MD5Hash {
}
/** Constructs an MD5Hash with a specified value. */
- @SuppressFBWarnings("EI_EXPOSE_REP2")
public MD5Hash(byte[] digest) {
if (digest.length != MD5_LEN) {
throw new IllegalArgumentException("Wrong length: " + digest.length);
}
- this.digest = digest;
+ this.digest = digest.clone();
}
public void readFields(DataInput in) throws IOException {
@@ -82,9 +79,8 @@ public class MD5Hash {
}
/** Returns the digest bytes. */
- @SuppressFBWarnings("EI_EXPOSE_REP")
public byte[] getDigest() {
- return digest;
+ return digest.clone();
}
/** Construct a hash value for a byte array. */