Skip to content

issue_484: Null pointer passed to DPLParserCatalystVisitor - #485

Open
Abigael-JT wants to merge 10 commits into
teragrep:mainfrom
Abigael-JT:issue_484
Open

issue_484: Null pointer passed to DPLParserCatalystVisitor#485
Abigael-JT wants to merge 10 commits into
teragrep:mainfrom
Abigael-JT:issue_484

Conversation

@Abigael-JT

Copy link
Copy Markdown
Contributor
  • throw an exception when DPLParserCatalystContext is missing instead of passing a Null pointer to DPLParserCatalystVisitor
  • return NullNode instead of null

@Abigael-JT
Abigael-JT requested a review from elliVM January 24, 2025 08:59
@Abigael-JT Abigael-JT self-assigned this Jan 24, 2025
@Abigael-JT Abigael-JT changed the title Null pointer passed to DPLParserCatalystVisitor issue_484: Null pointer passed to DPLParserCatalystVisitor Jan 24, 2025

@elliVM elliVM left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good. Some changes requested to improve code quality

@Abigael-JT

Copy link
Copy Markdown
Contributor Author

Removed DPLParserCatalystContext null check, added ifInfoEnabled guard to logger messages with method call and removed commented code

@Abigael-JT
Abigael-JT requested a review from elliVM January 29, 2025 12:12
elliVM
elliVM previously approved these changes Jan 30, 2025
@Abigael-JT
Abigael-JT requested a review from 51-code January 30, 2025 08:42
@Abigael-JT
Abigael-JT marked this pull request as ready for review January 30, 2025 10:59
@Abigael-JT
Abigael-JT requested a review from kortemik January 30, 2025 10:59
@elliVM

elliVM commented Feb 6, 2025

Copy link
Copy Markdown
Contributor

Found an issue in testing when NullNode was throwing an exception when cast to an ColumNode. Before this null value fix the null value would pass through as a null to visitLogicalStatementCatalyst() and return a NullStep, which would then result as empty dataset expected by the test.
To allow the NullNode pass through without exceptions added NullNode checks before casting in visitSearchTransformationRoot() which is not a pretty solution.

@elliVM
elliVM requested a review from 51-code February 6, 2025 10:37
@Abigael-JT Abigael-JT removed the review label Feb 6, 2025

@51-code 51-code left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good. I don't think there is a solution that can avoid instanceof calls for this.

@Abigael-JT
Abigael-JT requested a review from kortemik February 10, 2025 13:46
@Abigael-JT
Abigael-JT requested review from eemhu and removed request for kortemik April 1, 2025 13:21

@eemhu eemhu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be a good alternative to add isStub() or similar method to the Node interface, and NullNode would return true, otherwise false? This way it could be used instead of using instanceof checks?

@Abigael-JT

Copy link
Copy Markdown
Contributor Author

added isStub() method to Node interface and rebased

@Abigael-JT
Abigael-JT requested a review from eemhu April 15, 2025 11:30
@Abigael-JT

Copy link
Copy Markdown
Contributor Author

Rebased

@Abigael-JT

Copy link
Copy Markdown
Contributor Author

Rebased

Comment thread src/main/java/com/teragrep/pth_10/ast/bo/NullNode.java
@kortemik kortemik removed the review label Jan 26, 2026
@Abigael-JT
Abigael-JT requested a review from kortemik February 4, 2026 06:54
@kortemik kortemik added the review label Feb 4, 2026
@p000010u
p000010u dismissed kortemik’s stale review April 24, 2026 11:09

Seems to be resolved

@kortemik
kortemik removed their request for review April 24, 2026 12:27
final Node logicalNode = visit(ctx.logicalStatement(0));
if (directoryNode.isStub()) {
LOGGER.info("Directory statement node was a NullNode");
rv = directoryNode;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is stub set as return value?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if directoryNode is stub and logical node isn't wouldn't it make more sense to return the logical node and not the stub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Null pointer is passed to DPLParserCatalystVisitor in LogicalStatementCatalyst

6 participants