YARN-11647. use StandardCharsets.UTF_8 (#6447) Contributed by PJ Fanning.

Signed-off-by: Shilun Fan <slfan1989@apache.org>
This commit is contained in:
PJ Fanning 2024-01-18 06:53:18 +01:00 committed by GitHub
parent ba6ada73ac
commit 04e447cfa7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 7 deletions

View File

@ -20,7 +20,6 @@
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.text.DecimalFormat;
import java.util.Arrays;
@ -168,7 +167,7 @@ private int listQueue(String queueName, String subClusterId)
throws YarnException, IOException {
int rc;
PrintWriter writer = new PrintWriter(
new OutputStreamWriter(sysout, Charset.forName("UTF-8")));
new OutputStreamWriter(sysout, StandardCharsets.UTF_8));
QueueInfo queueInfo = client.getQueueInfo(queueName, subClusterId);
if (queueInfo != null) {
if (isYarnFederationEnabled(getConf())) {
@ -200,7 +199,7 @@ private int listQueue(String queueName, String subClusterId)
private int listChildQueues(String parentQueueName) throws IOException, YarnException {
int exitCode;
PrintWriter writer = new PrintWriter(new OutputStreamWriter(
sysout, Charset.forName(StandardCharsets.UTF_8.name())));
sysout, StandardCharsets.UTF_8));
if (parentQueueName.equalsIgnoreCase(ALLTAG)) {
List<QueueInfo> queueInfos = client.getAllQueues();
if (queueInfos != null) {

View File

@ -72,7 +72,6 @@
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.ArrayList;
@ -483,7 +482,7 @@ private int handleSubCluster(String[] args) throws ParseException, IOException,
private int handleGetSubClusters() throws IOException, YarnException {
PrintWriter writer = new PrintWriter(new OutputStreamWriter(
System.out, Charset.forName(StandardCharsets.UTF_8.name())));
System.out, StandardCharsets.UTF_8));
ResourceManagerAdministrationProtocol adminProtocol = createAdminProtocol();
GetSubClustersRequest request = GetSubClustersRequest.newInstance();
GetSubClustersResponse response = adminProtocol.getFederationSubClusters(request);
@ -527,7 +526,7 @@ private int handleDeregisterSubCluster(String subClusterId)
private int deregisterSubCluster(String subClusterId)
throws IOException, YarnException {
PrintWriter writer = new PrintWriter(new OutputStreamWriter(
System.out, Charset.forName(StandardCharsets.UTF_8.name())));
System.out, StandardCharsets.UTF_8));
ResourceManagerAdministrationProtocol adminProtocol = createAdminProtocol();
DeregisterSubClusterRequest request =
DeregisterSubClusterRequest.newInstance(subClusterId);
@ -911,7 +910,7 @@ protected int handListPolicies(int pageSize, int currentPage, String queue, List
pageSize, currentPage, queue, queues);
try {
PrintWriter writer = new PrintWriter(new OutputStreamWriter(
System.out, Charset.forName(StandardCharsets.UTF_8.name())));
System.out, StandardCharsets.UTF_8));
QueryFederationQueuePoliciesRequest request =
QueryFederationQueuePoliciesRequest.newInstance(pageSize, currentPage, queue, queues);
ResourceManagerAdministrationProtocol adminProtocol = createAdminProtocol();