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=27992>. 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=27992 FIFO ordering in ActionErrors Summary: FIFO ordering in ActionErrors Product: Struts Version: Nightly Build Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: Controller AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] I had posted to the struts-user list at: http://www.mail-archive.com/[EMAIL PROTECTED]/msg97016.html and struts-dev list at: http://marc.theaimsgroup.com/?l=struts-dev&m=108031774812299&w=2 I think I may have discovered a bug in src/share/org/apache/struts/action/ActionMessages.java ActionMessages are supposed to have FIFO ordering (as evidenced by the presenence of property iOrder in the class ActionMessageItem). However, I discovered a case whereby the ActionMessages would lose their order. Let's say validator returned some errors (I'll only show property keys and their order): {postalCode[Order=1],number[Order=0]} As you can see they are in a weird order which is okay since its a HashMap and order is not guaranteed. Now, if I created another ActionErrors object with only 1 message: {org.apache.struts.action.GLOBAL_MESSAGE[Order=0]} and then tried to add using something like: newErrors.add(oldErrors); it would correclty keep the order and it would become something like: {postalCode[Order=1],org.apache.struts.action.GLOBAL_MESSAGE[Order=0],number[Order=2]} So, struts is behaving correctly so far. It kept the order of the GLOBAL_MESSAGE 0 and created higher sequential order numbers for the other 2 added properties. However, unfortunately there are several other places later on in the struts sequence where an empty ActionErrors object is combined with what was returned from the validate() method. And this is where, automagically, the Order numbers start their sequencing all over again and become: {postalCode[Order=0],org.apache.struts.action.GLOBAL_MESSAGE[Order=1],number[Order=2]} The reason for this is that the properties() method only sends back an iterator to the unsorted HashMap. Instead it should send something back which is sorted according to the order of the properties (similar to how its done in the get() method). --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]