Null pointer exception is a commonly occurring error in Java programs, and many static analysis tools can identify such errors. However, most of existing tools are pure static analysis and suffer from the common problems of the pure static approaches. In this paper, we present a new approach for identifying null dereferences by combining the dynamically generated information (from the stack trace) with the static analysis. Starting at a dereference statement, where the null pointer exception occurred, our approach performs a backward program slicing guided by the stack trace. Then it performs the null identifying analysis and alias analysis on the sliced program. The approach also visualizes the analysis results and the related source codes. Finally, the paper also presents an implementation of the null pointer exception analysis. The results show the advantage of our approach for locating null pointer exception.
Published in:
Quality Software (QSIC), 2012 12th International Conference on
Date of Conference: 27-29 Aug. 2012