Where to Handle an Exception? Recommending Exception Handling Locations from a Global Perspective

被引:2
作者
Jia, Xiangyang [1 ]
Chen, Songqiang [1 ]
Zhou, Xingqi [1 ]
Li, Xintong [1 ]
Yu, Run [2 ]
Chen, Xu [1 ]
Xuan, Jifeng [1 ]
机构
[1] Wuhan Univ, Sch Comp Sci, Wuhan, Hubei, Peoples R China
[2] NYU, Tandon Sch Engn, New York, NY 10003 USA
来源
2021 IEEE/ACM 29TH INTERNATIONAL CONFERENCE ON PROGRAM COMPREHENSION (ICPC 2021) | 2021年
基金
中国国家自然科学基金; 国家重点研发计划;
关键词
exception handling; location recommendation; machine learning; global features; classification algorithm; !text type='JAVA']JAVA[!/text; SUPPORT;
D O I
10.1109/ICPC52881.2021.00042
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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.
引用
收藏
页码:369 / 380
页数:12
相关论文
共 46 条
  • [1] Asaduzzaman M, 2016, 13TH WORKING CONFERENCE ON MINING SOFTWARE REPOSITORIES (MSR 2016), P516, DOI [10.1145/2901739.2903500, 10.1109/MSR.2016.068]
  • [2] Barbosa E. A., 2012, 2012 26th Brazilian Symposium on Software Engineering (SBES), P171, DOI 10.1109/SBES.2012.22
  • [3] Global-Aware Recommendations for Repairing Violations in Exception Handling
    Barbosa, Eiji Adachi
    Garcia, Alessandro
    [J]. IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 2018, 44 (09) : 855 - 873
  • [4] Cabral B, 2007, LECT NOTES COMPUT SC, V4609, P151
  • [5] Trading Robustness for Maintainability: An Empirical Study of Evolving C# Programs
    Cacho, Nelio
    Cesar, Thiago
    Filipe, Thomas
    Soares, Eliezio
    Cassio, Arthur
    Souza, Rafael
    Garcia, Israel
    Barbosa, Eiji Adachi
    Garcia, Alessandro
    [J]. 36TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING (ICSE 2014), 2014, : 584 - 595
  • [6] How Does Exception Handling Behavior Evolve? An Exploratory Study in Java']Java and C# Applications
    Cacho, Nelio
    Barbosa, Eiji Adachi
    Araujo, Juliana
    Pranto, Frederico
    Garcia, Alessandro
    Cesar, Thiago
    Soares, Eliezio
    Cassio, Arthur
    Filipe, Thomas
    Garcia, Israel
    [J]. 2014 IEEE INTERNATIONAL CONFERENCE ON SOFTWARE MAINTENANCE AND EVOLUTION (ICSME), 2014, : 31 - 40
  • [7] Visualization of exception propagation for Java']Java using static analysis
    Chang, BM
    Jo, JW
    Her, SH
    [J]. SCAM 2002: SECOND IEEE INTERNATIONAL WORKSHOP ON SOURCE CODE ANALYSIS MANIPULATION, PROCEEDINGS, 2002, : 173 - 182
  • [8] A review on exception analysis
    Chang, Byeong-Mo
    Choi, Kwanghoon
    [J]. INFORMATION AND SOFTWARE TECHNOLOGY, 2016, 77 : 1 - 16
  • [9] Understanding Exception-Related Bugs in Large-Scale Cloud Systems
    Chen, Haicheng
    Dou, Wensheng
    Jiang, Yanyan
    Qin, Feng
    [J]. 34TH IEEE/ACM INTERNATIONAL CONFERENCE ON AUTOMATED SOFTWARE ENGINEERING (ASE 2019), 2019, : 339 - 351
  • [10] Coelho R, 2017, EMPIR SOFTW ENG, V22, P1264, DOI 10.1007/s10664-016-9443-7