diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/util/Fingerprint.java | 23 | ||||
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/util/FingerprintTest.java | 15 |
2 files changed, 1 insertions, 37 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/util/Fingerprint.java b/src/main/java/com/google/devtools/build/lib/util/Fingerprint.java index eb053f9be6..a461041c3d 100644 --- a/src/main/java/com/google/devtools/build/lib/util/Fingerprint.java +++ b/src/main/java/com/google/devtools/build/lib/util/Fingerprint.java @@ -28,8 +28,7 @@ import java.util.UUID; import javax.annotation.Nullable; /** - * Simplified wrapper for MD5 message digests. See also - * com.google.math.crypto.MD5HMAC for a similar interface. + * Simplified wrapper for MD5 message digests. * * @see java.security.MessageDigest */ @@ -67,7 +66,6 @@ public final class Fingerprint { * <p>This method has the side-effect of resetting the underlying digest computer. * * @return the MD5 digest as a 32-character string of hexadecimal digits - * @see com.google.math.crypto.MD5HMAC#toString() */ public String hexDigestAndReset() { return hexDigest(digestAndReset()); @@ -90,25 +88,6 @@ public final class Fingerprint { } /** - * Override of Object.toString to return a string for the MD5 digest without - * finalizing the digest computation. Calling hexDigest() instead will - * finalize the digest computation. - * - * @return the string returned by hexDigest() - */ - @Override - public String toString() { - try { - // MD5 does support cloning, so this should not fail - return hexDigest(((MessageDigest) md.clone()).digest()); - } catch (CloneNotSupportedException e) { - // MessageDigest does not support cloning, - // so just return the toString() on the MessageDigest. - return md.toString(); - } - } - - /** * Updates the digest with 0 or more bytes. * * @param input the array of bytes with which to update the digest diff --git a/src/test/java/com/google/devtools/build/lib/util/FingerprintTest.java b/src/test/java/com/google/devtools/build/lib/util/FingerprintTest.java index 42fc24e943..15a826482b 100644 --- a/src/test/java/com/google/devtools/build/lib/util/FingerprintTest.java +++ b/src/test/java/com/google/devtools/build/lib/util/FingerprintTest.java @@ -101,21 +101,6 @@ public class FingerprintTest { } @Test - public void toStringTest() throws Exception { - Fingerprint f1 = new Fingerprint(); - f1.addString("Hello "); - f1.addString("World!"); - String fp = f1.hexDigestAndReset(); - Fingerprint f2 = new Fingerprint(); - f2.addString("Hello "); - // make sure that you can call toString on the intermediate result - // and continue with the operation. - assertThat(fp).isNotEqualTo(f2.toString()); - f2.addString("World!"); - assertThat(fp).isEqualTo(f2.hexDigestAndReset()); - } - - @Test public void addBoolean() throws Exception { String f1 = new Fingerprint().addBoolean(true).hexDigestAndReset(); String f2 = new Fingerprint().addBoolean(false).hexDigestAndReset(); |