Abstract
Many have argued that the current try/catch mechanism for handling exceptions in Java is flawed. A major complaint is that programmers often write minimal and low quality handlers. We used the Boa tool to examine a large number of Java projects on GitHub to provide empirical evidence about how programmers currently deal with exceptions. We found that programmers handle exceptions locally in catch blocks much of the time, rather than propagating by throwing an Exception. Programmers make heavy use of actions like Log, Print, Return, or Throw in catch blocks, and also frequently copy code between handlers. We found bad practices like empty catch blocks or catching Exception are indeed widespread. We discuss evidence that programmers may misjudge risk when catching Exception, and face a tension between handlers that directly address local program statement failure and handlers that consider the program-wide implications of an exception. Some of these issues might be addressed by future tools which autocomplete more complete handlers.
Author supplied keywords
Cite
CITATION STYLE
Kery, M. B., Le Goues, C., & Myers, B. A. (2016). Examining programmer practices for locally handling exceptions. In Proceedings - 13th Working Conference on Mining Software Repositories, MSR 2016 (pp. 484–487). Association for Computing Machinery. https://doi.org/10.1145/2901739.2903497
Register to see more suggestions
Mendeley helps you to discover research relevant for your work.