Bug 50601 - Redundant null checks before instanceof in equals()
Summary: Redundant null checks before instanceof in equals()
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: trunk
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
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.