Recommending stack overflow posts for fixing runtime exceptions using failure scenario matching
Sonal Mahajan, Negarsadat Abolhassani, Mukul R. Prasad
Abstract
Using online Q&A forums, such as Stack Overflow (SO), for guidance to resolve program bugs, among other development issues, is commonplace in modern software development practice. Runtime exceptions (RE) is one such important class of bugs that is actively discussed on SO. In this work we present a technique and prototype tool called Maestro that can automatically recommend an SO post that is most relevant to a given Java RE in a developer's code. Maestro compares the exception-generating program scenario in the developer's code with that discussed in an SO post and returns the post with the closest match. To extract and compare the exception scenario effectively, Maestro first uses the answer code snippets in a post to implicate a subset of lines in the post's question code snippet as responsible for the exception and then compares these lines with the developer's code in terms of their respective Abstract Program Graph (APG) representations. The APG is a simplified and abstracted derivative of an abstract syntax tree, proposed in this work, that allows an effective comparison of the functionality embodied in the high-level program structure, while discarding many of the low-level syntactic or semantic differences. We evaluate Maestro on a benchmark of 78 instances of Java REs extracted from the top 500 Java projects on GitHub and show that Maestro can return either a highly relevant or somewhat relevant SO post corresponding to the exception instance in 71% of the cases, compared to relevant posts returned in only 8% -44% instances, by four competitor tools based on state-of-the-art techniques. We also conduct a user experience study of Maestro with 10 Java developers, where the participants judge Maestro reporting a highly relevant or somewhat relevant post in 80% of the instances. In some cases the post is judged to be even better than the one manually found by the participant.
• Software and its engineering → Software creation and management; Software verification and validation; Software defect analysis; Software testing and debugging;
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext b833861a-9fa1-40bb-a859-9f88b1cd4448Cited by top-tier papers6
- Answer Summarization for Technical Queries: Benchmark and New ApproachChengran Yang, Bowen Xu, Ferdian Thung, Yucen Shi et al.ASE 2022 · 12 citations
- LAURA: Enhancing Code Review Generation with Context-Enriched Retrieval-Augmented LLMYuxin Zhang, Yuxia Zhang, Zeyu Sun, Yanjie Jiang et al.ASE 2025 · 8 citations
- Software Entity Recognition with Noise-Robust LearningTai Nguyen, Yifeng Di, Joohan Lee, Muhao Chen et al.ASE 2023 · 2 citations
- Stack Overflow Meets Replication: Security Research Amid Evolving Code SnippetsAlfusainey Jallow, Sven BugielUSENIX Security 2025
- AdaptAgent: A Multi-agent, Domain-Guided Reasoning Framework for Code AdaptationXiaokai Rong, Hridya Dhulipala, Aashish Yadavally, Tien N. NguyenISSTA 2026
Related papers
- Automatic Solution Summarization for Crash BugsHaoye Wang, Xin Xia, David Lo, John C. Grundy et al.ICSE 2021 · 14 citations
- KG4CraSolver: Recommending Crash Solutions via Knowledge GraphXueying Du, Yiling Lou, Mingwei Liu, Xin Peng et al.FSE 2023 · 3 citations
- Code recommendation for exception handlingTam Nguyen, Phong Vu, Tung NguyenFSE 2020 · 22 citations
- API-Misuse Detection Driven by Fine-Grained API-Constraint Knowledge GraphXiaoxue Ren, Xinyuan Ye, Zhenchang Xing, Xin Xia et al.ASE 2020 · 62 citations
- Programming Assistant for Exception Handling with CodeBERTYuchen Cai, Aashish Yadavally, Abhishek Mishra, Genesis Montejo et al.ICSE 2024 · 4 citations
