Skip to content

Commit

Permalink
RATIS-1648. Fix EI_EXPOSE_REP in MD5Hash. (#992)
Browse files Browse the repository at this point in the history
  • Loading branch information
nandakumar131 authored Dec 13, 2023
1 parent 8944035 commit 3febe36
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions ratis-common/src/main/java/org/apache/ratis/io/MD5Hash.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -53,12 +51,11 @@ public MD5Hash(String hex) {
}

/** 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 {
Expand All @@ -82,9 +79,8 @@ public void set(MD5Hash that) {
}

/** Returns the digest bytes. */
@SuppressFBWarnings("EI_EXPOSE_REP")
public byte[] getDigest() {
return digest;
return digest.clone();
}

/** Construct a hash value for a byte array. */
Expand Down

0 comments on commit 3febe36

Please sign in to comment.