[ 
http://issues.apache.org/click/browse/CLK-495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11729#action_11729
 ] 

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

Was looking at porting the change to trunk but with the new error handling 
inside #renderTableDataContent(), I see two duplicate stack traces in the log:

[Click] [error] org.apache.click.examples.page.table.TableDecorator: 
java.lang.NullPointerExceptionjava.lang.NullPointerException
        at 
org.apache.click.examples.page.table.TableDecorator$1.render(TableDecorator.java:59)
        at 
org.apache.click.control.Column.renderTableDataContent(Column.java:1350)
.....

[Click] [error] handleException: java.lang.NullPointerException
        at 
org.apache.click.examples.page.table.TableDecorator$1.render(TableDecorator.java:59)
        at 
org.apache.click.control.Column.renderTableDataContent(Column.java:1350)


The output is printed in both "trace" and "production" mode. Not sure what is 
gained by this change.

> Column decorator error handling improvements
> --------------------------------------------
>
>                 Key: CLK-495
>                 URL: http://issues.apache.org/click/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