We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Helpful NullPointerExceptions - The little thing that became a JEP

Formal Metadata

Title
Helpful NullPointerExceptions - The little thing that became a JEP
Title of Series
Number of Parts
490
Author
License
CC Attribution 2.0 Belgium:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
One of the most prevalent - if not the most prevalent - exception type in Java is the NullPointerException. While Java set out to overcome the possibilities to do the mistakes one can do when programming in languages like C/C++ by not exposing pointers in the Java language, the misleading term 'pointer' sneaked into this exception. To this day, NullPointerExceptions thrown by the runtime system didn't contain messages. All you had was a callstack and a line number. But in typical expressions and statements there are several dereferences where an NPE can occur in one line. We - some engineers in the SAP team - thought this could be helped by a little enhancement. The new NPE message gives precise information about the location and tries to explain what was going on when a null reference was encountered. However, due to its prominent nature, it eventually became a JEP. In my talk I'll demonstrate the improvements that come with this enhancement. I will lift the hood a little and provide a glance at its implementation details. And finally I'll say some words about the current status and share some ideas for further improvements in the area of exception messages.