[ 
https://issues.apache.org/jira/browse/FREEMARKER-78?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16187888#comment-16187888
 ] 

Daniel Dekany commented on FREEMARKER-78:
-----------------------------------------

It could be an option. As of doing this by default, especially in FM2, that 
strikes me as too dangerous. You don't know how much resources {{toString}} 
will consume (I know it shouldn't consume much, but the things behind templates 
aren't always written by good developers). Also, at least when the 
{{TemplateExceptionHandler}} is left on its FM2 default, it's a security 
concern (you might dump much more internal information to the user's screen 
than with just printing a a few class names).

If there was a common convention to detect if you are running in production 
mode or on a developer machine, that would make these much easier... I wonder 
if FM should have a such configuration option instead of one specifically to 
address this.

> Let InvalidReferenceException contain x.toString() of x.missing
> ---------------------------------------------------------------
>
>                 Key: FREEMARKER-78
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-78
>             Project: Apache Freemarker
>          Issue Type: Improvement
>          Components: engine
>    Affects Versions: 2.3.26-incubating
>            Reporter: Ondra Žižka
>            Priority: Minor
>
> It would be quite useful if the following contained {{techTag.toString()}}:
> {quote}
> FreeMarker template error (DEBUG mode; use RETHROW in production!):
> The following has evaluated to null or missing:
> ==> techTag.title  [in template "reports/templates/techReport-boxes.ftl" at 
> line 133, column 59]
> Java stack trace (for programmers):
> ----
> freemarker.core.InvalidReferenceException: [... Exception message was already 
> printed; see it above ...]
>       at 
> freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134)
>       at 
> freemarker.core.EvalUtil.coerceModelToTextualCommon(EvalUtil.java:465)
> {quote}
> Now as it doesn't, I need to write a logging line, rebuild the project, and 
> run again. Or debug. Neither is quick :) So this would save quite some time 
> in development cycle.
> Thanks for considering.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to