Empirical Software Engineering

, Volume 22, Issue 3, pp 1264–1304 | Cite as

Exception handling bug hazards in Android

Results from a mining study and an exploratory survey
  • Roberta Coelho
  • Lucas Almeida
  • Georgios Gousios
  • Arie van Deursen
  • Christoph Treude
Article

Abstract

Adequate handling of exceptions has proven difficult for many software engineers. Mobile app developers in particular, have to cope with compatibility, middleware, memory constraints, and battery restrictions. The goal of this paper is to obtain a thorough understanding of common exception handling bug hazards that app developers face. To that end, we first provide a detailed empirical study of over 6,000 Java exception stack traces we extracted from over 600 open source Android projects. Key insights from this study include common causes for system crashes, and common chains of wrappings between checked and unchecked exceptions. Furthermore, we provide a survey with 71 developers involved in at least one of the projects analyzed. The results corroborate the stack trace findings, and indicate that developers are unaware of frequently occurring undocumented exception handling behavior. Overall, the findings of our study call for tool support to help developers understand their own and third party exception handling and wrapping logic.

Keywords

Exception handling Android development Repository mining Exploratory survey 

References

  1. Amalfitano D, Fasolino AR, Tramontana P, De Carmine S, Memon AM (2012) Using gui ripping for automated testing of android applications. In: Proceedings of the 27th IEEE/ACM International conference on automated software engineering. ACM, pp 258–261Google Scholar
  2. Bacchelli A, Dal Sasso T, D’Ambros M, Lanza M (2012) Content classification of development emails. In: Proceedings of ICSE 2012, pp 375–385Google Scholar
  3. Bavota G, Linares-Vasquez M, Bernal-Cardenas C E, Di Penta M, Oliveto R, Poshyvanyk D (2015) The impact of api change-and fault-proneness on the user ratings of android apps. IEEE Trans Softw Eng 41(4):384–407CrossRefGoogle Scholar
  4. Bettenburg N, Just S, Schröter A, Weiss C, Premraj R, Zimmermann T (2008a) What makes a good bug report? In: Proceedings of FSE 2008, pp 308–318Google Scholar
  5. Bettenburg N, Premraj R, Zimmermann T, Kim S (2008b) Extracting structural information from bug reports. In: Proceedings of MSR 2008. ACM, pp 27–30Google Scholar
  6. Binder R (2000) Testing object-oriented systems: models, patterns, and tools. Addison-Wesley ProfessionalGoogle Scholar
  7. Bloch J (2008) Effective java. Pearson Education IndiaGoogle Scholar
  8. Brunet J, Guerrero D, Figueiredo J (2009) Design tests: an approach to programmatically check your code against design rules. In: Proceedings of new ideas and emerging research (NIER) track at the international conference on software engineering (ICSE). IEEE, pp 255–258Google Scholar
  9. Cabral B, Marques P (2007) Exception handling: a field study in Java and.Net. In: Proceedings of ECOOP 2007. Springer, pp 151–175Google Scholar
  10. Charmaz K (2006) Constructing grounded theory: a practical guide through qualitative research. SagePublications Ltd, LondonGoogle Scholar
  11. Jenkov Tutorials. Checked or Unchecked Exceptions? (2014) http://tutorials.jenkov.com/java-exception-handling/checked-or-unchecked-exceptions.html, online
  12. Coelho R, Rashid A, Garcia A, Ferrari F, Cacho N, Kulesza U, von Staa A, Lucena C (2008) Assessing the impact of aspects on exception flows: An exploratory study. In: Proceedings of European conference on object-oriented programming (ECOOP). Springer-Verlag, pp 207–234Google Scholar
  13. Coelho R, von Staa A, Kulesza U, Rashid A, Lucena C (2011) Unveiling and taming liabilities of aspects in the presence of exceptions: a static analysis based approach. Inf Sci 181(13):2700– 2720CrossRefGoogle Scholar
  14. Csallner C, Smaragdakis Y (2004) Jcrasher: an automatic robustness tester for Java. Softw Pract Exper 34(11):1025–1050CrossRefGoogle Scholar
  15. Dhaliwal T, Khomh F, Zou Y (2011) Classifying field crash reports for fixing bugs: A case study of mozilla firefox. In: Proceedings of international conference on software maintenance (ICSM 2011), pp 333–342Google Scholar
  16. Enck W, Octeau D, McDaniel P, Chaudhuri S (2011) A study of android application security. In: USENIX security symposium, vol 2, pp 2Google Scholar
  17. Fraser G, Arcuri A (2013) 1600 faults in 100 projects: automatically finding faults while achieving high coverage with evosuite. In: Empirical software engineering, pp 1–29Google Scholar
  18. Garcia A, Rubira C, et al. (2007) Extracting error handling to aspects: a cookbook. In: Proceedings international conference on software maintenance (ICSM). IEEE, pp 134–143Google Scholar
  19. Garcia A F, Rubira C M, Romanovsky A, Xu J (2001) A comparative study of exception handling mechanisms for building dependable object-oriented software. J Syst Softw 59(2):197–222CrossRefGoogle Scholar
  20. Goodenough J B (1975) Exception handling: issues and a proposed notation. CACM 18(12):683–696MathSciNetCrossRefMATHGoogle Scholar
  21. Gosling J (2000) The Java language specification. Addison-Wesley ProfessionalGoogle Scholar
  22. Gousios G (2013) The GHTorrent dataset and tool suite. In: Proceedings of the international working conference on mining software repositories (MSR). IEEE, pp 233–236Google Scholar
  23. Gousios G, Zaidman A, Storey MA, Van Deursen A (2015) Work practices and challenges in pull-based development: the integrator’s perspective. Tech. repGoogle Scholar
  24. Hindle A, Bird C, Zimmermann T, Nagappan N (2015) Do topics make sense to managers and developers? Emp Softw Eng 20(2):479–515CrossRefGoogle Scholar
  25. Jo J W, Chang B M, Yi K, Choe K M (2004) An uncaught exception analysis for java. J Syst Softw 72(1):59–69CrossRefGoogle Scholar
  26. Joorabchi M E, Mesbah A, Kruchten P (2013) Real challenges in mobile app development. In: 2013 ACM/IEEE International symposium on empirical software engineering and measurement. IEEE, pp 15–24Google Scholar
  27. Kechagia M, Spinellis D (2014) Undocumented and unchecked: exceptions that spell trouble. In: Proceedings of the 11th working conference on mining software repositories. ACM, pp 312–315Google Scholar
  28. Kim S, Zimmermann T, Nagappan N (2011) Crash graphs: an aggregated view of multiple crashes to improve crash triage. In: Proceedings of the IEEE/IFIP International conference on dependable systems and networks (DSN). IEEE, pp 486–493Google Scholar
  29. 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, pp 3–12Google Scholar
  30. Ko AJ, DeLine R, Venolia G (2007) Information needs in collocated software development teams. In: Proceedings of the 29th international conference on software engineering. IEEE Computer Society, pp 344–353Google Scholar
  31. Kochhar PS, Thung F, Nagappan N, Zimmermann T, Lo D (2015) Understanding the test automation culture of app developers. In: 2015 IEEE 8th International conference on software testing, verification and validation (ICST). IEEE, pp 1–10Google Scholar
  32. 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 FSE 2013. ACM, pp 477–487. doi:10.1145/2491411.2491428
  33. Linares-Vásquez M, Vendome C, Luo Q, Poshyvanyk D (2015) How developers detect and fix performance bottlenecks in android apps. In: 2015 IEEE International conference on software maintenance and evolution (ICSME). IEEE, pp 352–361Google Scholar
  34. Maji A K, Arshad F A, Bagchi S, Rellermeyer JS (2012) An empirical study of the robustness of inter-component communication in Android. In: Proceedings of the IEEE/IFIP international conference on dependable systems and networks (DSN). IEEE, pp 1–12Google Scholar
  35. Mandrioli D, Meyer B (1992) Advances in object-oriented software engineering. Prentice-Hall IncGoogle Scholar
  36. McDonnell T, Ray B, Kim M (2013) An empirical study of api stability and adoption in the android ecosystem. In: Proceedings international conference on software maintenance (ICSM), pp 70–79Google Scholar
  37. Meyer AN, Fritz T, Murphy GC, Zimmermann T (2014) Software developers’ perceptions of productivity. In: Proceedings of the 22nd ACM SIGSOFT international symposium on foundations of software engineering. ACM, pp 19–29Google Scholar
  38. Miller R, Tripathi A (1997) Issues with exception handling in object-oriented systems. In: Proceedings of ECOOP’97. Springer, pp 85–103Google Scholar
  39. Nanda MG, Sinha S (2009) Accurate interprocedural null-dereference analysis for java. In: 31st International conference on software engineering, 2009. ICSE 2009. IEEE, pp 133–143Google Scholar
  40. Null references:the billion dollar mistake, abstract of talk at QCon London (2009) https://qconlondon.com/london-2009/qconlondon.com/london-2009/presentation/Null%2BReferences_%2BThe%2BBillion%2BDollar%2BMistake.html, online
  41. Pathak A, Hu YC, Zhang M (2011) Bootstrapping energy debugging on smartphones: a first look at energy bugs in mobile devices. In: Proceedings of the 10th ACM workshop on hot topics in networks. ACM, New York, HotNets-X, pp 5:1–5:6. doi:10.1145/2070562.2070567
  42. Pham R, Singer L, Liskin O, Figueira Filho F, Schneider K (2013) Creating a shared understanding of testing culture on a social coding site. In: 2013 35th International conference on software engineering (ICSE). IEEE, pp 112–121Google Scholar
  43. Robillard MP, Murphy GC (2000) Designing robust Java programs with exceptions. In: Proceedings international conference on the foundations of software engineering (FSE). pp 2–10Google Scholar
  44. Ruiz I, Nagappan M, Adams B, Hassan A (2012) Understanding reuse in the Android market. In: Proceedings of the international conference on program comprehension (ICPC), pp 113–122. doi:10.1109/ICPC.2012.6240477
  45. Sacramento P, Cabral B, Marques P (2006) Unchecked exceptions: can the programmer be trusted to document exceptions. In: International conference on innovative views of.NET technologiesGoogle Scholar
  46. Schröter A, Bettenburg N, Premraj R (2010) Do stack traces help developers fix bugs? In: Proceedings working conference on mining software repositories (MSR). IEEE, pp 118–121Google Scholar
  47. Shah H B, Gorg C, Harrold M J (2010) Understanding exception handling: Viewpoints of novices and experts. IEEE Trans Soft Eng 36(2):150–161CrossRefGoogle Scholar
  48. Stackoverflow Q&A. Java: checked vs unchecked exception explanation. (2014) http://stackoverflow.com/questions/6115896/java-checked-vs-unchecked-exception-explanation, online
  49. Singer L, Figueira Filho F, Storey MA (2014) Software engineering at the speed of light: how developers stay current using twitter. In: Proceedings of the 36th international conference on software engineering. ACM, pp 211–221Google Scholar
  50. Sinha S, Shah H, Görg C, Jiang S, Kim M, Harrold MJ (2009) Fault localization and repair for Java runtime exceptions. In: Proceedings International symposium on software testing and analysis (ISSTA). ACM, pp 153–164Google Scholar
  51. The Java tutorial. Unchecked exceptions: The controversy. (2014) http://docs.oracle.com/javase/tutorial/essential/exceptions/runtime.html, online
  52. Van Dooren M, Steegmans E (2005) Combining the robustness of checked exceptions with the flexibility of unchecked exceptions using anchored exception declarations. ACM SIGPLAN Notices 40 (10):455–471CrossRefGoogle Scholar
  53. Wadler P (1995) Monads for functional programming. In: Advanced functional programming. Springer, pp 24–52Google Scholar
  54. Wang S, Khomh F, Zou Y (2013) Improving bug localization using correlations in crash reports. In: Proceedings working conference on mining software repositories (MSR 2013). ACM/IEEE, pp 247–256Google Scholar
  55. Wasserman AI (2010) Software engineering issues for mobile application development. In: Proceedings of the FSE/SDP workshop on future of software engineering research. ACM, pp 397–400Google Scholar
  56. Wirfs-Brock R J (2006) Toward exception-handling best practices and patterns. Softw IEEE 23(5):11–13CrossRefGoogle Scholar
  57. Yuan D, Luo Y, Zhuang X, Rodrigues GR, Zhao X, Zhang Y, Jain P, Stumm M (2014) Simple testing can prevent most critical failures: An analysis of production failures in distributed data-intensive systems. In: 11th USENIX symposium on operating systems design and implementation, OSDI ’14. Broomfield, pp 249–265Google Scholar
  58. Zhang P, Elbaum S (2012) Amplifying tests to validate exception handling code. In: Proceedings international conference on software engineering (ICSE). IEEE Press, Piscataway, pp 595–605. http://dl.acm.org/citation.cfm?id=2337223.2337293

Copyright information

© Springer Science+Business Media New York 2016

Authors and Affiliations

  • Roberta Coelho
    • 1
  • Lucas Almeida
    • 1
    • 2
  • Georgios Gousios
    • 3
  • Arie van Deursen
    • 3
  • Christoph Treude
    • 4
  1. 1.Federal University of Rio Grande do NorteNatal/RNBrazil
  2. 2.Federal Institute of Education, Science and Technology of Rio Grande do NorteCampus São Gonçalo do Amarante.São Gonçalo do AmaranteBrazil
  3. 3.Delft University of TechnologyDelftThe Netherlands
  4. 4.University of Adelaide, School of Computer ScienceAdelaideAustralia

Personalised recommendations