What steps will reproduce the problem?
1. use MainClass.java from trunk
2. set wikitext = "* [[X]], [[Y]]" + "\nZ";
3. run app
What is the expected output? What do you see instead?
expected: <div><ul><li><a href="SMARTLINK:X">X</a>, <a
href="SMARTLINK:Y">Y</a></li></ul><p>Z</p></div>
(NB SMARTLINK is my dummy SmartLinkResolver)
instead:
Exception in thread "main" java.lang.NullPointerException
at be.devijver.wikipedia.parser.ast.UnorderedListItem.toString(UnorderedListItem.java:16)
Please provide any additional information below.
This exception is thrown when there is no character at the end of the list
I copy/pasting here my patch.
in MarkupParser.java method public Content[] parseContentList()
TRUNK VERSION
if (currentCharacter == '\n') {
if (!characters.isEmpty()) {
contentList.add(new Characters(asString(characters)));
return (Content[])contentList.toArray(new Content[contentList.size()]);
} else {
return null;
}
}
PATCHED VERSION
if (currentCharacter == '\n')
{
if (!characters.isEmpty())
contentList.add(new Characters(asString(characters)));
if (!contentList.isEmpty())
return (Content[]) contentList
.toArray(new Content[contentList.size()]);
return null;
}
Original issue reported on code.google.com by adrianvintu@gmail.com on 29 Jul 2010 at 8:07
Original issue reported on code.google.com by
adrianvintu@gmail.com
on 29 Jul 2010 at 8:07