Skip to content

Commit c0a744b

Browse files
authored
Issue _512: Fix null return value from visitLogicalStatement (#547)
* throw an exception if visitlogicalStatement returns a null value * Made exception message more detailed
1 parent 40d4955 commit c0a744b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/main/java/com/teragrep/pth10/ast/commands/logicalstatement/LogicalStatementXML.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,12 @@ else if (ctx.getChildCount() == 3) {
334334
rv = new ElementNode(el);
335335
}
336336

337+
else {
338+
throw new IllegalStateException(
339+
"Unexpected number of children: " + ctx.getChildCount() + " in query: " + ctx.getText()
340+
);
341+
}
342+
337343
if (rv instanceof SubSearchNode) {
338344
LOGGER.info("[XML] [LogiStat] Return value was SubsearchNode. Converting to ElementNode!");
339345
return new ElementNode(((SubSearchNode) rv).asElement(doc));

0 commit comments

Comments
 (0)