Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE when referencing undefined fragment #96

Open
bannmann opened this issue Dec 1, 2021 · 1 comment
Open

NPE when referencing undefined fragment #96

bannmann opened this issue Dec 1, 2021 · 1 comment

Comments

@bannmann
Copy link
Contributor

bannmann commented Dec 1, 2021

Referencing a fragment that is not defined (e.g. due to a typo) causes the following NPE:

java.lang.NullPointerException
    at silverchain.parser.adapter.ASTBuilder.visitFragmentReference (ASTBuilder.java:454)
    at silverchain.parser.adapter.ASTBuilder.visitRuleAtom (ASTBuilder.java:214)
    at silverchain.parser.adapter.ASTBuilder.visitRuleElement (ASTBuilder.java:199)
    at silverchain.parser.adapter.ASTBuilder.visitRuleFactor (ASTBuilder.java:188)
    at silverchain.parser.adapter.ASTBuilder.visitRuleTerm (ASTBuilder.java:178)

Silverchain should produce a readable error message in this case, e.g. "$FOO is not defined at #L1C2".

@bannmann
Copy link
Contributor Author

bannmann commented Dec 1, 2021

Note: the stack trace was produced by a 0fab283 build of Silverchain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant