Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix null exception in ExpressionVisitorAdapter with simple INTERVAL e…
…xpression
  • Loading branch information
tomershay committed Dec 28, 2024
commit ec9a69f7991bf0b3f0626c29dfd3a0d727d4f516
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,10 @@ public <S> T visit(ExtractExpression extractExpression, S context) {

@Override
public <S> T visit(IntervalExpression intervalExpression, S context) {
return intervalExpression.getExpression().accept(this, context);
if (intervalExpression.getExpression() != null) {
intervalExpression.getExpression().accept(this, context);
}
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,4 +321,11 @@ public <S> Void visit(ExcludesExpression expr, S parameters) {
assertInstanceOf(Column.class, exprList.get(0));
assertInstanceOf(ParenthesedExpressionList.class, exprList.get(1));
}

@Test
public void testIntervalWithNoExpression() throws JSQLParserException {
Expression expr = CCJSqlParserUtil.parseExpression("INTERVAL 1 DAY");
ExpressionVisitorAdapter<Void> adapter = new ExpressionVisitorAdapter<>();
expr.accept(adapter, null);
}
}