The exception handling policy of a system comprises the set of design rules that specify its exception handling behavior (how exceptions should be handled and thrown). Such policy is usually undocumented and implicitly defined by the system architect. For this reason, developers may think that by just including catch-blocks in the code they can deal with exception conditions. This lack of information may turn the exception handling into a generalized "goto" mechanism making the program more complex and less reliable. This work proposes a domain-specific language called ECL (Exception Contract Language) to specify the exception handling policy and a runtime monitoring tool which dynamically checks this policy. The monitoring tool is implemented in the form of an aspect library, which can be added to any Java system without the need to change the application source code. We applied this approach to a large-scale web-based system and to a set of versions of the well-known JUnit framework. The results indicate that this approach can be used to express and to automatically check the exception handling policy of a system, and consequently support the development of more robust Java systems.
['Joilson Abrantes', 'Roberta Coelho']
Specifying and Dynamically Monitoring the Exception Handling Policy