Where to Handle an Exception? Recommending Exception Handling Locations from a Global Perspective
Authors:
- 1 May 2021
- conference paper
- Published by Institute of Electrical and Electronics Engineers (IEEE)
- p. 369-380
Abstract
Exception handling is an effective mechanism to guarantee software reliability in modern programming languages. An exception interrupts the program execution and propagates backwards along the call chain until the exception is caught by an exception handler. In software development practices, developers may be confused in determining where to place the exception handler in the call chain. The reason is that exception handling requires a developer to take a comprehensive consideration from a global perspective of the software project. In this paper, we propose an automatic approach EHAdvisor, which recommends exception handling locations from the global perspective of the project. EHAdvisor first trains a binary classification model based on four types of features, including architectural features, project features, functional features, and exception features. Then, for a new code snippet with exceptions, EHAdvisor predicts the exception catching probability for each method in the call chain based on the classification model and recommends Top-K exception handling locations based on the probability ranking. We conducted experiments on a dataset from 29 high-quality open source projects. Experimental results show that EHAdvisor achieves an average Top-1 recommendation success rate of 70.83% for across-project location recommendation and an average Top-1 accuracy of 86.21% for intra-project recommendation. Experiments on the importance scores show that global features, such as project features and architectural features, are evidently important to the recommendation of exception handling locations.Keywords
Funding Information
- National Natural Science Foundation of China
This publication has 35 references indexed in Scilit:
- Can this fault be detected: A study on fault detection via automated test generationJournal of Systems and Software, 2020
- Does the fault reside in a stack trace? Assisting crash localization by predicting crashing fault residenceJournal of Systems and Software, 2019
- Do android developers neglect error handling? a maintenance-Centric study on the relationship between android abstractions and uncaught exceptionsJournal of Systems and Software, 2018
- Preventing Erosion in Exception Handling Design Using Static-Architecture Conformance Checking2017
- A review on exception analysisInformation and Software Technology, 2016
- Exception handling bug hazards in AndroidEmpirical Software Engineering, 2016
- An exploratory study on exception handling bugs in Java programsJournal of Systems and Software, 2015
- Exception Handling: A Field Study in Java and .NET2007
- What is a support vector machine?Nature Biotechnology, 2006
- Random Forest: A Classification and Regression Tool for Compound Classification and QSAR ModelingJournal of Chemical Information and Computer Sciences, 2003