1 Reply Latest reply on Jul 11, 2006 3:57 AM by Koen Aers

    problem in FieldInstansiator

    Shai Bentin Newbie

      My project is using Java5 and we're trying to use JBpm with it.

      I created a Delegation to Actionhandler that accepts a HashMap as a field.

      The definition had;

      <requestParams>
       <entity><key>somekey</key><value>someValue</value></entity>
      </requestParams>
      


      This caused an exception. After looking into the code I found that in getValue, lines 134 to 141


      else if (type.isAssignableFrom(List.class)) {
       value = getCollection(propertyElement, new ArrayList());
       } else if (type.isAssignableFrom(Set.class)) {
       value = getCollection(propertyElement, new HashSet());
       } else if (type.isAssignableFrom(Collection.class)) {
       value = getCollection(propertyElement, new ArrayList());
       } else if (type.isAssignableFrom(Map.class)) {
       value = getMap(propertyElement, new HashMap());


      In java 5 there is a problem with such check and thus this code should be:

      else if (List.class.isAssignableFrom(type)) {
       value = getCollection(propertyElement, new ArrayList());
       } else if (Set.class.isAssignableFrom(type)) {
       value = getCollection(propertyElement, new HashSet());
       } else if (Collection.class.isAssignableFrom(type)) {
       value = getCollection(propertyElement, new ArrayList());
       } else if (Map.class.isAssignableFrom(type)) {
       value = getMap(propertyElement, new HashMap());
      


      After changing the code it worked for me....