NPE when calling renderTemplate 2 times
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
play framework |
Confirmed
|
Undecided
|
Guillaume Bort | ||
1.0 |
Won't Fix
|
Undecided
|
Guillaume Bort | ||
1.1 |
Confirmed
|
Undecided
|
Guillaume Bort |
Bug Description
The PDF module use the renderTemplate method to render the template prior to transform it into a PDF that it then save on disk. Note that it can really well be the same problem with rendering one or two emails.
Once this is done I am rendering an HTML template so the user can see some HTML to download the file for example.
However, it seems that the template compiler has a state. I have a NPE. In order to fix the NPE, I had to remove the out argument from the renderArgs.data:
renderArgs.
In the code that renders the template (Template.render), I can indeed see:
if (!args.
writer = new StringWriter();
}
It seems that out is still there but already closed I think. Removing the
if (!args.
solves the problem and the tests pass. However, I was wondering for what reason the if line was there.
Maybe this is somehow related to #554762 ?