Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#4209] refactor(DER): use StandardCharsets.UTF_8 instead of hardcoded "UTF-8" #4344

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets; // Updated import
import java.nio.charset.IllegalCharsetNameException;
import java.util.ArrayList;
import java.util.HashSet;
Expand All @@ -40,10 +41,6 @@
import org.ietf.jgss.GSSException;
import org.ietf.jgss.Oid;

// Referred from Apache Hadoop KerberosUtil.java
// Remove part methods
// hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/\
// security/authentication/util/KerberosUtil.java
public class KerberosServerUtils {

/**
Expand Down Expand Up @@ -354,7 +351,7 @@ DER get(int... tags) {

String getAsString() {
try {
return new String(bb.array(), bb.arrayOffset() + bb.position(), bb.remaining(), "UTF-8");
return new String(bb.array(), bb.arrayOffset() + bb.position(), bb.remaining(), StandardCharsets.UTF_8); // Updated line
} catch (UnsupportedEncodingException e) {
throw new IllegalCharsetNameException("UTF-8"); // won't happen.
}
Expand Down
Loading