7099251: javax.swing.text.html.HTMLDocument.insertAfterStart(null, something) throws NPE
Reviewed-by: rupashka
Contributed-by: alexandr.scherbatiy@oracle.com
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java Tue Oct 11 15:22:40 2011 +0400
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java Mon Oct 17 15:10:42 2011 +0400
@@ -1181,7 +1181,12 @@
public void insertAfterStart(Element elem, String htmlText) throws
BadLocationException, IOException {
verifyParser();
- if (elem != null && elem.isLeaf()) {
+
+ if (elem == null || htmlText == null) {
+ return;
+ }
+
+ if (elem.isLeaf()) {
throw new IllegalArgumentException
("Can not insert HTML after start of a leaf");
}