[ 
https://issues.apache.org/jira/browse/CLK-495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12693544#action_12693544
 ] 

Bob Schellink commented on CLK-495:
-----------------------------------

Sorry I don't mean VelocityTemplateService should print the stack trace to the 
log but rather to catch the Error and create an ErrorReport which write the 
Error to the browser (stackTrace can also been seen in trace mode).

Currently, because we don't handle the Error, the user could be presented with 
a blank screen.



> Column decorator error handling improvements
> --------------------------------------------
>
>                 Key: CLK-495
>                 URL: https://issues.apache.org/jira/browse/CLK-495
>             Project: Click
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.5
>         Environment: Click 1.5
>            Reporter: Malcolm Edgar
>             Fix For: 2.1.0
>
>
> I often use decorators for rendering table columns. However if I make a 
> mistake in the Decorator code (typically a NPE) the source of error is eaten 
> by Velocity, which is generally rendering the $table in the page.
> It would be an improvement if the Column#renderTableDataContent() method 
> caught the error logged it and re-throw it:
>         if (getDecorator() != null) {
>               try {
>                   Object value = getDecorator().render(row, context);
>                   if (value != null) {
>                       buffer.append(value);
>                   }
>               } catch (RuntimeException ioe) {
>                       ioe.printStackTrace();
>                       throw ioe;
>               }
> If you make an decorator error you will get a very long, but ultimately 
> useful error message. For example:
> 14:02:44,760 INFO  [STDOUT] java.lang.NullPointerException
> 14:02:44,760 INFO  [STDOUT]   at java.lang.String.endsWith(String.java:1296)
> 14:02:44,760 INFO  [STDOUT]   at 
> com.avoka.fc.admin.panel.submission.SubmissionAttachmentPanel$3.render(SubmissionAttachmentPanel.java:104)
> 14:02:44,760 INFO  [STDOUT]   at 
> net.sf.click.control.Column.renderTableDataContent(Column.java:1347)
> 14:02:44,760 INFO  [STDOUT]   at 
> net.sf.click.control.Column.renderTableData(Column.java:1186)
> 14:02:44,760 INFO  [STDOUT]   at 
> net.sf.click.control.Table.renderBodyRowColumns(Table.java:1523)
> 14:02:44,760 INFO  [STDOUT]   at 
> com.avoka.fc.admin.click.control.SimpleTable.renderBodyRows(SimpleTable.java:160)
> 14:02:44,761 INFO  [STDOUT]   at 
> com.avoka.fc.admin.click.control.SimpleTable.render(SimpleTable.java:89)
> 14:02:44,761 INFO  [STDOUT]   at 
> net.sf.click.control.AbstractControl.toString(AbstractControl.java:806)
> 14:02:44,761 INFO  [STDOUT]   at 
> org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:336)
> 14:02:44,761 INFO  [STDOUT]   at 
> org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
> 14:02:44,761 INFO  [STDOUT]   at 
> org.apache.velocity.Template.merge(Template.java:254)
> 14:02:44,761 INFO  [STDOUT]   at 
> net.sf.click.service.VelocityTemplateService.renderTemplate(VelocityTemplateService.java:391)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to