Changing Java's Semantics for Handling Null Pointer Exceptions

We envision a world where no exceptions are raised; instead, language semantics are changed so that operations are total functions. Either an operation executes normally or tailored recovery code is applied where exceptions would have been raised. As an initial step and evaluation of this idea, we propose to transform programs so that null pointer dereferences are handled automatically without a large runtime overhead. We increase robustness by replacing code that raises null pointer exceptions with error-handling code, allowing the program to continue execution. Our technique first finds potential null pointer dereferences and then automatically transforms programs to insert null checks and error-handling code. These transformations are guided by composable, context-sensitive recovery policies. Error-handling code may, for example, create default objects of the appropriate types, or restore data structure invariants. If no null pointers would be dereferenced, the transformed program behaves just as the original.We applied our transformation in experiments involving multiple benchmarks, the Java Standard Library, and externally reported null pointer exceptions. Our technique was able to handle the reported exceptions and allow the programs to continue to do useful work, with an average execution time overhead of less than 1% and an average bytecode space overhead of 22%.

[1]  Ronald Morrison,et al.  Orthogonally persistent object systems , 1995, The VLDB Journal.

[2]  Jonathan Aldrich,et al.  Practical Exception Specifications , 2006, Advanced Topics in Exception Handling Techniques.

[3]  R. Kerr,et al.  Recovery blocks in action: A system supporting high reliability , 1976, ICSE '76.

[4]  Jedrzej Fulara,et al.  Propagation of JML non-null annotations in Java programs , 2006, PPPJ '06.

[5]  David Hovemeyer,et al.  Evaluating and tuning a static analysis to find null pointer bugs , 2005, PASTE '05.

[6]  Angelos D. Keromytis,et al.  Building a Reactive Immune System for Software Services , 2005, USENIX Annual Technical Conference, General Track.

[7]  Donald Yeung,et al.  Exploiting Soft Computing for Increased Fault Tolerance , 2006 .

[8]  Wolfgang Keller Mapping Objects to Tables A Pattern Language , 1997 .

[9]  Peter M. Chen,et al.  Discount Checking: Transparent, Low-Overhead Recovery for General Applications , 1998 .

[10]  Liuba Shrira,et al.  Lazy modular upgrades in persistent object stores , 2003, OOPSLA.

[11]  Saurabh Sinha,et al.  Criteria for testing exception-handling constructs in Java programs , 1999, Proceedings IEEE International Conference on Software Maintenance - 1999 (ICSM'99). 'Software Maintenance for Business Change' (Cat. No.99CB36360).

[12]  G. Kiczales,et al.  Aspect-oriented programming and modular reasoning , 2005, Proceedings. 27th International Conference on Software Engineering, 2005. ICSE 2005..

[13]  Michael I. Jordan,et al.  Bug isolation via remote program sampling , 2003, PLDI.

[14]  Dawson R. Engler,et al.  Checking system rules using system-specific, programmer-written compiler extensions , 2000, OSDI.

[15]  Laurie Hendren,et al.  Soot---a java optimization framework , 1999 .

[16]  William G. Griswold,et al.  Quickly detecting relevant program invariants , 2000, Proceedings of the 2000 International Conference on Software Engineering. ICSE 2000 the New Millennium.

[17]  Pankaj Jalote,et al.  List of Common Bugs and Programming Practices to avoid them , 2005 .

[18]  Chen Fu,et al.  Robustness testing of Java server applications , 2005, IEEE Transactions on Software Engineering.

[19]  Greg Nelson,et al.  Simplification by Cooperating Decision Procedures , 1979, TOPL.

[20]  Frank B. Schmuck,et al.  Experience with transactions in QuickSilver , 1991, SOSP '91.

[21]  Stephen McCamant,et al.  The Daikon system for dynamic detection of likely invariants , 2007, Sci. Comput. Program..

[22]  David Hovemeyer,et al.  Finding bugs is easy , 2004, SIGP.

[23]  Martin Rinard,et al.  Automatic detection and repair of errors in data structures , 2003, OOPSLA 2003.

[24]  Dieter Hutter,et al.  A Pragmatic Approach to Reuse in Tactical Theorem Proving , 2001, Electron. Notes Theor. Comput. Sci..

[25]  Jonathan M. Smith,et al.  EROS: a fast capability system , 1999, SOSP.

[26]  Martin Rinard,et al.  Automatic Data Structure Repair for Self-Healing Systems , 2003 .

[27]  David H. Lorenz,et al.  Awesome: an aspect co-weaving system for composing multiple aspect-oriented extensions , 2007, OOPSLA.

[28]  Martin C. Rinard Probabilistic accuracy bounds for fault-tolerant computations that discard tasks , 2006, ICS '06.

[29]  K. Rustan M. Leino,et al.  An Extended Static Checker for Modular-3 , 1998, CC.

[30]  Sorin Lerner,et al.  ESP: path-sensitive program verification in polynomial time , 2002, PLDI '02.

[31]  Amer Diwan,et al.  The DaCapo benchmarks: java benchmarking development and analysis , 2006, OOPSLA '06.

[32]  Wolfgang Graetsch,et al.  Fault tolerance under UNIX , 1989, TOCS.

[33]  Eran Yahav,et al.  Effective typestate verification in the presence of aliasing , 2006, TSEM.

[34]  Jason Hickey,et al.  Extensible Hierarchical Tactic Construction in a Logical Framework , 2004, TPHOLs.

[35]  Daniel M. Roy,et al.  Enhancing Server Availability and Security Through Failure-Oblivious Computing , 2004, OSDI.

[36]  Sriram K. Rajamani,et al.  Automatically validating temporal safety properties of interfaces , 2001, SPIN '01.

[37]  Fausto Giunchiglia,et al.  Program tactics and logic tactics , 1994, Annals of Mathematics and Artificial Intelligence.

[38]  Martin Rinard,et al.  Acceptability-oriented computing , 2003, SIGP.

[39]  David A. Wagner,et al.  Model Checking One Million Lines of C Code , 2004, NDSS.

[40]  Peter M. Chen,et al.  Exploring failure transparency and the limits of generic recovery , 2000, OSDI.

[41]  Thomas A. Henzinger,et al.  Lazy abstraction , 2002, POPL '02.

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

[43]  Arthur van Hoff The Case for Java as a Programming Language , 1997, IEEE Internet Comput..

[44]  George C. Necula,et al.  Finding and preventing run-time error handling mistakes , 2004, OOPSLA.

[45]  Yi-Min Wang,et al.  Xept: a software instrumentation method for exception handling , 1997, Proceedings The Eighth International Symposium on Software Reliability Engineering.

[46]  Westley Weimer,et al.  Patches as better bug reports , 2006, GPCE '06.

[47]  M. F.,et al.  Bibliography , 1985, Experimental Gerontology.

[48]  Andrew M. Tyrrell Recovery blocks and algorithm-based fault tolerance , 1996, Proceedings of EUROMICRO 96. 22nd Euromicro Conference. Beyond 2000: Hardware and Software Design Strategies.