Bug 58534 - Repeated Conditional Test
Summary: Repeated Conditional Test
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: WebSocket (show other bugs)
Version: 8.0.x-trunk
Hardware: Macintosh Mac OS X 10.1
: P2 trivial (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-25 19:19 UTC by Anthony Whitford
Modified: 2015-10-27 13:55 UTC (History)
0 users



Attachments
Patch to remove repeated conditional tests (2.50 KB, patch)
2015-10-25 19:20 UTC, Anthony Whitford
Details | Diff
Patch for similar problem for AprEndpoint (2.46 KB, patch)
2015-10-25 19:25 UTC, Anthony Whitford
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Whitford 2015-10-25 19:19:46 UTC
In org.apache.tomcat.websocket.pojo.PojoMethodMapping, there are cases like this:

    if (currentClazz == clazzPojo ||
        (currentClazz != clazzPojo && !isMethodOverride(open, method))) {


The clause 'currentClazz != clazzPojo' is redundant since we know 'currentClazz == clazzPojo' is false.


This is repeated several times.
Comment 1 Anthony Whitford 2015-10-25 19:20:50 UTC
Created attachment 33208 [details]
Patch to remove repeated conditional tests
Comment 2 Anthony Whitford 2015-10-25 19:25:04 UTC
Created attachment 33209 [details]
Patch for similar problem for AprEndpoint

I discovered the same problem with org.apache.tomcat.util.net.AprEndpoint, so please see the second patch too.
Comment 3 Violeta Georgieva 2015-10-27 13:55:44 UTC
Hi,

Thanks for the report and the patch.
The fix is available in trunk, 8.0.x (for 8.0.29 onwards) and 7.0.x (for 7.0.66
onwards)

Regards,
Violeta