Commit f4b1953f authored by Piotr Gawron's avatar Piotr Gawron
Browse files

allow empty notes node

parent 6ce765c9
......@@ -337,7 +337,9 @@ public class RestAnnotationParser {
notes = XmlParser.nodeToString(node).trim();
} else {
Node bodyNode = XmlParser.getNode("body", htmlNode.getChildNodes());
notes = XmlParser.nodeToString(bodyNode).trim();
if (bodyNode != null) {
notes = XmlParser.nodeToString(bodyNode).trim();
}
}
if (notes.indexOf("</head>") >= 0) {
......
......@@ -274,6 +274,21 @@ public class RestAnnotationParserTest extends CellDesignerTestFunctions {
rap.getNotes(node);
}
@Test
public void testGetNotesWithMissingBody() throws Exception {
RestAnnotationParser rap = new RestAnnotationParser();
Node node = super.getNodeFromXmlString("<celldesigner:notes>\n" +
" <html xmlns=\"http://www.w3.org/1999/xhtml\">\n" +
" <head>\n" +
" <title/>\n" +
" </head>\n" +
" </html>\n" +
" </celldesigner:notes>");
String notes = rap.getNotes(node);
assertNotNull(notes);
}
@Test
public void testGetNotesWithLinkInside() throws Exception {
RestAnnotationParser rap = new RestAnnotationParser();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment