Back to overview

On the Evolution of Exception Usage in Java Projects

Type of publication Peer-reviewed
Publikationsform Proceedings (peer-reviewed)
Author Osman Haidar, Chiçs Andrei, Schaerer Jakob, Ghafari Mohammad, Nierstrasz Oscar,
Project Agile Software Analysis
Show all

Proceedings (peer-reviewed)

Page(s) 422 - 426
Title of proceedings Proceedings of the 24rd IEEE International Conference on Software Analysis, Evolution, and Reengineering (SANER)
DOI 10.1109/saner.2017.7884646

Open Access


Programming languages use exceptions to handle abnormal situations during the execution of a program. While programming languages often provide a set of standard exceptions, developers can further create custom exceptions to capture relevant data about project- and domain-specific errors. We hypothesize that, given their usefulness, custom exceptions are used increasingly as software systems mature. To assess this claim, we empirically analyze the evolution of exceptions and exception-handling code within four, popular and long-lived Java systems. We observe that indeed the amount of error-handling code, together with the number of custom exceptions and their usage in catch handlers and throw statements increase as projects evolve. However, we find that the usage of standard exceptions increases more than the usage of custom exceptions in both catch handlers and throw statements. A preliminary manual analysis of throw statements reveals that developers encode the domain information into the standard Java exceptions as custom string error messages instead of relying on custom exception classes.