Joe's Java and Web Jottings

your host


Your Host

Calendar

««Nov 2009»»
SMTWTFS
1234567
891011121314
15161718192021
22232425262728
2930

My Top Tags

               

Java Libs and Tools

My Other Pages

My RSS Feeds








Bugs I'm Tired of Seeing

posted Wednesday, 21 April 2004
System.out.println(someObject.toString());

Ugh. 1) redundant. 2) buggy. serious codesmell (tm)

why is it buggy? if someObject is null, you have NullPointerException. if you didn't have the toString() call, println() would safely print null for you.

I'm gonna fidget with PMD's syntax and see if I can make a rule for it.




1. a reader left...
Thursday, 20 May 2004 9:25 am

Just make *all* direct calls to toString() errors: http://www.brunningonline.net/simon/blog/archives/000793.html

Simon Brunning [simon@brunningonline.net]