diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index c621aead169..a94d24c7a9e 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -28,6 +28,10 @@ Release 2.0.4-beta - UNRELEASED
YARN-380. Fix yarn node -status output to be better readable. (Omkar Vinit
Joshi via vinodkv)
+ YARN-410. Fixed RM UI so that the new lines diagnostics for a failed app on
+ the per-application page are translated to html line breaks. (Omkar Vinit
+ Joshi via vinodkv)
+
OPTIMIZATIONS
BUG FIXES
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/InfoBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/InfoBlock.java
index 88b7297c133..7d5f1a2f938 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/InfoBlock.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/InfoBlock.java
@@ -20,7 +20,11 @@
import org.apache.hadoop.yarn.webapp.ResponseInfo;
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;
-import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.*;
+import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV;
+import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE;
+import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TD;
+import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TR;
+
import com.google.inject.Inject;
@@ -47,7 +51,19 @@ public class InfoBlock extends HtmlBlock {
String value = String.valueOf(item.value);
if (item.url == null) {
if (!item.isRaw) {
- tr.td(value);
+ TD
>>> td = tr.td();
+ if ( value.lastIndexOf('\n') > 0) {
+ String []lines = value.split("\n");
+ DIV>>>> singleLineDiv;
+ for ( String line :lines) {
+ singleLineDiv = td.div();
+ singleLineDiv._r(line);
+ singleLineDiv._();
+ }
+ } else {
+ td._r(value);
+ }
+ td._();
} else {
tr.td()._r(value)._();
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestInfoBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestInfoBlock.java
new file mode 100644
index 00000000000..41166d9fa32
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestInfoBlock.java
@@ -0,0 +1,81 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.hadoop.yarn.webapp.view;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import static org.junit.Assert.assertTrue;
+
+import org.apache.hadoop.yarn.webapp.ResponseInfo;
+import org.apache.hadoop.yarn.webapp.test.WebAppTests;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestInfoBlock {
+
+ public static StringWriter sw;
+
+ public static PrintWriter pw;
+
+ public static class MultilineInfoBlock extends InfoBlock{
+
+ static ResponseInfo resInfo;
+
+ static {
+ resInfo = new ResponseInfo();
+ resInfo._("Single_line_value", "This is one line.");
+ resInfo._("Multiple_line_value", "This is first line.\nThis is second line.");
+ }
+
+ @Override
+ public PrintWriter writer() {
+ return TestInfoBlock.pw;
+ }
+
+ MultilineInfoBlock(ResponseInfo info) {
+ super(resInfo);
+ }
+
+ public MultilineInfoBlock() {
+ super(resInfo);
+ }
+ }
+
+ @Before
+ public void setup() {
+ sw = new StringWriter();
+ pw = new PrintWriter(sw);
+ }
+
+ @Test(timeout=60000L)
+ public void testMultilineInfoBlock() throws Exception{
+
+ WebAppTests.testBlock(MultilineInfoBlock.class);
+ TestInfoBlock.pw.flush();
+ String output = TestInfoBlock.sw.toString().replaceAll(" +", " ");
+ String expectedSinglelineData = " |
\n"
+ + " \n Single_line_value\n | \n This is one line.\n";
+ String expectedMultilineData = " |
\n"
+ + " \n Multiple_line_value\n | \n \n"
+ + " This is first line.\n \n \n"
+ + " This is second line.\n \n";
+ assertTrue(output.contains(expectedSinglelineData) && output.contains(expectedMultilineData));
+ }
+}
\ No newline at end of file
|