Skip to main content
QUICK REVIEW

[Paper Review] Recommendation of Exception Handling Code in Mobile App Development

Tam The Nguyen, Phong Minh Vu|arXiv (Cornell University)|Aug 19, 2019
Software Engineering Research35 references4 citations
TL;DR

This paper proposes XRank and XHand, two novel techniques for recommending effective exception handling in mobile app development. XRank ranks likely exceptions to catch based on fuzzy set associations with method calls, while XHand recommends corrective method sequences using n-gram and classification models. Evaluated on 10M+ Android methods, XRank achieved 70% top-1 and 87% top-3 accuracy, and XHand reached 89% and 96% respectively, demonstrating high effectiveness in reducing exception-related bugs.

ABSTRACT

In modern programming languages, exception handling is an effective mechanism to avoid unexpected runtime errors. Thus, failing to catch and handle exceptions could lead to serious issues like system crashing, resource leaking, or negative end-user experiences. However, writing correct exception handling code is often challenging in mobile app development due to the fast-changing nature of API libraries for mobile apps and the insufficiency of their documentation and source code examples. Our prior study shows that in practice mobile app developers cause many exception-related bugs and still use bad exception handling practices (e.g. catch an exception and do nothing). To address such problems, in this paper, we introduce two novel techniques for recommending correct exception handling code. One technique, XRank, recommends code to catch an exception likely occurring in a code snippet. The other, XHand, recommends correction code for such an occurring exception. We have developed ExAssist, a code recommendation tool for exception handling using XRank and XHand. The empirical evaluation shows that our techniques are highly effective. For example, XRank has top-1 accuracy of 70% and top-3 accuracy of 87%. XHand's results are 89% and 96%, respectively.

Motivation & Objective

  • To address the challenge of incorrect or missing exception handling in mobile app development, which leads to crashes and resource leaks.
  • To reduce the burden on developers by automatically recommending appropriate exception types and corrective actions.
  • To improve the reliability and stability of Android applications through automated, context-aware exception handling recommendations.
  • To overcome limitations in API documentation and rapid framework evolution that hinder proper exception handling.
  • To develop a practical, integrated tool (ExAssist) usable in popular IDEs like Android Studio and IntelliJ IDEA.

Proposed method

  • XRank uses fuzzy set theory to model associations between method calls in try blocks and potential exception types, ranking likely exceptions for catching.
  • XHand applies statistical language modeling—specifically n-gram and multi-class classification models—to predict sequences of method calls for handling exceptions.
  • The system treats exception handling code as a natural language problem, where missing methods in catch blocks are predicted like missing words in a sentence.
  • ExAssist integrates XRank and XHand into a plugin for Android Studio and IntelliJ IDEA, offering real-time code recommendations.
  • Training data is derived from over 10 million methods across 4,000 Android apps, capturing real-world exception handling patterns.
  • The approach leverages code structure and historical usage patterns to infer correct exception handling practices.

Experimental results

Research questions

  • RQ1How accurately can a system recommend the correct exception types to catch for a given code snippet in mobile apps?
  • RQ2What is the effectiveness of recommending corrective method sequences within catch blocks to restore object state after exceptions?
  • RQ3Can a tool trained on real-world Android code improve developer productivity and reduce exception-related bugs?
  • RQ4How does the proposed approach compare to baseline methods in recommending actual fixes for exception-related bugs?
  • RQ5To what extent do developers' actual exception handling fixes align with the recommendations generated by the system?

Key findings

  • XRank achieved a top-1 accuracy of 70% and top-3 accuracy of 87% in recommending appropriate exception types for code snippets.
  • XHand demonstrated 89% top-1 accuracy and 96% top-3 accuracy in recommending corrective method sequences for exception handling.
  • ExAssist successfully matched or contained the actual fix in 64% of 42 exception-related bug fixes, significantly outperforming the baseline, which matched only 14% of fixes.
  • The study confirms that many developers fail to handle exceptions properly, with 16% of fixes leaving exceptions uncaught and 42% adding only partial repairs.
  • The results validate that automated, context-aware recommendation of exception handling can significantly improve code quality and reduce crash risks in mobile applications.
  • The high accuracy of XRank and XHand indicates that exception handling patterns are predictable and learnable from large-scale code repositories.

Better researchstarts right now

From reading papers to final review, dramatically reduce your research time.

No credit card · Free plan available

This review was created by AI and reviewed by human editors.