DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21091>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21091 RequestUtils.getModulePrefixes needs synchronization Summary: RequestUtils.getModulePrefixes needs synchronization Product: Struts Version: 1.1RC2 Platform: Sun OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: Controller AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] RequestUtils.getModulePrefixes can throw a ConcurrentModificationException if accessed from several threads. The problem is that the code iterates over the attributes names in the ServletContext and adds at the end a new attribute. If 2 threads are executing this code, one will get the exception. Modified fixed code: public static String[] getModulePrefixes(ServletContext context) { String prefixes[] = (String[]) context.getAttribute(PREFIXES_KEY); if (prefixes != null) { return (prefixes); } synchronized (this) { if (prefixes != null) { return (prefixes); } ArrayList list = new ArrayList(); Enumeration names = context.getAttributeNames(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); if (!name.startsWith(Globals.MODULE_KEY)) { continue; } String prefix = name.substring(Globals.MODULE_KEY.length()); if (prefix.length() > 0) { list.add(prefix); } } prefixes = (String[]) list.toArray(new String[list.size()]); context.setAttribute(PREFIXES_KEY, prefixes); } return (prefixes); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]