Skip to content

Commit f04a9df

Browse files
ankitk-meaajisaka
authored andcommitted
YARN-10491. Fix deprecation warnings in SLSWebApp.java (#2519)
Signed-off-by: Akira Ajisaka <ajisaka@apache.org> (cherry picked from commit aaf9e3d)
1 parent e02b179 commit f04a9df

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/web/SLSWebApp.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import java.io.IOException;
2222
import java.io.ObjectInputStream;
23+
import java.nio.charset.StandardCharsets;
2324
import java.text.MessageFormat;
2425
import java.util.HashMap;
2526
import java.util.Map;
@@ -94,11 +95,11 @@ public class SLSWebApp extends HttpServlet {
9495
ClassLoader cl = Thread.currentThread().getContextClassLoader();
9596
try {
9697
simulateInfoTemplate = IOUtils.toString(
97-
cl.getResourceAsStream("html/simulate.info.html.template"));
98+
cl.getResourceAsStream("html/simulate.info.html.template"), StandardCharsets.UTF_8);
9899
simulateTemplate = IOUtils.toString(
99-
cl.getResourceAsStream("html/simulate.html.template"));
100+
cl.getResourceAsStream("html/simulate.html.template"), StandardCharsets.UTF_8);
100101
trackTemplate = IOUtils.toString(
101-
cl.getResourceAsStream("html/track.html.template"));
102+
cl.getResourceAsStream("html/track.html.template"), StandardCharsets.UTF_8);
102103
} catch (IOException e) {
103104
e.printStackTrace();
104105
}

hadoop-tools/hadoop-sls/src/test/java/org/apache/hadoop/yarn/sls/web/TestSLSWebApp.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.junit.Test;
2424

2525
import java.io.File;
26+
import java.nio.charset.StandardCharsets;
2627
import java.text.MessageFormat;
2728
import java.util.HashSet;
2829
import java.util.Map;
@@ -34,7 +35,7 @@ public class TestSLSWebApp {
3435
@Test
3536
public void testSimulateInfoPageHtmlTemplate() throws Exception {
3637
String simulateInfoTemplate = FileUtils.readFileToString(
37-
new File("src/main/html/simulate.info.html.template"));
38+
new File("src/main/html/simulate.info.html.template"), StandardCharsets.UTF_8);
3839

3940
Map<String, Object> simulateInfoMap = new HashMap<>();
4041
simulateInfoMap.put("Number of racks", 10);
@@ -72,7 +73,7 @@ public void testSimulateInfoPageHtmlTemplate() throws Exception {
7273
@Test
7374
public void testSimulatePageHtmlTemplate() throws Exception {
7475
String simulateTemplate = FileUtils.readFileToString(
75-
new File("src/main/html/simulate.html.template"));
76+
new File("src/main/html/simulate.html.template"), StandardCharsets.UTF_8);
7677

7778
Set<String> queues = new HashSet<String>();
7879
queues.add("sls_queue_1");
@@ -96,7 +97,7 @@ public void testSimulatePageHtmlTemplate() throws Exception {
9697
@Test
9798
public void testTrackPageHtmlTemplate() throws Exception {
9899
String trackTemplate = FileUtils.readFileToString(
99-
new File("src/main/html/track.html.template"));
100+
new File("src/main/html/track.html.template"), StandardCharsets.UTF_8);
100101
String trackedQueueInfo = "";
101102
Set<String> trackedQueues = new HashSet<String>();
102103
trackedQueues.add("sls_queue_1");

0 commit comments

Comments
 (0)