Cool, let me post an answer to your post over on the PMD forums:
http://sourceforge.net/forum/forum.php?thread_id=1264379&forum_id=188192
Yours,
Tom
Showing messages 1 through 2 of 2.
Before invoking any method of an object, a null check should be done.
Eg:
String str1 = null;
String str2 = "ASP";
str2 = str1.toUpperCase(); // Which will throw NullPointerException.
So I have to ensure that this line is in the if check. Like,
String str1 = null;
String str2 = "ASP";
if(str1 != null)
{
str2 = str1.toUpperCase();
}
Any help would be appreciated. Which would be better a Java rule or XPATH rule?