Bug 50601

Summary: Redundant null checks before instanceof in equals()
Product: Tomcat 7 Reporter: Sebb <sebb>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Severity: enhancement    
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Patch to remove null checks

Description Sebb 2011-01-17 08:54:21 UTC
Created attachment 26497 [details]
Patch to remove null checks

There are several instances of the following code in equals methods:

if (obj == null) return false;
if (!(obj instanceof SomeClass)) return false;

The null check is redundant, as null will fail the instanceof check.
Comment 1 Mark Thomas 2011-01-19 14:08:44 UTC
Fixed in 7.0.x and will be included in 7.0.7 onwards.