Bug 55073 - wasted work in ValidateVisitor.isExpression()
wasted work in ValidateVisitor.isExpression()
Product: Tomcat 7
Classification: Unclassified
Component: Jasper
PC Linux
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
: PatchAvailable
Depends on:
  Show dependency tree
Reported: 2013-06-07 14:23 UTC by Adrian Nistor
Modified: 2013-06-18 08:05 UTC (History)
1 user (show)

patch (823 bytes, patch)
2013-06-07 14:23 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-07 14:23:24 UTC
Created attachment 30404 [details]

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

In method "ValidateVisitor.isExpression", the loop over "nodes" should
break immediately after "elExpression" is set to "true".  All the
iterations after "elExpression" is set to "true" do not perform any
useful work, at best they just set "elExpression" 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 08:05:21 UTC
Thanks for the patch. It has been applied to trunk and 7.0.x and will be included in 7.0.42 onwards.