https://issues.apache.org/bugzilla/show_bug.cgi?id=55159
Bug ID: 55159
Summary: Wasted work in
ErrorReportValve.getPartialServletStackTrace
Product: Tomcat 7
Version: 7.0.41
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
Assignee: [email protected]
Reporter: [email protected]
Created attachment 30499
--> https://issues.apache.org/bugzilla/attachment.cgi?id=30499&action=edit
patch
The problem appears in version 7.0.41 and in revision 1497999. I
attached a two-line patch (patch.diff) that fixes it.
In method "ErrorReportValve.getPartialServletStackTrace", the loop
over "elements" keeps overriding "pos" with "i". Therefore, only the
last written value is visible out of the loop and all the other writes
and iterations are not necessary. The patch iterates from the end of
"elements" and breaks the first time when "pos" is set.
The above fix (in patch.diff) is certainly correct (it's easy to see
through code inspection), but I think we can have an even shorter
patch (one line, in patchShort.diff): just break as soon as "pos" is
set, without reversion the loop order. patchShort.diff is correct
only if there can be only one "elements[i]" with class name
"org.apache.catalina.core.ApplicationFilterChain" and method name
"internalDoFilter" or if it doesn't matter which such "elements[i]" is
detected (the last, like in the original code, or the first, like in
patchShort.diff).
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]