Skip to content

Commit 06f52db

Browse files
committed
DigestUtils: use Base64, not DatatypeConverter
Unlike java.util.Base64, the DatatypeConverter class is in the javax.xml.bind package, which is not part of java.base.
1 parent 9960d51 commit 06f52db

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/main/java/org/scijava/util/DigestUtils.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
import java.io.UnsupportedEncodingException;
3333
import java.security.MessageDigest;
3434
import java.security.NoSuchAlgorithmException;
35-
36-
import javax.xml.bind.DatatypeConverter;
35+
import java.util.Base64;
3736

3837
/**
3938
* Utility class for computing cryptographic hashes.
@@ -98,7 +97,7 @@ public static String hex(final byte[] bytes) {
9897

9998
/** Converts the given byte array to a base64 string. */
10099
public static String base64(final byte[] bytes) {
101-
return DatatypeConverter.printBase64Binary(bytes);
100+
return new String(Base64.getEncoder().encode(bytes));
102101
}
103102

104103
/**

0 commit comments

Comments
 (0)