I am having findbugs error for the below code,
if( obj instanceof CustomerData )
{
CustomerData customerData = (CustomerData)obj;
if (customerData == null)
{
errors.reject("Error", "Null data received");
}
}
Error Desc:
Redundant nullcheck of obj, which is known to be non-null in (Package and Method name, I have removed due to security violation)
This method contains a redundant check of a known non-null value against the constant null.
Please let me know what is the error in here.
instanceof
returns false if the argument is null
. So you don't need another check.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With