Exception Handling: A Field Study in Java and .NET

  • Bruno Cabral
  • Paulo Marques
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4609)


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 Programming Languages 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Gunnerson, E.: C# and exception specifications. Microsoft (2000), Available online at: http://discuss.develop.com/archives/wa.exe?A2=ind0011A&L=DOTNET&P=R32820
  2. 2.
    Goodenough, J.B.: Exception handling: issues and a proposed notation. Communications of the ACM 18(12) (December 1975)Google Scholar
  3. 3.
    Cristian, F.: Exception Handling and Software Fault Tolerance. In: Proceedings of FTCS-25 (reprinted from FTCS-IO 1980, 97–103) 3, IEEE (1996)Google Scholar
  4. 4.
    Garcia, A., Rubira, C., Romanovsky, A., Xu, J.: A Comparative Study of Exception Handling Mechanisms for Building Dependable Object-Oriented Software. Journal of Systems and Software 2, 197–222 (2001)CrossRefGoogle Scholar
  5. 5.
    Sinha, S., Harrold, M.: Analysis and Testing of Programs with Exception-Handling Constructs. IEEE Transactions on Software Engineering 26, 9 (September 2000)Google Scholar
  6. 6.
    Miller, R., Tripathi, A.: Issues with exception handling in object-oriented systems. In: Aksit, M., Matsuoka, S. (eds.) ECOOP 1997. LNCS, vol. 1241, pp. 85–103. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  7. 7.
    Robillard, M.P., Murphy, G.C.: Designing robust JAVA programs with exceptions. In: Proceedings of the 8th ACM SIGSOFT International Symposium on Foundations of Software Engineering. 25, 6, (November 2000). ACM Press (2000)Google Scholar
  8. 8.
    Lippert, M., Lopes, C.: A Study on Exception Detection and Handling Using Aspect-Oriented Programming. In: Proceedings of the 22nd International Conference on Software Engineering, Ireland, ACM Press, New York, NY, USA (2000)Google Scholar
  9. 9.
    Filho, F., Rubira, C., Garcia, A.: A Quantitative Study on the Aspectization of Exception Handling. In: Black, A.P. (ed.) ECOOP 2005. LNCS, vol. 3586, Springer, Heidelberg (2005)Google Scholar
  10. 10.
    Elrad, T., Filman, R.E., Bader, A.: Aspect-Oriented Programming. Communications of the ACM 44(10), 29–32 (2001)CrossRefGoogle Scholar
  11. 11.
    Parr, T.: ANTLR – Another Tool for Language Recognition. University of San Francisco (2006), Available online at: http://www.antlr.org/
  12. 12.
    Javacc -Java Compiler Compiler. Available online at: https://javacc.dev.java.net/
  13. 13.
    Cabral, B., Marques, P., Silva, L.: RAIL: Code Instrumentation for.NET. In: SAC 2005, ACM Press, New York (2005)Google Scholar
  14. 14.
    Chiba, S.: Load-Time Structural Reflection in Java. In: Bertino, E. (ed.) ECOOP 2000. LNCS, vol. 1850, Springer, Heidelberg (2000)CrossRefGoogle Scholar
  15. 15.
    Gosling, J., Joy, B., Steele, G., Bracha, G.: The JAVA Language Specification. Sun Microsystems, Inc., Mountain View, California, USA (2000), ISBN 0-201-31008-21Google Scholar
  16. 16.
    ECMA International. Standard ECMA-335 Common Language Infrastructure(CLI). ECMA Standard (2003), Available online at: http://www.ecma-international.org/publications/standards/ecma-335.htm
  17. 17.
    Goldberg, A., Robson, D.: Smalltalk-80: the language and its implementation. Addison-Wesley Longman Publishing Co., Inc, Boston, MA (1983)MATHGoogle Scholar
  18. 18.
    Meyer, B.: Eiffel: the Language. Prentice-Hall, Inc, Upper Saddle River, NJ, USA (1992)MATHGoogle Scholar
  19. 19.
    Cabral, B., Marques, P.: Making Exception Handling Work. In: Proceedings of the Workshop on Hot Topics in System Dependability (HotDep’06), USENIX, Seattle, USA (November 2006)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2007

Authors and Affiliations

  • Bruno Cabral
    • 1
  • Paulo Marques
    • 1
  1. 1.CISUC, Department of Informatics Engineering, University of CoimbraPortugal

Personalised recommendations