@@ -51,6 +51,20 @@ private void reassociateObjectsWithErrors(Map scope) {
5151 if (value instanceof Map ) {
5252 reassociateObjectsWithErrors ((Map )value );
5353 }
54+ reasssociateObjectWithErrors (scope , value );
55+
56+ }
57+ }
58+
59+ private void reasssociateObjectWithErrors (Map scope , Object value ) {
60+ if (value instanceof Collection ) {
61+ Collection values = (Collection )value ;
62+ for (Iterator i = values .iterator (); i .hasNext ();) {
63+ Object current = i .next ();
64+ reasssociateObjectWithErrors (scope , current );
65+ }
66+ }
67+ else {
5468 String errorsKey = ERRORS_PREFIX + System .identityHashCode (value );
5569 Object errors = scope .get (errorsKey );
5670 if (value !=null && errors != null ) {
@@ -59,7 +73,6 @@ private void reassociateObjectsWithErrors(Map scope) {
5973 mc .setProperty (value , ERRORS_PROPERTY , errors );
6074 }
6175 }
62-
6376 }
6477 }
6578
@@ -139,13 +152,23 @@ public Object put(Object key, Object value) {
139152 private void storeErrorsIfPossible (Object value ) {
140153 if (value != null ) {
141154
142- MetaClass mc = GroovySystem .getMetaClassRegistry ().getMetaClass (value .getClass ());
143- if (mc .hasProperty (value , ERRORS_PROPERTY )!=null ) {
144- Object errors = mc .getProperty (value , ERRORS_PROPERTY );
145- if (errors != null ) {
146- next .put (ERRORS_PREFIX + System .identityHashCode (value ), errors );
155+ if (value instanceof Collection ) {
156+ Collection values = (Collection )value ;
157+ for (Iterator i = values .iterator (); i .hasNext ();) {
158+ Object current = i .next ();
159+ storeErrorsIfPossible (current );
160+ }
161+ }
162+ else {
163+ MetaClass mc = GroovySystem .getMetaClassRegistry ().getMetaClass (value .getClass ());
164+ if (mc .hasProperty (value , ERRORS_PROPERTY )!=null ) {
165+ Object errors = mc .getProperty (value , ERRORS_PROPERTY );
166+ if (errors != null ) {
167+ next .put (ERRORS_PREFIX + System .identityHashCode (value ), errors );
168+ }
147169 }
148170 }
171+
149172 }
150173 }
151174
0 commit comments