antlr / antlr/stringtemplate4

null pointer exception if template name doesn't match st file name

Open
#109 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

I know that the template definition needs to match the filename but it seems to me that if it doesn't there should be a nicer error that goes through the error listener and not a NPE.

With the 4.0.8 jar when the filename is "things_ab.st" and it contains
things(...) ::= << ...
I get a null pointer exception when I call group.getInstanceOf(templateName);

```
at org.stringtemplate.v4.STGroup.loadTemplateFile(STGroup.java:656)
at org.stringtemplate.v4.STGroupDir.loadTemplateFile(STGroupDir.java:176)
at org.stringtemplate.v4.STGroupDir.load(STGroupDir.java:136)
at org.stringtemplate.v4.STGroup.lookupTemplate(STGroup.java:230)
at org.stringtemplate.v4.STGroup.getInstanceOf(STGroup.java:165)
```

Thanks,
-John

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.