Bug 55108 - Wasted work in "AbstractReplicatedMap.excludeFromSet"
Wasted work in "AbstractReplicatedMap.excludeFromSet"
Product: Tomcat 7
Classification: Unclassified
Component: Catalina
PC Linux
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
: PatchAvailable
Depends on:
  Show dependency tree
Reported: 2013-06-17 18:12 UTC by Adrian Nistor
Modified: 2013-06-18 07:55 UTC (History)
1 user (show)

patch (699 bytes, patch)
2013-06-17 18:12 UTC, Adrian Nistor
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Nistor 2013-06-17 18:12:00 UTC
Created attachment 30448 [details]

The problem appears in version 7.0.41 and in revision 1493861.  I
attached a one-line patch that fixes it.

In method "AbstractReplicatedMap.excludeFromSet", the loop over "mbrs"
should break immediately after "include" is set to "false".  All the
iterations after "include" is set to "false" do not perform any useful
work, at best they just set "include" again to "false".

Method "inSet" in the same class "AbstractReplicatedMap" (right above
the definition of "excludeFromSet") has a similar loop (over "set"),
and this loop breaks immediately after "result" is set to "true", just
like in the proposed patch.  Other methods (e.g.,
"MapperListener.findDefaultHost", "CollectVisitor.checkSeen",
"JspDocumentParser.processChars", "ParameterParser.isOneOf") also have
similar loops with similar breaks, just like in the proposed patch.
Comment 1 Mark Thomas 2013-06-18 07:55:37 UTC
Thanks for the patch. It has been applied to trunk and 7.0.x and will be included in 7.0.42 onwards.