This is an automated email from the ASF dual-hosted git repository. jmclean pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push: new d99ced3c27 [#4209] chore replace hardcoded value with std definition (#6354) d99ced3c27 is described below commit d99ced3c275c8886e1e202633993373191d830e5 Author: Zhengke Zhou <madzh...@gmail.com> AuthorDate: Fri Jan 24 06:17:58 2025 +0800 [#4209] chore replace hardcoded value with std definition (#6354) ### What changes were proposed in this pull request? Use standard definition lib value to replace the hardcoded value: UTF-8. ### Why are the changes needed? Fix: #4209 ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? no --- .../gravitino/server/authentication/KerberosServerUtils.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/server-common/src/main/java/org/apache/gravitino/server/authentication/KerberosServerUtils.java b/server-common/src/main/java/org/apache/gravitino/server/authentication/KerberosServerUtils.java index 3813b26bbf..4db1a53bc2 100644 --- a/server-common/src/main/java/org/apache/gravitino/server/authentication/KerberosServerUtils.java +++ b/server-common/src/main/java/org/apache/gravitino/server/authentication/KerberosServerUtils.java @@ -16,12 +16,11 @@ package org.apache.gravitino.server.authentication; import java.io.File; import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.lang.reflect.InvocationTargetException; import java.net.InetAddress; import java.net.UnknownHostException; import java.nio.ByteBuffer; -import java.nio.charset.IllegalCharsetNameException; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; @@ -353,11 +352,8 @@ public class KerberosServerUtils { } String getAsString() { - try { - return new String(bb.array(), bb.arrayOffset() + bb.position(), bb.remaining(), "UTF-8"); - } catch (UnsupportedEncodingException e) { - throw new IllegalCharsetNameException("UTF-8"); // won't happen. - } + return new String( + bb.array(), bb.arrayOffset() + bb.position(), bb.remaining(), StandardCharsets.UTF_8); } @Override