dgroup/laconic-velocity

NullPointerException in case when template is not found

tess1o opened this issue · 0 comments

In case when template is not found the library throws NPE. A better exception with valid message is expected.

2022-01-27 12:47:30 [https-jsse-nio-8433-exec-2] ERROR org.apache.juli.logging.DirectJDKLog.log 175 - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: com.github.dgroup.velocity.template.TemplateException: com.github.dgroup.velocity.template.TemplateException: java.lang.NullPointerException] with root cause
java.lang.NullPointerException: null
	at java.io.Reader.<init>(Reader.java:78)
	at java.io.InputStreamReader.<init>(InputStreamReader.java:113)
	at org.cactoos.text.TextOf.<init>(TextOf.java:352)
	at com.github.dgroup.velocity.template.TemplateEnvelope.lambda$new$0(TemplateEnvelope.java:71)
	at com.github.dgroup.velocity.template.TemplateEnvelope.compose(TemplateEnvelope.java:122)
	at com.github.dgroup.velocity.template.TemplateEnvelope.compose(TemplateEnvelope.java:105)
	at com.github.dgroup.velocity.template.TemplateEnvelope.compose(TemplateEnvelope.java:99)
	at com.github.dgroup.velocity.template.TemplateEnvelope.compose(TemplateEnvelope.java:47)