Closed codemonstur closed 3 years ago
I setup some more testcases for the static PUG4J API and resolved some issues with file path handling. Please try 2.0.0-alpha4
Yes it now loads the extends file. I did notice however that when I call Pug4J.render(fullPath, new HashMap<>());
with a path that doesn't exist I get an NPE:
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "de.neuland.pug4j.template.TemplateLoader.getReader(String)" because "this.templateLoader" is null
at de.neuland.pug4j.exceptions.PugException.getTemplateLines(PugException.java:92)
at de.neuland.pug4j.exceptions.PugException.createErrorMessage(PugException.java:58)
at de.neuland.pug4j.exceptions.PugException.toString(PugException.java:106)
at java.base/java.lang.String.valueOf(String.java:3367)
at java.base/java.io.PrintStream.println(PrintStream.java:1047)
at java.base/java.lang.Throwable$WrappedPrintStream.println(Throwable.java:764)
at java.base/java.lang.Throwable.printStackTrace(Throwable.java:671)
at java.base/java.lang.Throwable.printStackTrace(Throwable.java:660)
at java.base/java.lang.Throwable.printStackTrace(Throwable.java:651)
at pug.Main.main(Main.java:23)
Please check alpha-5. There should be a FileNotFoundException now.
Yes it throws a FileNotFoundException now. Great!
When using this code:
And referring to this path using extends:
../include/skeleton.pug
. I get this error on debian (running in windows):Full code example can be found here: https://github.com/codemonstur/pug4j-bug Problem does not occur with Jade4J.