arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 1708.00817cs.SEcs.PL
收藏

用异常流分析重新审视异常处理实践

Revisiting Exception Handling Practices with Exception Flow Analysis

Guilherme B. de Pádua, Weiyi Shang

摘要:

现代程序设计语言,如Java和C#,通常提供处理异常的功能。这些功能将错误处理代码与常规源代码分开,旨在帮助软件理解和维护的实践。尽管已经认识到异常处理功能的优点,但它们的滥用仍然会导致可靠性下降,甚至是灾难性的软件故障。以往对异常处理的研究主要是从不同的角度来理解异常处理的实践,如异常的来源和异常的处理代码。然而,观察到的结果是分散和多样化的。在本文中,以补充以前的研究成果异常处理,我们研究其特点,丰富了处理代码的知识与异常流分析。我们的案例研究使用了来自16个开源Java和C#(.NET)库和应用程序的超过10K的异常处理块和超过77K的相关异常流。我们的案例研究结果表明,每个try块有多达12个可能的潜在可恢复但传播的异常。更重要的是,22%的不同的可能异常可以追溯到多个方法(平均值为1.39,最大值为34)。这样的结果突出了编写高质量异常处理代码的额外挑战。更糟糕的是,我们确认缺乏关于可能的例外及其来源的文件。然而,这样的关键信息可以通过对记录良好的API调用的异常流分析来识别(例如,JRE和.NET文档)。最后,我们观察了Java和C#之间异常处理代码的不同策略。我们的研究结果强调了利用自动化软件分析来协助异常处理实践的机会,并表明需要对异常处理实践进行更深入的研究。

英文摘要:

Modern programming languages, such as Java and C#, typically provide features that handle exceptions. These features separate error-handling code from regular source code and aim to assist in the practice of software comprehension and maintenance. Having acknowledged the advantages of exception handling features, their misuse can still cause reliability degradation or even catastrophic software failures. Prior studies on exception handling aim to understand the practices of exception handling in its different components, such as the origin of the exceptions and the handling code of the exceptions. Yet, the observed findings were scattered and diverse. In this paper, to complement prior research findings on exception handling, we study its features by enriching the knowledge of handling code with a flow analysis of exceptions. Our case study is conducted with over 10K exception handling blocks, and over 77K related exception flows from 16 open-source Java and C# (.NET) libraries and applications. Our case study results show that each try block has up to 12 possible potentially recoverable yet propagated exceptions. More importantly, 22% of the distinct possible exceptions can be traced back to multiple methods (average of 1.39 and max of 34). Such results highlight the additional challenge of composing quality exception handling code. To make it worse, we confirm that there is a lack of documentation of the possible exceptions and their sources. However, such critical information can be identified by exception flow analysis on well- documented API calls (e.g., JRE and .NET documentation). Finally, we observe different strategies in exception handling code between Java and C#. Our findings highlight the opportunities of leveraging automated software analysis to assist in exception handling practices and signify the need of more further in-depth studies on exception handling practice.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑