${h.breakableString(…)} might be called with a null argument if something is broken.

For robustness, pass on the null to Jelly rather than failing page rendering.
This commit is contained in:
Jesse Glick committed 2014-04-30 18:19:17 -04:00
1 parent 87e66570b8
commit 3f2958795c
2 files changed
+5 -2

No files matched your search

+2 -1
View File
@@ -36,7 +36,7 @@ import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import jenkins.model.Jenkins;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.*;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -322,6 +322,7 @@ public class FunctionsTest {
assertBrokenAs("<<a<bc<def<ghi<", "", "<", "<a", "<bc", "<def", "<ghi", "<");
assertBrokenAs("H,e.l/l:o=w_o+|d", "H", ",e", ".l", "/l", ":o", "=w", "_o", "+|d");
assertBrokenAs("a¶‱ﻷa¶‱ﻷa¶‱ﻷa¶‱ﻷa¶‱ﻷa¶‱ﻷa¶‱ﻷa¶‱ﻷ", "a¶‱ﻷa¶‱ﻷa¶‱ﻷa¶‱ﻷa¶‱ﻷ", "a¶‱ﻷa¶‱ﻷa¶‱ﻷ");
assertNull(Functions.breakableString(null));
}
private void assertBrokenAs(String plain, String... chunks) {