scalasti icon indicating copy to clipboard operation
scalasti copied to clipboard

Empty, notDefined attributes produces an exception

Open ASchmidt84 opened this issue 8 years ago • 0 comments

Hi, I am using your wrapper and found a behavior that is strange to me. If I have an attribute in my template like $data$ or $data.name$ and I will not add this to ST with add I will get an exception like this:

Failure(java.lang.Exception: context [anonymous] 19:1 internal error: java.lang.Exception: context [anonymous] 19:1 attribute grussFormel isn't defined
	at org.clapper.scalasti.ThrowExceptionErrorListener.runTimeError(ThrowExceptionErrorListener.scala:14)
	at org.stringtemplate.v4.misc.ErrorManager.runTimeError(ErrorManager.java:133)
	at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:193)
	at org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145)
	at org.stringtemplate.v4.ST.write(ST.java:427)
	at org.stringtemplate.v4.ST.render(ST.java:497)
	at org.clapper.scalasti.ST.$anonfun$render$1(ST.scala:310)
	at scala.util.Try$.apply(Try.scala:209)
	at org.clapper.scalasti.ST.render(ST.scala:310)
	at AntlrTest.$anonfun$new$1(AntlrTest.scala:58)
	at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85)
	at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83)
	at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
	at org.scalatest.Transformer.apply(Transformer.scala:22)
	at org.scalatest.Transformer.apply(Transformer.scala:20)
	at org.scalatest.FlatSpecLike$$anon$1.apply(FlatSpecLike.scala:1682)
	at org.scalatest.TestSuite.withFixture(TestSuite.scala:196)
	at org.scalatest.TestSuite.withFixture$(TestSuite.scala:195)
	at org.scalatest.FlatSpec.withFixture(FlatSpec.scala:1685)
	at org.scalatest.FlatSpecLike.invokeWithFixture$1(FlatSpecLike.scala:1680)
	at org.scalatest.FlatSpecLike.$anonfun$runTest$1(FlatSpecLike.scala:1692)
	at org.scalatest.SuperEngine.runTestImpl(Engine.scala:289)
	at org.scalatest.FlatSpecLike.runTest(FlatSpecLike.scala:1692)
	at org.scalatest.FlatSpecLike.runTest$(FlatSpecLike.scala:1674)
	at org.scalatest.FlatSpec.runTest(FlatSpec.scala:1685)
	at org.scalatest.FlatSpecLike.$anonfun$runTests$1(FlatSpecLike.scala:1750)
	at org.scalatest.SuperEngine.$anonfun$runTestsInBranch$1(Engine.scala:396)
	at scala.collection.immutable.List.foreach(List.scala:378)
	at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:384)
	at org.scalatest.SuperEngine.runTestsInBranch(Engine.scala:373)
	at org.scalatest.SuperEngine.$anonfun$runTestsInBranch$1(Engine.scala:410)
	at scala.collection.immutable.List.foreach(List.scala:378)
	at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:384)
	at org.scalatest.SuperEngine.runTestsInBranch(Engine.scala:379)
	at org.scalatest.SuperEngine.runTestsImpl(Engine.scala:461)
	at org.scalatest.FlatSpecLike.runTests(FlatSpecLike.scala:1750)
	at org.scalatest.FlatSpecLike.runTests$(FlatSpecLike.scala:1749)
	at org.scalatest.FlatSpec.runTests(FlatSpec.scala:1685)
	at org.scalatest.Suite.run(Suite.scala:1147)
	at org.scalatest.Suite.run$(Suite.scala:1129)
	at org.scalatest.FlatSpec.org$scalatest$FlatSpecLike$$super$run(FlatSpec.scala:1685)
	at org.scalatest.FlatSpecLike.$anonfun$run$1(FlatSpecLike.scala:1795)
	at org.scalatest.SuperEngine.runImpl(Engine.scala:521)
	at org.scalatest.FlatSpecLike.run(FlatSpecLike.scala:1795)
	at org.scalatest.FlatSpecLike.run$(FlatSpecLike.scala:1793)
	at org.scalatest.FlatSpec.run(FlatSpec.scala:1685)
	at org.scalatest.tools.SuiteRunner.run(SuiteRunner.scala:45)
	at org.scalatest.tools.Runner$.$anonfun$doRunRunRunDaDoRunRun$13(Runner.scala:1340)
	at org.scalatest.tools.Runner$.$anonfun$doRunRunRunDaDoRunRun$13$adapted(Runner.scala:1334)
	at scala.collection.immutable.List.foreach(List.scala:378)
	at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1334)
	at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24(Runner.scala:1031)
	at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24$adapted(Runner.scala:1010)
	at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:1500)
	at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1010)
	at org.scalatest.tools.Runner$.run(Runner.scala:850)
	at org.scalatest.tools.Runner.run(Runner.scala)
	at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:138)
	at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:28)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
)

But I understand the normal behavior of StringTemplate to set it to an empty String. Am I wrong with this meaning?

ASchmidt84 avatar Mar 28 '17 07:03 ASchmidt84