[FIXED JENKINS-20800] HTML metacharacters not escaped in log messages.

This commit is contained in:
Jesse Glick committed 2013-11-27 18:32:22 -08:00
1 parent 8fa4ef0530
commit a900b488b5
3 files changed
+15 -7

No files matched your search

@@ -37,6 +37,8 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import jenkins.model.Jenkins;
@@ -293,4 +295,12 @@ public class FunctionsTest {
assertEquals("H<wbr>,e<wbr>.l<wbr>/l<wbr>:o<wbr>-w<wbr>_o<wbr>=+|d", Functions.breakableString("H,e.l/l:o-w_o=+|d"));
assertEquals("ALongStrin<wbr>gThatCanNo<wbr>tBeBrokenB<wbr>yDefault", Functions.breakableString("ALongStringThatCanNotBeBrokenByDefault"));
}
@Bug(20800)
@Test public void printLogRecordHtml() throws Exception {
LogRecord lr = new LogRecord(Level.INFO, "Bad input <xml/>");
lr.setLoggerName("test");
assertEquals("Bad input &lt;xml/>\n", Functions.printLogRecordHtml(lr, null)[3]);
}
}