click-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Malcolm Edgar (JIRA)" <j...@apache.org>
Subject [JIRA] Created: (CLK-495) Column decorator error handling improvements
Date Thu, 26 Feb 2009 03:09:56 GMT
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.


Mime
View raw message