diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/NodesPage.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/NodesPage.java
index c3a4897ab91..e080f59131b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/NodesPage.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/NodesPage.java
@@ -166,7 +166,7 @@ class NodesPage extends RmView {
nodeTableData.append("
")
.append(Times.format(info.getLastHealthUpdate())).append("\",\"")
- .append(info.getHealthReport()).append("\",\"")
+ .append(StringEscapeUtils.escapeJava(info.getHealthReport())).append("\",\"")
.append(String.valueOf(info.getNumContainers())).append("\",\"")
.append("
").append(StringUtils.byteDesc(usedMemory * BYTES_IN_MB))
@@ -201,9 +201,8 @@ class NodesPage extends RmView {
nodeTableData.length() - 1);
}
nodeTableData.append("]");
- String nodeTableDataEscaped = StringEscapeUtils.escapeJava(nodeTableData.toString());
html.script().$type("text/javascript")
- ._("var nodeTableData=" + nodeTableDataEscaped)._();
+ ._("var nodeTableData=" + nodeTableData)._();
tbody._()._();
}
}