jun ma wrote: > Dear Tomcat organization: > > I think I find a bug in tomcat, I explain it in the document.The document > is in the attachment. Or I paste it directly following:
I haven't looked at this at all but... It is best if you create a Bugzilla entry for this so it doesn't get lost. Create it for Tomcat 6 since that version is affected and add your test case as an attachment. Cheers, Mark > > When I use logic:iterator(struts) labels in tomcat 4.1.x or later > version(5.x,6.x), I find a problem. This problem don’t appear in tomcat > 4.0.x. > > > > First of all,I will show you the test code: > > > > <!--body> > > This is my test JSP page. <br> > > <% > > HashMap map=*new* HashMap(); > > ArrayList valueList=*new* ArrayList(); > > valueList.add("value"); > > map.put(*new* Integer(1),valueList); > > > > > > ArrayList list=*new* ArrayList(); > > list.add(*new* Integer(1)); > > request.setAttribute("keys",list); > > request.setAttribute("testMap",map); > > *if* (request.getAttribute("keys") != *null*) > > { > > HashMap myMap = (HashMap)request.getAttribute("testMap"); > > %> > > <logic:iterate id="element" name="keys"> > > <% > > Integer myElement = (Integer)element; > > List myList = (List)myMap.get(myElement); > > *if* (myList == *null* || myList.size() <= 1) > > { > > System.out.println("test!!!"); > > *continue*; > > } > > %> > > </logic:iterate> > > <% > > } > > %> > > </body--> > > > > When I put the code in the a jsp file(index.jsp), start the tomcat 5.x > server and access the page(index.jsp), the console prints the “test!!!” > endlessly. But if I excute the same code in tomcat 4.0.1,the “test!!!” only > prints one time. > > > > So I try to find out the reason, and finally I find that it is the JSP > compiler that cause the problem. When I compare the java code generated by > the two compilers,I find the result of compiling the logic:iterator(struts) > is not the same. > > In tomcat 4.0.1, it like this: > > *code 1* > > *do{* > > *…….//omitted codes* > > *if** (myList == **null** || myList.size() <= 1)*** > > *{*** > > * System.out.println(**"test!!!"**);*** > > * **continue**;*** > > *}*** > > *……//still omit* > > * * > > *} while (_jspx_th_logic_iterate_0.doAfterBody() == > javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN);* > > > > But in tomcat 5.x,it becomes: > > *code 2* > > *do{* > > *…….//omitted codes* > > *if** (myList == **null** || myList.size() <= 1)*** > > *{*** > > * System.out.println(**"test!!!"**);*** > > * **continue**;*** > > *}*** > > *……//still omit* > > * * > > *if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)* > > * break;* > > *} while (true);* > > > > In code 2,when the code is excuted the “*continue*” statement, it jumps to > the “*while(true)*”. Again, the “*continue*” is excuted, angain the “* > while(true)*”. So we encounters the Endless loop. > > > > But in code 1, the problem is noe exist. You see, when the “*continue*” > statement is excuted, it jumps to the “*while > (_jspx_th_logic_iterate_0.doAfterBody() == > javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)*”. It then break the while > loop. > > > I test the code in tomcat 4.0.1, tomcat 4.1.40, tomcat 5.5.27, and tomcat > 6.0.20. It seems that the code works normally only in tomcat 4.0.1. > > > Thank you for reading my letter.Looking forward to hearing from you. > > > > > Your sincerely, Ma Jun > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org