[
https://issues.apache.org/jira/browse/CLK-495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12693454#action_12693454
]
Bob Schellink commented on CLK-495:
-----------------------------------
I see two ways why the exception could be swallowed:
1. A different component could have swallowed the trace. However none of the
above mentioned components looks like they do anything untoward.
2. An Error was thrown instead of an Exception. In that case
VelocityTemplateService#renderTemplate would not have caught the Error because
it only caters for Exceptions.
I doubt 2 is the issue here though because Tomcat would have printer that Error
in the logs. On this topic, I've noticed that if an Error occurs Click will
simply display a blank screen instead of printing the stackTrace. Wonder if we
should enhance the ErrorReporting to print Error strack traces as well?
> 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.