Do android developers neglect error handling? a maintenance-Centric study on the relationship between android abstractions and uncaught exceptions

Abstract All the mainstream programming languages in widespread use for mobile app development provide error handling mechanisms to support the implementation of robust apps. Android apps, in particular, are usually written in the Java programming language. Java includes an exception handling mechanism that allows programs to signal the occurrence of errors by throwing exceptions and to handle these exceptions by catching them. All the Android-specific abstractions, such as activities and asynctasks, can throw exceptions when errors occur. When an app catches the exceptions that it or the libraries upon which it depends throw, it can resume its activity or, at least, fail in a graceful way. On the other hand, uncaught exceptions can lead an app to crash, particularly if they occur within the main thread. Previous work has shown that, in real Android apps available at the Play Store, uncaught exceptions thrown by Android-specific abstractions often cause these apps to fail. This paper presents an empirical study on the relationship between the usage of Android abstractions and uncaught exceptions. Our approach is quantitative and maintenance-centric. We analyzed changes to both normal and exception handling code in 112 versions extracted from 16 software projects covering a number of domains, amounting to more than 3 million LOC. Change impact analysis and exception flow analysis were performed on those versions of the projects. The main finding of this study is that, during the evolution of the analyzed apps, an increase in the use of Android abstractions exhibits a positive and statistically significant correlation with the number of uncaught exception flows. Since uncaught exceptions cause apps to crash, this result suggests that these apps are becoming potentially less robust as a consequence of exception handling misuse. Analysis of multiple versions of these apps revealed that Android developers usually employ abstractions that may throw exceptions without adding the appropriate handlers for these exceptions. This study highlights the need for better testing and verification tools with a focus on exception handling code and for a change of culture in Android development or, at least, in the design of its APIs.

[1]  Claes Wohlin,et al.  Experimentation in software engineering: an introduction , 2000 .

[2]  Sahithi Thandra,et al.  Analysis of Exception Handling Patterns in Java Projects: An Empirical Study , 2016, 2016 IEEE/ACM 13th Working Conference on Mining Software Repositories (MSR).

[3]  Thomas Zimmermann,et al.  Predicting method crashes with bytecode operations , 2013, ISEC.

[4]  Alan Snyder,et al.  Exception Handling in CLU , 1979, IEEE Transactions on Software Engineering.

[5]  N. Nagappan,et al.  Use of relative code churn measures to predict system defect density , 2005, Proceedings. 27th International Conference on Software Engineering, 2005. ICSE 2005..

[6]  Chen Fu,et al.  Exception-Chain Analysis: Revealing Exception Handling Architecture in Java Server Applications , 2007, 29th International Conference on Software Engineering (ICSE'07).

[7]  Sebastian G. Elbaum,et al.  Amplifying tests to validate exception handling code , 2012, 2012 34th International Conference on Software Engineering (ICSE).

[8]  Harald C. Gall,et al.  Comparing fine-grained source code changes and code churn for bug prediction , 2011, MSR '11.

[9]  Flaviu Cristian,et al.  Exception Handling and Software Fault Tolerance , 1982, IEEE Transactions on Computers.

[10]  Mario Linares Vásquez,et al.  Generating Reproducible and Replayable Bug Reports from Android Application Crashes , 2015, 2015 IEEE 23rd International Conference on Program Comprehension.

[11]  Carl F. Schaefer,et al.  Static analysis of exception handling in Ada , 1993, Softw. Pract. Exp..

[12]  Xingmin Cui,et al.  WeChecker: efficient and precise detection of privilege escalation vulnerabilities in Android apps , 2015, WISEC.

[13]  Joseph Albahari,et al.  C# 5.0 in a Nutshell - The Definitive Reference: Covers CLR 4.5 and Asynchronous Programming, 5th Edition , 2012 .

[14]  Alex Shaw,et al.  Mining Android apps to predict market ratings , 2014, 6th International Conference on Mobile Computing, Applications and Services.

[15]  Alessandro F. Garcia,et al.  How Does Exception Handling Behavior Evolve? An Exploratory Study in Java and C# Applications , 2014, 2014 IEEE International Conference on Software Maintenance and Evolution.

[16]  Martin P. Robillard,et al.  Designing robust Java programs with exceptions , 2000, SIGSOFT '00/FSE-8.

[17]  Jacques Klein,et al.  Dexpler: converting Android Dalvik bytecode to Jimple for static analysis with Soot , 2012, SOAP '12.

[18]  Carlos José Pereira de Lucena,et al.  Assessing the Impact of Aspects on Exception Flows: An Exploratory Study , 2008, ECOOP.

[19]  Eduardo Figueiredo,et al.  EJFlow: taming exceptional control flows in aspect-oriented programming , 2008, AOSD.

[20]  Edward B. Allen,et al.  Exception Handling Defects: An Empirical Study , 2012, 2012 IEEE 14th International Symposium on High-Assurance Systems Engineering.

[21]  Guy L. Steele,et al.  A pattern of language evolution , 2008, LISP50.

[22]  Cecília M. F. Rubira,et al.  A comparative study of exception handling mechanisms for building dependable object-oriented software , 2001, J. Syst. Softw..

[23]  Yongji Wang,et al.  Exception beyond Exception: Crashing Android System by Trapping in "Uncaught Exception" , 2017, 2017 IEEE/ACM 39th International Conference on Software Engineering: Software Engineering in Practice Track (ICSE-SEIP).

[24]  Nélio Cacho,et al.  An Exploratory Study of Exception Handling Behavior in Evolving Android and Java Applications , 2016, SBES '16.

[25]  Nélio Cacho,et al.  eFlowMining: An Exception-Flow Analysis Tool for .NET Applications , 2011, 2011 Fifth Latin-American Symposium on Dependable Computing Workshops.

[26]  Felipe Ebert,et al.  A Reflection on “An Exploratory Study on Exception Handling Bugs in Java Programs” , 2015, 2020 IEEE 27th International Conference on Software Analysis, Evolution and Reengineering (SANER).

[27]  David Lorge Parnas,et al.  Response to undesired events in software systems , 1976, ICSE '76.

[28]  Brian Randell,et al.  The Evolution of the Recovery Block Concept , 1994 .

[29]  Jan S. Rellermeyer,et al.  An empirical study of the robustness of Inter-component Communication in Android , 2012, IEEE/IFIP International Conference on Dependable Systems and Networks (DSN 2012).

[30]  Alessandro F. Garcia,et al.  Trading robustness for maintainability: an empirical study of evolving c# programs , 2014, ICSE.

[31]  Gustavo Pinto,et al.  A large-scale study on the usage of Java's concurrent programming constructs , 2015, J. Syst. Softw..

[32]  Hermann Kopetz,et al.  Fault tolerance, principles and practice , 1990 .

[33]  Danny Dig,et al.  How do developers use parallel libraries? , 2012, SIGSOFT FSE.

[34]  Diomidis Spinellis,et al.  Undocumented and unchecked: exceptions that spell trouble , 2014, MSR 2014.

[35]  Cristina Marinescu Should We Beware the Exceptions? An Empirical Study on the Eclipse Project , 2013, 2013 15th International Symposium on Symbolic and Numeric Algorithms for Scientific Computing.

[36]  Ahmed E. Hassan,et al.  What Do Mobile App Users Complain About? , 2015, IEEE Software.

[37]  John B. Goodenough,et al.  Exception handling: issues and a proposed notation , 1975, CACM.

[38]  Carlos José Pereira de Lucena,et al.  Unveiling and taming liabilities of aspects in the presence of exceptions: A static analysis based approach , 2011, Inf. Sci..

[39]  Cecília M. F. Rubira,et al.  Extracting Error Handling to Aspects: A Cookbook , 2007, 2007 IEEE International Conference on Software Maintenance.

[40]  Gabriel F. Groner PL/I programming in technological applications , 1971 .

[41]  Liudmila Ulanova,et al.  An Empirical Analysis of Bug Reports and Bug Fixing in Open Source Android Apps , 2013, 2013 17th European Conference on Software Maintenance and Reengineering.

[42]  Stephen S. Yau,et al.  Design Stability Measures for Software Maintenance , 1985, IEEE Transactions on Software Engineering.

[43]  Cecília M. F. Rubira,et al.  Exceptions and aspects: the devil is in the details , 2006, SIGSOFT '06/FSE-14.

[44]  Paulo Marques,et al.  Exception Handling: A Field Study in Java and .NET , 2007, ECOOP.

[45]  Anand R. Tripathi,et al.  Issues with Exception Handling in Object-Oriented Systems , 1997, ECOOP.

[46]  Alessandro Garcia,et al.  Analyzing Exceptional Interfaces on Evolving Frameworks , 2011, 2011 Fifth Latin-American Symposium on Dependable Computing Workshops.

[47]  Arie van Deursen,et al.  Unveiling Exception Handling Bug Hazards in Android Based on GitHub and Google Code Issues , 2015, MSR.

[48]  Robert V. Binder,et al.  Testing Object-Oriented Systems: Models, Patterns, and Tools , 1999 .

[49]  Gabriele Bavota,et al.  API change and fault proneness: a threat to the success of Android apps , 2013, ESEC/FSE 2013.

[50]  Brad A. Myers,et al.  Examining Programmer Practices for Locally Handling Exceptions , 2016, 2016 IEEE/ACM 13th Working Conference on Mining Software Repositories (MSR).

[51]  David A. Wagner,et al.  Analyzing inter-application communication in Android , 2011, MobiSys '11.

[52]  Gordon Fraser,et al.  1600 faults in 100 projects: automatically finding faults while achieving high coverage with EvoSuite , 2015, Empirical Software Engineering.

[53]  Cristina Marinescu Are the classes that use exceptions defect prone? , 2011, IWPSE-EVOL '11.

[54]  Uirá Kulesza,et al.  Understanding the Exception Handling Strategies of Java Libraries: An Empirical Study , 2016, 2016 IEEE/ACM 13th Working Conference on Mining Software Repositories (MSR).

[55]  Martin P. Robillard,et al.  Static analysis to support the evolution of exception structure in object-oriented systems , 2003, TSEM.