Bug 58534 - Repeated Conditional Test
Repeated Conditional Test
Status: RESOLVED FIXED
Product: Tomcat 8
Classification: Unclassified
Component: WebSocket
8.0.x-trunk
Macintosh Mac OS X 10.1
: P2 trivial (vote)
: ----
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
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