Hi Georg,

On 21.10.16 16:09, [email protected] wrote:
> Author: gk
> Date: Fri Oct 21 14:09:09 2016
> New Revision: 1766027
> 
> URL: http://svn.apache.org/viewvc?rev=1766027&view=rev
> Log:
> TRB-99 fixed -tested ok: jdk 1.7 and 1.8
[...]
> Modified: 
> turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/model/FieldAdapter.java
> URL: 
> http://svn.apache.org/viewvc/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/model/FieldAdapter.java?rev=1766027&r1=1766026&r2=1766027&view=diff
> ==============================================================================
> --- 
> turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/model/FieldAdapter.java
>  (original)
> +++ 
> turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/model/FieldAdapter.java
>  Fri Oct 21 14:09:09 2016
> @@ -20,7 +20,10 @@ package org.apache.fulcrum.intake.model;
>   */
>  
>  import java.lang.reflect.Constructor;
> +import java.util.ArrayList;
> +import java.util.Arrays;
>  import java.util.HashMap;
> +import java.util.List;
>  import java.util.Map;
>  
>  import javax.xml.bind.annotation.adapters.XmlAdapter;
> @@ -210,6 +213,18 @@ public class FieldAdapter extends XmlAda
>          FieldCtor fieldCtor = null;
>          Field<?> field = null;
>          String type = xmlField.getType();
> +        
> +        List<Rule> rules = xmlField.getRules();
> +        if (rules != null ) 
> +        {
> +        
> +             xmlField.getRuleMap().clear();
> +             Map<String,Rule> ruleMap = xmlField.getRuleMap();
> +             for (Rule rule : rules)
> +             {
> +                 ruleMap.put(rule.getName(), rule);
> +             }
> +        }

I suggest to keep the adapter free of these operations. I'd rather stick
to afterUnmarshal() to complete the data objects. The following is not
necessary then and the scope is kept locally.

>  
>          fieldCtor = fieldCtors.get(type);
>          if (fieldCtor == null)
> @@ -231,9 +246,37 @@ public class FieldAdapter extends XmlAda
>      @Override
>      public Field<?> unmarshal(XmlField xmlField) throws Exception
>      {
> -        return getInstance(xmlField, xmlField.getGroup());
> +     Field<?> field = getInstance(xmlField, xmlField.getGroup());
> +     
> +     processDataInGroupContext(xmlField, field);        
> +     
> +     return field;
[...]

+1 for switching to JUnit 4.

Would you like to see my approach?

Bye, Thomas.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to