skip to main content
research-article

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

Published: 01 February 2018 Publication History

Abstract

Most of the method calls to Android abstractions are not protected.Use of Android abstractions often decreases robustness.Lack of changes to exception handling code leads to uncaught exception.The change scenarios that decrease robustness are described. 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.

References

[1]
Barbosa, E.A., Garcia, A., 2011. Analyzing exceptional interfaces on evolving frameworks. In: Fifth Latin-American Symposium on Dependable Computing Workshops, pp. 17-20.
[2]
Bartel, A., Klein, J., Le Traon, Y., Monperrus, M., 2012. Dexpler: Converting android dalvik bytecode to jimple for static analysis with soot. In: Proceedings of the ACM SIGPLAN International Workshop on State of the Art in Java Program Analysis. ACM, New York, NY, USA, pp. 27-38.
[3]
Bhattacharya, P., Ulanova, L., Neamtiu, I., Koduru, S.C., 2013. An empirical analysis of bug reports and bug fixing in open source android apps. In: Software Maintenance and Reengineering (CSMR), 2013 17th European Conference on. IEEE, pp. 133-143.
[4]
Binder, R., 2000. Testing object-Oriented systems: Models, patterns, and tools. Addison-Wesley Professional.
[5]
Cabral, B., Marques, P., 2007. Exception handling: A field study in Java and.net. In: 21st European Conference Object-Oriented Programming. Springer, pp. 151-175.
[6]
Cacho, N., Barbosa, E.A., Araujo, J., Pranto, F., Garcia, A., Cesar, T., Soares, E., Cassio, A., Filipe, T., Garcia, I., 2014. How does exception handling behavior evolve? an exploratory study in Java and C# applications. In: IEEE International Conference on Software Maintenance and Evolution (ICSME), pp. 31-40.
[7]
Cacho, N., Castor Filho, F., Garcia, A., Figueiredo, E., 2008. Ejflow: taming exceptional control flows in aspect-oriented programming. In: Proceedings of the 7th International Conference on Aspect-Oriented Software Development. ACM, New York, NY, USA, pp. 72-83.
[8]
Cacho, N., et al., 2014. Trading robustness for maintainability: An empirical study of evolving C# programs. In: Proceedings of the 36th International Conference on Software Engineering. ACM.
[9]
Castor Filho, F., Cacho, N., Figueiredo, E., Maranhao, R., Garcia, A., Rubira, C.M.F., 2006. Exceptions and aspects: the devil is in the details. In: SIGSOFT '06/FSE-14: Proceedings of the 14th ACM SIGSOFT international symposium on Foundations of software engineering. ACM Press, New York, NY, USA, pp. 152-162.
[10]
Castor Filho, F., Garcia, A., Rubira, C.M.F., 2007. Extracting error handling to aspects: A cookbook. In: IEEE International Conference on Software Maintenance, 2007. ICSM 2007, pp. 134-143.
[11]
Chin, E., Felt, A.P., Greenwood, K., Wagner, D., 2011. Analyzing inter-application communication in android. In: Proceedings of the 9th International Conference on Mobile Systems, Applications, and Services, pp. 239-252.
[12]
Coelho, R., Almeida, L., Gousios, G., van Deursen, A., 2015. Unveiling exception handling bug hazards in android based on Github and Google code issues. In: Proceedings of the 12th Working Conference on Mining Software Repositories.
[13]
Coelho, R., von Staa, A., Kulesza, U., Rashid, A., de Lucena, C.J.P., 2011. Unveiling and taming liabilities of aspects in the presence of exceptions: a static analysis based approach. Inf. Sci. 181 (13), 2700-2720.
[14]
Coelho, R., et al., 2008. Assessing the impact of aspects on exception flows: An exploratory study. Springer, pp. 207-234.
[15]
Cristian, F., 1982. Exception handling and software fault tolerance. IEEE Trans. Computers 31 (6), 531-540.
[16]
Cui, X., Wang, J., Hui, L.C., Xie, Z., Zeng, T., Yiu, S., 2015. Wechecker: efficient and precise detection of privilege escalation vulnerabilities in android apps. In: Proceedings of the 8th ACM Conference on Security & Privacy in Wireless and Mobile Networks. ACM, p. 25.
[17]
Ebert, F., Castor, F., Serebrenik, A., 2015. An exploratory study on exception handling bugs in java programs. J. Syst. Softw. 106, 82-101.
[18]
Fraser, G., Arcuri, A., 2015. 1600 Faults in 100 projects: automatically finding faults while achieving high coverage with evosuite. Empirical Softw. Engg. 20 (3), 611-639.
[19]
Fu, C., Ryder, B.G., 2007. Exception-chain analysis: Revealing exception handling architecture in Java server applications. In: ICSE '07. IEEE Computer Society, pp. 230-239.
[20]
Gabriel, R.P., Steele Jr., G.L., 2008. A pattern of language evolution. In: Celebrating the 50th Anniversary of Lisp, pp. 1:1-1:10.
[21]
Garcia, A.F., Rubira, C.M.F., Romanovsky, A., Xu, J., 2001. A comparative study of exception handling mechanisms for building dependable object-oriented software. J. Syst. Softw. 59 (2), 197-222.
[22]
Garcia, I., Cacho, N., 2011. eflowmining: An exception-flow analysis tool for.net applications. In: Dependable Computing Workshops (LADCW), 2011 Fifth Latin-American Symposium on, pp. 1-8.
[23]
Giger, E., Pinzger, M., Gall, H.C., 2011. Comparing fine-grained source code changes and code churn for bug prediction. In: Proceedings of the 8th Working Conference on Mining Software Repositories. ACM, New York, NY, USA, pp. 83-92.
[24]
Goodenough, J.B., 1975. Exception handling: issues and a proposed notation. Commun. ACM 18 (12), 683-696.
[25]
Groner, G.F., 1971. PL/I Programming in Technological Applications. Books on Demand, Ann Arbor, MI.
[26]
Hopkins, W.G., 2013. A new view of statistics. Will G. Hopkins.
[27]
Inc., G., 2015. The android developers website. Http://developer.android.com. Last visit: March 30th 2015.
[28]
Joseph Albahari, B.A., 2012. C# 5.0 in a Nutshell: The Definitive Reference, 5th O'Reilly Media.
[29]
Kechagia, M., Spinellis, D., 2014. Undocumented and unchecked: Exceptions that spell trouble. In: Proceedings of the 11th Working Conference on Mining Software Repositories.
[30]
Kery, M.B., Le Goues, C., Myers, B.A., 2016. Examining programmer practices for locally handling exceptions. In: Proceedings of the 13th International Conference on Mining Software Repositories. ACM, New York, NY, USA, pp. 484-487.
[31]
Khalid, H., Shihab, E., Nagappan, M., Hassan, A., 2015. What do mobile app users complain about? a study on free ios apps. IEEE Software 32 (3).
[32]
Kim, S., Zimmermann, T., Premraj, R., Bettenburg, N., Shivaji, S., 2013. Predicting method crashes with bytecode operations. In: Proceedings of the 6th India Software Engineering Conference. ACM, New York, NY, USA, pp. 3-12.
[33]
Lee, P.A., Anderson, T., 1990. Fault Tolerance: Principles and practice, 2nd Springer-Verlag.
[34]
Linares-Vásquez, M., Bavota, G., Bernal-Cárdenas, C., Di Penta, M., Oliveto, R., Poshyvanyk, D., 2013. Api change and fault proneness: A threat to the success of android apps. In: Proceedings of the 2013 9th Joint Meeting on Foundations of Software Engineering. ACM, New York, NY, USA, pp. 477-487.
[35]
Liskov, B., Snyder, A., 1979. Exception handling in clu. IEEE Trans. Software Eng. 5 (6), 546-558.
[36]
Maji, A., Arshad, F., Bagchi, S., Rellermeyer, J., 2012. An empirical study of the robustness of inter-component communication in android. In: Dependable Systems and Networks (DSN), 2012 42nd Annual IEEE/IFIP International Conference on, pp. 1-12.
[37]
Marinescu, C., 2011. Are the classes that use exceptions defect prone? In: Proceedings of the 12th International Workshop on Principles of Software Evolution and the 7th annual ERCIM Workshop on Software Evolution. ACM, New York, NY, USA, pp. 56-60.
[38]
Marinescu, C., 2013. Should we beware the exceptions? an empirical study on the eclipse project. In: Symbolic and Numeric Algorithms for Scientific Computing (SYNASC), 2013 15th International Symposium on, pp. 250-257.
[39]
McCune, T., 2006. Exception-handling antipatterns. Address: http://today.java.net/pub/a/today/2006/04/06/exception-handling-antipatterns.html-Last access: May 10th 2013.
[40]
Melliar-Smith, P.M., Randell, B., 1977. Software reliability: The role of programmed exception handling. In: Proceedings of an ACM conference on Language design for reliable software, pp. 95-100.
[41]
Miller, R., Tripathi, A., 1997. Issues with exception handling in object-oriented systems. Lect. Notes Comput. Sci. 1241.
[42]
Nagappan, N., Ball, T., 2005. Use of relative code churn measures to predict system defect density. In: Proceedings of the 27th international conference on Software engineering. ACM, New York, NY, USA, pp. 284-292.
[43]
Nakshatri, S., Hegde, M., Thandra, S., 2016. Analysis of exception handling patterns in java projects: An empirical study. In: Proceedings of the 13th International Conference on Mining Software Repositories. ACM, New York, NY, USA, pp. 500-503.
[44]
Okur, S., Dig, D., 2012. How do developers use parallel libraries. In: Proceedings of the 21st ACM SIGSOFT Symposium on Foundations of Software Engineering.
[45]
Oliveira, J., Cacho, N., Borges, D., Silva, T., Castor, F., 2016. An exploratory study of exception handling behavior in evolving android and java applications. In: Proceedings of the 30th Brazilian Symposium on Software Engineering. Maringa, Brazil, pp. 23-32.
[46]
Oracle, 2015. Unchecked exceptions ? the controversy. Available at: https://docs.oracle.com/javase/tutorial/essential/exceptions/runtime.html. Last visit: July 15th 2017.
[47]
Parnas, D.L., Wurges, H., 1976. Response to undesired events in software systems. In: ICSE '76: Proceedings of the 2nd international conference on Software engineering. IEEE Computer Society Press, Los Alamitos, CA, USA, pp. 437-446.
[48]
Phillips, B., Hardy, B., 2013. Android Programming: The Big Nerd Ranch Guide, 1st Big Nerd Ranch Guides.
[49]
Pinto, G., Torres, W., Fernandes, B., Castor, F., Barros, R.S., 2015. A large-scale study on the usage of Java's concurrent programming constructs. J. Syst. Softw. 106 (C), 59-81.
[50]
Randell, B., 1995. The Evolution of the Recovery Block Concept. In: Lyu (Ed.), Software Fault Tolerance, pp. 1-21.
[51]
Robillard, M.P., Murphy, G.C., 2000. Designing robust java programs with exceptions. In: SIGSOFT '00/FSE-8: Proceedings of the 8th ACM SIGSOFT international symposium on Foundations of software engineering. ACM, New York, NY, USA, pp. 2-10.
[52]
Robillard, M.P., Murphy, G.C., 2003. Static analysis to support the evolution of exception structure in object-oriented systems. ACM Trans. Softw. Eng. Methodol. 12 (2), 191-221.
[53]
Sawadpong, P., Allen, E., Williams, B., 2012. Exception handling defects: An empirical study. In: High-Assurance Systems Engineering (HASE), 2012 IEEE 14th International Symposium on, pp. 90-97.
[54]
Schaefer, C.F., Bundy, G.N., 1993. Static analysis of exception handling in ada. Softw. Pract. Exper. 23 (10), 1157-1174.
[55]
Sena, D., Coelho, R., Kulesza, U., Bonifácio, R., 2016. Understanding the exception handling strategies of Java libraries: An empirical study. In: Proceedings of the 13th International Conference on Mining Software Repositories, pp. 212-222.
[56]
Shaw, E., Shaw, A., Umphress, D., 2014. Mining android apps to predict market ratings. In: Mobile Computing, Applications and Services (MobiCASE), 2014 6th International Conference on. IEEE, pp. 166-167.
[57]
White, M., Linares-Vásquez, M., Johnson, P., Bernal-Cárdenas, C., Poshyvanyk, D., 2015. Generating reproducible and replayable bug reports from android application crashes. In: Program Comprehension (ICPC), 2015 IEEE 23rd International Conference on. IEEE, pp. 48-59.
[58]
Wohlin, C., Runeson, P., Höst, M., Ohlsson, M.C., Regnell, B., Wesslén, A., 2000. Experimentation in Software Engineering - An Introduction. Springer.
[59]
Wu, J., Liu, S., Ji, S., Yang, M., Luo, T., Wu, Y., Wang, Y., 2017. Exception beyond exception: Crashing android system by trapping in "uncaughtexception". In: Proceedings of the 39th International Conference on Software Engineering: Software Engineering in Practice Track. IEEE Press, Piscataway, NJ, USA, pp. 283-292.
[60]
Yau, S.S., Collofello, J.S., 1985. Design stability measures for software maintenance. IEEE Trans. Softw. Eng. 11 (9), 849-856.
[61]
Zhang, P., Elbaum, S., 2012. Amplifying tests to validate exception handling code. In: In Proceedings of 34th International Conference on Software Engineering, pp. 595-605.

Cited By

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

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image Journal of Systems and Software
    Journal of Systems and Software  Volume 136, Issue C
    February 2018
    288 pages

    Publisher

    Elsevier Science Inc.

    United States

    Publication History

    Published: 01 February 2018

    Qualifiers

    • Research-article

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)0
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 13 Jan 2025

    Other Metrics

    Citations

    Cited By

    View all

    View Options

    View options

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media