After finding my second bug in production code with a NullPointerException being thrown if data is not passed into the bean, I wonder if there is a product out there that will point these out during either development or build time? IE: trying to do a .toUpperCase() on a NULL string. I am using Ant to build as well as Eclipse 3.0 to develop. Anyone know of anything? How is FindBugs with this?
Posted by doug at January 14, 2005 01:49 PM | TrackBackWhich IDE do you use? With IDEA together with InspectionGadgets, most potentially buggy scenarios would be flagged. But a general defensive strategy that works better for me is to check for null always, at every point where a pointer could be null.
Posted by: Sumit at January 14, 2005 01:56 PMI am using Eclipse to develop, or VIM sometimes. The default for Eclipse seems to not want to warn about potential bugs, only unused variables and errors. Is there an extension/plugin that will handle this?
Consider voting for it.
Add Nice Option types to Java to prevent NullPointerExceptions
Add a detector for null arguments
I'm not necessarily looking for a compile failure if there is the possibility of an NPE (although that obviously has it's advantages). I would just like a warning during coding time, or maybe even compile, that I could possibly be introducing an NPE.
Posted by: doug at January 15, 2005 05:42 PMI have an AOP approach that uses AspectJ that I detailed in my blog entry "Implementing the Null Object Pattern using AOP"
I wouldn't call it production ready code, but it can come in handy when debugging NPE problems.
Posted by: Dale Asberry at January 18, 2005 06:28 PMLooks like I lost the URL: http://www.artima.com/weblogs/viewpost.jsp?thread=43091
Posted by: Dale Asberry at January 18, 2005 06:30 PM