Bug 50601 - Redundant null checks before instanceof in equals()
Redundant null checks before instanceof in equals()
Status: RESOLVED FIXED
Product: Tomcat 7
Classification: Unclassified
Component: Catalina
trunk
All All
: P2 enhancement (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2011-01-17 08:54 UTC by Sebb
Modified: 2011-01-19 14:08 UTC (History)
0 users



Attachments
Patch to remove null checks (3.16 KB, patch)
2011-01-17 08:54 UTC, Sebb
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.