Reviewers: MikeSamuel, Description: Added a test case which previously caused the parser to throw Fixes the NPE
Please review this at http://codereview.appspot.com/1788042/show Affected files: M src/com/google/caja/parser/html/DomParser.java M tests/com/google/caja/parser/html/DomParserTest.java Index: tests/com/google/caja/parser/html/DomParserTest.java =================================================================== --- tests/com/google/caja/parser/html/DomParserTest.java (revision 4171) +++ tests/com/google/caja/parser/html/DomParserTest.java (working copy) @@ -239,6 +239,14 @@ Element el = new DomParser(tq, false, mq).parseDocument(); assertEquals(DOM2_HTML_RENDERED_GOLDEN, Nodes.render(el)); } + + public final void testParseLastLineComment() throws Exception { + String DOM_WITH_COMMENT = DOM2_HTML + "<!-- This is a comment -->"; + TokenQueue<HtmlTokenType> tq = tokenizeTestInput( + DOM_WITH_COMMENT, false, true); + Element el = new DomParser(tq, false, mq).parseDocument(); + assertEquals(DOM2_HTML_RENDERED_GOLDEN, Nodes.render(el)); + } public final void testParseXmlFragmentManyWays() throws Exception { for (DomParser p : allPossibleConfigurations(DOM3_XML, false)) { Index: src/com/google/caja/parser/html/DomParser.java =================================================================== --- src/com/google/caja/parser/html/DomParser.java (revision 4171) +++ src/com/google/caja/parser/html/DomParser.java (working copy) @@ -523,7 +523,7 @@ return; case COMMENT: out.processComment(t); - continue; + return; default: throw new ParseException(new Message( MessageType.MALFORMED_XHTML, t.pos,
