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

NullPointerException in ST4 ErrorManager.compileTimeError #460

Open
steinybot opened this issue Apr 18, 2020 · 3 comments
Open

NullPointerException in ST4 ErrorManager.compileTimeError #460

steinybot opened this issue Apr 18, 2020 · 3 comments
Labels
Milestone

Comments

@steinybot
Copy link
Contributor

steinybot commented Apr 18, 2020

steps

sbt or Giter8 version: 0.12.1-SNAPSHOT

❯ /Users/jason/.conscript/bin/g8 BotTech/sbt-autoplugin.g8 -b bottech

sbt plugin seed

pluginName [Foo Bar]: Turtles
name [sbt-turtles]:
organizationName [BotTech]:
organization [nz.co.bottech]:
package [nz.co.bottech.sbt.turtles]:
purpose [An sbt plugin]: An sbt plugin for sharing settings between the meta-builds and the main build.
sbtVersion [1.3.10]:
scalaVersion [2.12.11]:
scalacticVersion [3.1.1]:
uTestVersion [0.7.4]:

problem

The root cause is a SYNTAX ERROR:

'" =~ 2.1[2]..* && "' came as a complete surprise to me

This is then causing a NPE to be thrown when ST4 tries to report the error.

stack trace
java.lang.NullPointerException
	at org.stringtemplate.v4.misc.ErrorManager.compileTimeError(ErrorManager.java:100)
	at org.stringtemplate.v4.compiler.Compiler.reportMessageAndThrowSTException(Compiler.java:205)
	at org.stringtemplate.v4.compiler.Compiler.compile(Compiler.java:149)
	at org.stringtemplate.v4.STGroup.compile(STGroup.java:514)
	at org.stringtemplate.v4.ST.<init>(ST.java:173)
	at giter8.G8$.applyTemplate(g8.scala:134)
	at giter8.G8$.write(g8.scala:185)
	at giter8.G8$.write(g8.scala:170)
	at giter8.G8$.$anonfun$writeTemplates$3(g8.scala:502)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at scala.util.control.Exception$Catch.$anonfun$opt$1(Exception.scala:246)
	at scala.util.control.Exception$Catch.apply(Exception.scala:228)
	at scala.util.control.Exception$Catch.opt(Exception.scala:246)
	at giter8.G8$.$anonfun$writeTemplates$2(g8.scala:502)
	at scala.collection.immutable.Stream.foreach(Stream.scala:533)
	at giter8.G8$.writeTemplates(g8.scala:488)
	at giter8.G8$.$anonfun$applyT$1(g8.scala:344)
	at scala.util.Either$RightProjection.flatMap(Either.scala:701)
	at giter8.G8$.applyT(g8.scala:327)
	at giter8.G8$.fromDirectory(g8.scala:76)
	at giter8.G8TemplateRenderer$.render(TemplateRenderer.scala:40)
	at giter8.AppProcessor.process(giter8.scala:58)
	at giter8.Runner.$anonfun$run$9(Runner.scala:51)
	at scala.util.Either.flatMap(Either.scala:341)
	at giter8.Runner.$anonfun$run$5(Runner.scala:48)
	at scala.util.Either.flatMap(Either.scala:341)
	at giter8.Runner.$anonfun$run$4(Runner.scala:47)
	at scala.util.Either.flatMap(Either.scala:341)
	at giter8.Runner.run(Runner.scala:46)
	at giter8.Giter8.run(giter8.scala:33)
	at giter8.Giter8.run(giter8.scala:30)
	at giter8.Giter8.run(giter8.scala:26)
	at giter8.Giter8.run(giter8.scala:22)
	at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
	at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
	at xsbt.boot.Launch$.run(Launch.scala:109)
	at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
	at xsbt.boot.Launch$.launch(Launch.scala:117)
	at xsbt.boot.Launch$.apply(Launch.scala:18)
	at xsbt.boot.Boot$.runImpl(Boot.scala:56)
	at xsbt.boot.Boot$.main(Boot.scala:18)
	at xsbt.boot.Boot.main(Boot.scala)

Unknown exception: null

expectation

notes

A guard was put in ST4 a long time ago but it was not put in all the right places: antlr/stringtemplate4@7bff6cf

@eed3si9n
Copy link
Member

Should we put our own NPE guard here?

@eed3si9n eed3si9n added the Bug label Apr 19, 2020
@eed3si9n eed3si9n added this to the 0.13.0 milestone Apr 19, 2020
@steinybot
Copy link
Contributor Author

That would be a good idea as a temporary measure. See #461.

@TonioGela
Copy link
Member

TonioGela commented Jun 7, 2021

@steinybot, how do you think we can proceed? The workaround works, and the PR on ST4 was merged. Can we close it, or is it something else to do?
Plus ST4 4.3.1 was released and it was added to giter8 here so technically your fix should now be included.

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

Successfully merging a pull request may close this issue.

3 participants