This code uses deprecated methods, which suggests that it has not been recently reviewed or maintained. Using deprecated methods might lead to erroneous behavior.
1public String encodePasswordNoncompliant(String password) {
2 // Noncompliant: uses deprecated Base64 class from Spring Framework.
3 byte[] encodedId = Base64.encode(password.toLowerCase().getBytes());
4 return new String(encodedId);
5}
1public String encodePasswordCompliant(String password) {
2 // Compliant: uses the standard Base64 class from the Java SDK..
3 byte[] encodedId = java.util.Base64.getEncoder().encode(password.toLowerCase().getBytes());
4 return new String(encodedId);
5}