Better Cocoon stack traces

Posted on Fri 19 August 2005
Cocoon stack traces are getting better and nicer. The latest version now includes an indication of what is the element pointed to by a location.

This led to a new layout of the default formatting stylesheet (of course you can -- and should -- plug your own in your application):



And this is reflected in the Java stacktrace also, which is the only thing available in the logs of a live application, where users really should not see the above page:
org.apache.cocoon.generation.JXTemplateGenerator$JXTException: Unterminated ${
at <jx:when> - file:/Users/sylvain/dev/apache.org/cocoon/branches/BRANCH_2_1_X/build/webapp/samples/blocks/forms/forms/dynamicrepeater_template.xml:52:54
at <map:serialize type="html"> - file:/Users/sylvain/dev/apache.org/cocoon/branches/BRANCH_2_1_X/build/webapp/samples/blocks/forms/sitemap.xmap:212:40
at <map:transform> - file:/Users/sylvain/dev/apache.org/cocoon/branches/BRANCH_2_1_X/build/webapp/samples/blocks/forms/sitemap.xmap:205:66
at <map:transform> - file:/Users/sylvain/dev/apache.org/cocoon/branches/BRANCH_2_1_X/build/webapp/samples/blocks/forms/sitemap.xmap:62:88
at <map:transform type="i18n"> - file:/Users/sylvain/dev/apache.org/cocoon/branches/BRANCH_2_1_X/build/webapp/samples/blocks/forms/sitemap.xmap:199:35
at <map:transform type="browser-update"> - file:/Users/sylvain/dev/apache.org/cocoon/branches/BRANCH_2_1_X/build/webapp/samples/blocks/forms/sitemap.xmap:198:46
at <map:generate type="jx"> - file:/Users/sylvain/dev/apache.org/cocoon/branches/BRANCH_2_1_X/build/webapp/samples/blocks/forms/sitemap.xmap:197:79
at resource://org/apache/cocoon/forms/flow/javascript/Form.js:180:-1
at file:/Users/sylvain/dev/apache.org/cocoon/branches/BRANCH_2_1_X/build/webapp/samples/blocks/forms/flow/forms_flow_example.js:92:-1
at <map:call> - file:/Users/sylvain/dev/apache.org/cocoon/branches/BRANCH_2_1_X/build/webapp/samples/blocks/forms/sitemap.xmap:162:37
at <map:mount> - file:/Users/sylvain/dev/apache.org/cocoon/branches/BRANCH_2_1_X/build/webapp/samples/blocks/sitemap.xmap:66:68
at <map:mount> - file:/Users/sylvain/dev/apache.org/cocoon/branches/BRANCH_2_1_X/build/webapp/samples/sitemap.xmap:183:65
at <map:mount> - file:/Users/sylvain/dev/apache.org/cocoon/branches/BRANCH_2_1_X/build/webapp/sitemap.xmap:855:66
at org.apache.cocoon.generation.JXTemplateGenerator$StartElement. (JXTemplateGenerator.java:1189)
at org.apache.cocoon.generation.JXTemplateGenerator$Parser.startElement(JXTemplateGenerator.java:2002)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
...etc...
An important improvement also is exception nesting: as soon as an exception is catched by the location-aware system, it is never wrapped again, but locations are added to the exceptions. This leads to shorter stacktraces, with no nesting at all in the case of all-Cocoon exceptions.

Next step will be the Lepido debugger, which will of course rely on this precious location information. But we need help for this, either in the form of developers or funding. Join the Lepido dev list or contact me if you're interested.



Anachronisms

Ocean, mountain and hopefully sun