Exception Handling: A Field Study in Java and .NET



Most modern programming languages rely on exceptions for dealing with abnormal situations. Although exception handling was a significant improvement over other mechanisms like checking return codes, it is far from perfect. In fact, it can be argued that this mechanism is seriously limited, if not, flawed. This paper aims to contribute to the discussion by providing
quantitative measures on how programmers are currently using exception handling. We examined 32 different applications, both for Java and .NET. The major conclusion for this work is that exceptions are not being correctly used as an error recovery mechanism. Exception handlers are not specialized enough for allowing recovery and, typically, programmers just do one of the following actions: logging, user notification and application termination. To our knowledge, this is the most comprehensive study done on exception handling to date, providing a quantitative measure useful for guiding the development of new error handling mechanisms.


Exception handling mechanisms


European Conference in Object-Oriented Programming 2007 (ECOOP'07), July 2007

Cited by

Year 2015 : 2 citations

 Felber, Pascal and Fetzer, Christof and Gramoli, Vincent and Harmanci, Derin and Nowack, Martin. Safe Exception Handling with Transactional Memory. Transactional Memory. Foundations, Algorithms, Tools, and Applications. Lecture Notes in Computer Science Volume 8913, 2015, pp 245-267

 Benoit Cornu, Lionel Seinturier, Martin Monperrus, Exception handling analysis and transformation using fault injection: Study of resilience against unanticipated exceptions, Information and Software Technology, Volume 57, January 2015, Pages 66-76

Year 2014 : 11 citations

 Mohammad Masudur Rahman. Exploiting Context in Dealing with Programming Errors and Exceptions in the IDE. MSc Thesis. Department of Computer Science, University of Saskatchewan Saskatoon. August 2014.

 Andrews, A.; Boukhris, S.; Elakeili, S., "Fail-Safe Testing of Web Applications," Software Engineering Conference (ASWEC), 2014 23rd Australian , vol., no., pp.200,209, 7-10 April 2014
doi: 10.1109/ASWEC.2014.29

 Cacho, N.; Adachi Barbosa, E.; Araujo, J.; Pranto, F.; Garcia, A.; Cesar, T.; Soares, E.; Cassio, A.; Filipe, T.; Garcia, I., "How Does Exception Handling Behavior Evolve? An Exploratory Study in Java and C# Applications," Software Maintenance and Evolution (ICSME), 2014 IEEE International Conference on , vol., no., pp.31,40, Sept. 29 2014-Oct. 3 2014
doi: 10.1109/ICSME.2014.25

 Nélio Cacho,Thiago César, Thomas Filipe, Eliezio Soares, Arthur Cassio, Rafael Souza, Israel Garcia, Eiji Adachi Barbosa, Alessandro Garcia. Trading Robustness for Maintainability: An Empirical Study of Evolving C# Programs. In Proceeding of ICSE’14, May 31 – June 7, 2014, Hyderabad, India.

 MARTINS, A. L. ; HANAZUMI, S. ; MELO, Ana C. V. de . Exercising Java Exceptions Using Java Pathfinder and Program Instrumentation. In: The 14th International Conference on Computational Science and Its Applications (ICCSA 2014), 2014, Guimarães. Computational Science and Its Applications ICCSA 2014: 14th International Conference, Guimarães, Portugal, June 30 July 3, 2014, Proceedings, Part I, 2014. v. 8579. p. 671-682.

 Rahman, M.M.; Roy, C.K., "On the Use of Context in Recommending Exception Handling Code Examples," Source Code Analysis and Manipulation (SCAM), 2014 IEEE 14th International Working Conference on , vol., no., pp.285,294, 28-29 Sept. 2014
doi: 10.1109/SCAM.2014.15

 Fei, L, Jain, M. Programmer specified conditions for raising exceptions and handling errors detected within programming code. Patent US 8793661 B1. Published 29/07/2014.

 Adachi Barbosa, E.; Garcia, A.; Barbosa, S.D.J., "Categorizing Faults in Exception Handling: A Study of Open Source Projects," Software Engineering (SBES), 2014 Brazilian Symposium on , vol., no., pp.11,20, Sept. 28 2014-Oct. 3 2014
doi: 10.1109/SBES.2014.19

 Martins, A.L.; Hanazumi, S.; De Melo, A.C.V., "Testing Java Exceptions: An Instrumentation Technique," Computer Software and Applications Conference Workshops (COMPSACW), 2014 IEEE 38th International , vol., no., pp.626,631, 21-25 July 2014
doi: 10.1109/COMPSACW.2014.105

 Martin Monperrus, Maxence Germain De Montauzan, Benoit Cornu, Raphael Marvie, Romain Rouvoy. Challenging Analytical Knowledge On Exception-Handling: An Empirical Study of of 32 Java Software Packages. [Technical Report] Laboratoire d’Informatique Fondamentale de Lille. 2014.

 Eiji Adachi Barbosa. Improving Exception Handling with Recommendations. In proceedings of ICSE ’14, May 31 – June 7, 2014, Hyderabad, India.

Year 2013 : 3 citations

 Hao Zhong, Suresh Thummalapenta, and Tao Xie. 2013. Exposing behavioral differences in cross-language API mapping relations. In Proceedings of the 16th international conference on Fundamental Approaches to Software Engineering (FASE'13), Vittorio Cortellessa and Dániel Varró (Eds.). Springer-Verlag, Berlin, Heidelberg, 130-145. DOI=10.1007/978-3-642-37057-1_10

 Thiago B. L. Silva and Fernando Castor. 2013. New exception interfaces for Java-like languages. In Proceedings of the 28th Annual ACM Symposium on Applied Computing (SAC '13). ACM, New York, NY, USA, 1661-1666. DOI=10.1145/2480362.2480675

 Hannu Jaakkola, Bernhard Thalheim, Exception-Aware (Information) Systems, Frontiers in Artificial Intelligence and Applications, Volume 251: Information Modelling and Knowledge Bases XXIV, IOS Press EBooks pp. 300 - 313. DOI 10.3233/978-1-61499-177-9-300

Year 2012 : 10 citations

 Krohn-Hansen, Håkon. Program crash analysis. Masteroppgave, University of Oslo, 2012

 Huang Yanyi, Yu Yang, Peng Xin, Zhao Wenyun, An Aspect-Oriented Software Fault Tolerance Enhancement Tool, Computer Applications and Software, Vol.29, N. 2, February 2012.

 Rami Rashkovits and Ilana Lavy, Students' Understanding of Advanced Properties of Java Exceptions, in Journal of Information Technology Education: Innovations in Practice, Meliha Handzic (Ed.), Volume 11, 2012.

 Krohn-Hansen, Håkon, Program Crash Analysis: Evaluation and Application of Current Methods, Master thesis, UNIVERSITY OF OSLO, Department of Informatics, 2012.

 Barbosa, Eiji Adachi; Garcia, Alessandro; Mezini, Mira; , Heuristic Strategies for Recommendation of Exception Handling Code, Software Engineering (SBES), 2012 26th Brazilian Symposium on , vol., no., pp.171-180, 23-28 Sept. 2012
doi: 10.1109/SBES.2012.22

 Rashkovits, Rami and Lavy, Ilana, Students’ Misconceptions of Java Exceptions, in Knowledge and Technologies in Innovative Information Systems, Rahman, Hakikur and Mesquita, Anabela and Ramos, Isabel and Pernici, Barbara (editors), Lecture Notes in Business Information Processing, Volume 129, Springer Berlin Heidelberg, pages 1-21, 2012.

 Mehmet Derin Harmanci, Semantics, Performance and Language Support for Transactional Memory, Ph.D. Thesis, Faculte des Sciences Universite de Neuchatel, June 2012.

 Barbosa, E.A.; Garcia, A.; Mezini, M.; , A recommendation system for exception handling code, Exception Handling (WEH), 2012 5th International Workshop on , vol., no., pp.52-54, 9-9 June 2012
doi: 10.1109/WEH.2012.6226601

 Rafael Tavares Dantas, Specification of Exceptional Behavior: A Test-Based Approach, M.Sc Thesis, Universidade Federal de Pernambuco, March 2012.

 Ismael Figueroa Palet, Exception Handling in Aspect-Oriented Programming, CC79T - Introducción a la Tesis, PLEIAD laboratory of the Computer Science Department (DCC) of the University of Chile (Faculty of Engineering), 2012.

Year 2011 : 7 citations

 P. Loretan, Software Cartography: A Prototype for Thematic Software Maps, diploma thesis for the Philosophic-natural Science Faculty, University of Bern, April 2011

 R. Coelho, A. von Staa, U. Kulesza, A. Rashid, C. Lucena, Unveiling and taming liabilities of aspects in the presence of exceptions: A static analysis based approach, Information Sciences, Volume 181, Issue 13, Including Special Section on Databases and Software Engineering, Pages 2700-2720, July 2011.

 D. Harmanci, V. Gramoli, P. Felber, Atomic Boxes: Coordinated Exception Handling with Transactional Memory, in Proceedings of the 25th European Conference on Object-Oriented Programming (ECOOP'11), Springer Verlag, Lancaster, UK, July 2011.

 I. Garcia, and N. Cacho, eFlowMining: An Exception-Flow Analysis Tool for .NET Applications, Fifth Latin-American Symposium on Dependable Computing Workshops, IEEE, 2011.

 Di Bernardo, R.; Sales, R.; Castor, F.; Coelho, R.; Cacho, N.; Soares, S.; , Agile Testing of Exceptional Behavior, Software Engineering (SBES), 2011 25th Brazilian Symposium on , vol., no., pp.204-213, 28-30 Sept. 2011
doi: 10.1109/SBES.2011.28

 Xiaoquan Wu; Zhongxing Xu; Jun Wei; , Static Detection of Bugs Caused by Incorrect Exception Handling in Java Programs, Quality Software (QSIC), 2011 11th International Conference on , vol., no., pp.61-66, 13-14 July 2011
doi: 10.1109/QSIC.2011.25

 Rami Rashkovits and Ilana Lavy, Students’ Strategies for Exception Handling, in Journal of Information Technology Education: Innovations in Practice, Meliha Handzic (Ed.), Volume 10, 2011

Year 2010 : 8 citations

 A. Kuhn, D. Erni, P. Loretan, and O. Nierstrasz, Software Cartography: thematic software visualization with consistent layout. in Journal of Software Maintenance and Evolution: Research and Practice, 22: 191–210, 2010.

 G. Soares, R. Gheyi, D. Serey, T. Massoni, "Making Program Refactoring Safer," Software, IEEE , vol.27, no.4, pp.52-57, July-Aug. 2010.

 H. B. Shah, C. Gorg, and M. J. Harrold, Understanding Exception Handling: Viewpoints of Novices and Experts, IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, VOL. 36, NO. 2, MARCH/APRIL 2010.

 J. C. Taveira, H. O. Silva, F. Castor, and S. Soares, On Inter-Application Reuse of Exception Handling Aspects, In Proceedings of the AOSD'2010 Workshop on Empirical Evaluation of Software Composition Techniques (ESCOT'2010). Rennes, France, March 2010.

 X. Wu, J. Wei, Static Detection Unsafe Use of variables In Java, in 7th International Conference on Ubiquitous Intelligence & Computing and 7th International Conference on Autonomic & Trusted Computing (UIC/ATC), 2010.

 R. Rashkovits, I. Lavy, "Coping with abstraction in object orientation with a special focus on application errors," in 5th International Conference on Computer Science and Education (ICCSE), pp.277-287, 24-27 Aug. 2010.

 P. Fatourou, T. Riegel, P. Felber, C. Fetzer, The Distributed Computing Column, Composable Error Recovery With Transactional Memory. EATCS Bulletin, North America, 0, jan. 2010.

 G. A. Soares, Uma Abordagem para Aumentar a Segurança em Refatoramentos de Programas, Masters Thesis, Universidade Federal de Campina Grande, Centro de Engenharia Elétrica e Informática, Coordenação de Pós-Graduação em Informática, Campina Grande, Paraíba, Brasil, 2010

Year 2009 : 2 citations

 J. Gil and T. Shragai, Are We Ready for a Safer Construction Environment?, In Proceedings of the 23rd European Conference on Object-Oriented Programming (ECOOP'09) (Genoa), Sophia Drossopoulou (Ed.). Springer-Verlag, Berlin, Heidelberg, 2009.

 J. C. Taveira, C. Queiroz, R. Lima, J. Saraiva, S. Soares, H. Oliveira, N. Temudo, A. Araújo, J. Amorim, F. Castor, E. Barreiros, "Assessing Intra-application Exception Handling Reuse with Aspects," sbes, pp.22-31, 2009 XXIII Brazilian Symposium on Software Engineering, 2009

Year 2008 : 8 citations

 R. Coelho et al., "Assessing the Impact of Aspects on Exceptions Flows: An Exploratory Study", in Proc. of the 22nd European Conference on Object Oriented Programming (ECOOP'08), LNCS 5142, Springer, July 2008

 Hervé Chang, Leonardo Mariani, Mauro Pezzè, "Self-healing Strategies For Component Integration Faults", in Proc. 1st International Workshop on Automated engineeRing of Autonomous and run-tiMe evolvIng Systems (ARAMIS 2008), L'Aquila, Italy, September 16, 2008

 N. Cacho, F. Filho, A. Garcia, E. Figueiredo, "EJFlow: taming exceptional control flows in aspect-oriented programming", in Proc. of the 7th international conference on Aspect-oriented software development, ACM Press, 2008.

 A. Naderlinger, J. Templ, \"A Framework for Command Processing in Java/Swing Programs Based on the MVC Pattern", in Proc. of the 6th international symposium on Principles and practice of programming in Java, ACM Press, Modena, Italy, 2008

 R. Muschevici, A. Potanin, E. Tempero, J. Noble, "Multiple Dispatch in Practice", in Proceedings of the 23rd ACM SIGPLAN conference on Object oriented programming systems languages and applications (OOPSLA"2008), ACM Press, 2008

 A. Kuhn, P. Loretan, O. Nierstrasz, "Consistent Layout for Thematic Software Maps", In Proc. of 15th Working Conference on Reverse Engineering (WCRE"08), IEEE Computer Society Press, Los Alamitos CA, ,pp. 209-218, October 2008.

 R. Coelho, U. Kulesza, A. Rashid, A. von Staa, C. Lucena, "Unveiling and Taming the Liabilities of Aspect Libraries Reuse", in Simpósio Brasileiro de Engenharia de Software (SBES), Brasil, Outubro 2008.

 R. Coelho, Analyzing Exception Flows of Aspect-Oriented Programs, PhD Thesis, Dissertation presented to Pontifícia Universidade Católica do Rio de Janeiro, Departamento de
Informática, 2008.

Year 2007 : 1 citations

 R. Muschevici, Understanding programming: a study of the adoption of multiple dispatch, in Proceedings of the SIENZ’07: Software Innovation and Engineering New Zealand Workshop 2007, edited by John Hosking (Auckland, University of Auckland, Dept. of Computer Science, 2007), 2007.