You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2003/11/26 16:13:56 UTC
DO NOT REPLY [Bug 25019] New: -
ConcurrentModificationException thrown in ValidatorResources
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=25019>.
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=25019
ConcurrentModificationException thrown in ValidatorResources
Summary: ConcurrentModificationException thrown in
ValidatorResources
Product: Commons
Version: 1.0 Alpha
Platform: All
OS/Version: All
Status: NEW
Severity: Minor
Priority: Other
Component: Validator
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: paul_rice@lbss.com
In ValidatorResources processForms(), where the browser locale differs from the
default locale, the following code is entered:
// Skip default FormSet
if (key.equals(defaultKey)) {
continue;
}
====>
List formsets = (List) hFormSets.get(key);
Iterator formsetsIterator = formsets.iterator();
while (formsetsIterator.hasNext()) {
FormSet fs = (FormSet) formsetsIterator.next();
// Loop through Forms and copy/clone fields from default locale
for (Iterator x = fs.getForms().keySet().iterator(); x.hasNext();) {
String formKey = (String) x.next();
Form form = (Form) fs.getForms().get(formKey);
// Create a new Form object so the order from the default is
// maintained (very noticable in the JavaScript).
Form newForm = new Form();
newForm.setName(form.getName());
// Loop through the default locale form's fields
// If they don't exist in the current locale's form, then clone them.
Form defaultForm = get(defaultLocale, formKey);
for (Iterator defaultFields = defaultForm.getFields().iterator();
defaultFields.hasNext();
) {
Field defaultField = (Field) defaultFields.next();
String fieldKey = defaultField.getKey();
if (form.getFieldMap().containsKey(fieldKey)) {
newForm.addField(
(Field) form.getFieldMap().get(fieldKey));
} else {
Field field =
getClosestLocaleField(fs, formKey, fieldKey);
newForm.addField((Field) field.clone());
}
}
********> fs.addForm(newForm);
}
as can be seen above, the form is added to the FormSet within the iteration
and this causes a ConcurrentModificationException.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org