Bug 55109 - Wasted work in "WebdavServlet.isLocked"
Summary: Wasted work in "WebdavServlet.isLocked"
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 7.0.41
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Keywords: PatchAvailable
Depends on:
Reported: 2013-06-17 18:24 UTC by Adrian Nistor
Modified: 2013-06-18 07:29 UTC (History)
1 user (show)

patch (1.17 KB, patch)
2013-06-17 18:24 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:24:46 UTC
Created attachment 30449 [details]

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

In method "WebdavServlet.isLocked", the two loops over "tokenList"
should break immediately after "tokenMatch" is set to "true".  All the
iterations after "tokenMatch" is set to "true" do not perform any
useful work, at best they just set "tokenMatch" again to "true".

Method "startInternal" in class "StandardHost" has a similar loop
(over "valves"), and this loop breaks immediately after "found" 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:29:54 UTC
Thanks for the patch. It has been applied to trunk and 7.0.x and will be included in 7.0.42 onwards.