Debugging

During the development of a Cúram client application, Apache Tomcat can be used within the Eclipse IDE to start and test the application. Renderer plug-in classes run in the context of the client application server and debugger breakpoints placed into the renderer plug-in class can be used to inspect the operation of the plug-in at run-time. When a breakpoint is not reached when expected, the problem may be with the debugging configuration of the IDE or with the configuration of the renderer. Add tracing code to the renderer to determine which problem exists. If the trace messages are displayed in the log, then the configuration is correct and the problem is with the configuration of the debugger. The configuration of the debugger is beyond the scope of this guide.

Trace messages can be written to the client application log easily from a renderer plug-in class. Simply print the messages to standard output or standard error using, for example, System.out.println. When running Tomcat from within the Eclipse IDE, the messages will appear in the console view of Tomcat process. Once the trace messages have been used to successfully diagnose and resolve a problem, they can be removed or commented out.

Much of the debugging effort of a complex widget lies not in the Java code of the renderer plug-in class, but in the JavaScript code or the CSS stylesheets. Issues in these areas can only be debugged within the browser. One effective approach to investigate such problems is to use the Mozilla Firefox1web browser with the Firebug2add-on. Firebug provides a host of tools for analyzing styling and layout, debugging JavaScript code, inspecting the DOM document, monitoring network activity and more. Firebug also allows changes to be made to the HTML page and the CSS style rules in real time, reducing the time it takes to test experimental changes. Beware, however, that Firefox may not render the content in the same manner as other browsers, such as Microsoft Internet Explorer. If Internet Explorer is the browser for which support is required, check regularly that changes that correct the presentation and operation of the widget in Firefox also work in Internet Explorer.

1 See the Mozilla web site for details.
2 See the Firebug web site for details.