Write a Blog >>

With the support of exception handling mechanisms, when an error occurs, its corresponding typed exception can be thrown. The thrown exception can be caught, if the type of the thrown exception matches the type of the expected exceptions. If the thrown exception is caught, the handling code will resolve the error (e.g., closing resources). Although this mechanism is critical for resolving runtime errors, bugs inside this process can have far-reaching impacts. Therefore, researchers have proposed various approaches to assist catching and handling such thrown exceptions and detect corresponding bugs (e.g., resource leaks). If the thrown exceptions themselves are incorrect, their errors will never be correctly caught and handled. In practice, such thrown exceptions have caused real critical bugs. However, to the best of our knowledge, no approach has been proposed to recommend which exceptions shall be thrown. Exceptions are widely adopted in programs, often poorly documented, and sometimes ambiguous, making the rules of throwing correct exceptions rather complicated. A project team can leverage exceptions in a way totally different from other teams. As a result, experienced programmers can have difficulties in determining which exception shall be thrown, even if its surrounding code is already written. In this paper, we propose the first approach, ThEx, to predict which exception(s) shall be thrown under a given programming context. The basic idea is to learn a classification model from existing thrown exceptions in different contexts. Here, the learning features are extracted from various code information surrounding the thrown exceptions, such as the thrown locations and related variable names. Then, given a new context, ThEx can automatically predict its best exception(s). We have evaluated ThEx on 12,012 thrown exceptions that were collected from nine popular open-source projects. Our results show that it can achieve high f-scores and mcc values (both around 0.8). On this benchmark, we also evaluated the impacts of our underlying technical details. Furthermore, we evaluated our approach in the wild, and used ThEx to detect anomalies from the latest versions of the nine projects. In this way, we found 20 anomalies, and reported them as bugs to their issue trackers. Among them, 18 were confirmed, and 13 have already been fixed.

I received my Ph.D degree from Peking University in 2009. My Ph.D dissertation was nominated for the distinguished Ph.D dissertation award of China Computer Federation. After graduation, I joined Institute of Software, Chinese Academy of Sciences as an assistant professor, and was promoted as an associated professor in 2011. From 2012 to 2014, I was a visiting scholar with University of California, Davis. In 2014, I joined Shanghai Jiao Tong University. I am a recipient of ACM SIGSOFT Distinguished Paper Award, the best paper award of ASE, and the best paper award of APSEC.

Thu 13 Oct

Displayed time zone: Eastern Time (US & Canada) change

10:00 - 12:00
Technical Session 22 - Code Summarization and RecommendationResearch Papers / NIER Track / Journal-first Papers / Industry Showcase at Banquet A
Chair(s): Houari Sahraoui Université de Montréal
10:00
20m
Research paper
Identifying Solidity Smart Contract API Documentation Errors
Research Papers
Chenguang Zhu The University of Texas at Austin, Ye Liu Nanyang Technological University, Xiuheng Wu Nanyang Technological University, Singapore, Yi Li Nanyang Technological University
Pre-print
10:20
10m
Vision and Emerging Results
Few-shot training LLMs for project-specific code-summarization
NIER Track
Toufique Ahmed University of California at Davis, Prem Devanbu Department of Computer Science, University of California, Davis
DOI Pre-print
10:30
20m
Research paper
Answer Summarization for Technical Queries: Benchmark and New Approach
Research Papers
Chengran Yang Singapore Management University, Bowen Xu School of Information Systems, Singapore Management University, Ferdian Thung Singapore Management University, Yucen Shi Singapore Management University, Ting Zhang Singapore Management University, Zhou Yang Singapore Management University, Xin Zhou , Jieke Shi Singapore Management University, Junda He Singapore Management University, DongGyun Han Royal Holloway, University of London, David Lo Singapore Management University
10:50
20m
Paper
Code Structure Guided Transformer for Source Code SummarizationVirtual
Journal-first Papers
Shuzheng Gao Harbin Institute of Technology, Cuiyun Gao Harbin Institute of Technology, Yulan He University of Warwick, Jichuan Zeng The Chinese University of Hong Kong, Lun Yiu Nie Tsinghua University, Xin Xia Huawei Software Engineering Application Technology Lab, Michael Lyu The Chinese University of Hong Kong
11:10
10m
Vision and Emerging Results
Taming Multi-Output Recommenders for Software EngineeringVirtual
NIER Track
Christoph Treude University of Melbourne
11:20
20m
Industry talk
MV-HAN: A Hybrid Attentive Networks based Multi-View Learning Model for Large-scale Contents RecommendationVirtual
Industry Showcase
Ge Fan Tencent Inc., Chaoyun Zhang Tencent Inc., Kai Wang Tencent Inc., Junyang Chen Shenzhen University
DOI Pre-print
11:40
20m
Research paper
Which Exception Shall We Throw?Virtual
Research Papers
Hao Zhong Shanghai Jiao Tong University