DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=40356>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40356 Summary: expressions in XML attributes evaluated in wrong order Product: Tomcat 5 Version: 5.5.17 Platform: All OS/Version: All Status: NEW Severity: minor Priority: P3 Component: Jasper AssignedTo: tomcat-dev@jakarta.apache.org ReportedBy: [EMAIL PROTECTED] I am trying to run an application that worked fine on Tomcat 4.1 and encounter the following problem on Tomcat 5.5. I have a JSP using a custom tag and which has expressions in its attributes: <vsi:loop begin="%= last - s %" end="%= last++ %" /> I expect the expressions to be evaluated left to right: "last - s" is passed to the first attribute, "last" to the second, and in the next line of code variable "last" will have been increased by one. This works fine on Tomcat 4.1. However, on Tomcat 5.5 it passed "last - s + 1" to the first attribute. I discovered the generated code for the JSP is different. Tomcat 4.1: _jspx_th_vsi_loop_2.setBegin(last - s); _jspx_th_vsi_loop_2.setEnd(last++); Tomcat 5.5: _jspx_th_vsi_loop_2.setEnd(last++); _jspx_th_vsi_loop_2.setBegin(last - s); This JSP is a JSP Document (XML base), for a "normal" JSP the order has not changed since Tomcat 4.1. The following change seems to be the cause: Before: int len = attrs.getLength(); for (int i=0; i<len; i++) { After: /* * Notice that due to a bug in the underlying SAX parser, the * attributes must be enumerated in descending order. */ for (int i = attrs.getLength() - 1; i >= 0; i--) { Revision: 305679 Author: luehe Date: 8:26:50, 2003年4月22日 Message: Due to a bug in the underlying SAX parser, the XML attributes must be enumerated in descending order. When enumerated in ascending order, qName may be null, causing NPE. (This sucks!) ---- Modified : /tomcat/jasper/trunk/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java I could not find any more details, but I wonder if the bug in the underlying SAX parser was that it returned attributes in opposite order and that this has been fixed (breaking the order again). I don't know how the NPE fits in, though. It seems this issue has been brought up in the Tomcat dev ML before, but received no replies. http://mail-archives.apache.org/mod_mbox/tomcat-dev/200402.mbox/[EMAIL PROTECTED] -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]