Following simple code causes an NPE due to the space char at the beginning of the second inserted rule:
final CSSOMParser parser = new CSSOMParser(new SACParserCSS21());
final InputSource source = new InputSource(new StringReader(""));
final CSSStyleSheet ss = parser.parseStyleSheet(source, null, null);
ss.insertRule(".testStyle { width: 24px;}", 0);
ss.insertRule(" .testStyleDef { height: 42px; }", 0);
Anonymous
Now fixed in SVN. Thanks for reporting.