Program: 175918
Project: 175918
Buggy source:
/** 
 * It manufactures and returns a Map with at least one element in it
 * @param pojo The POJO being initialized
 * @param manufacturingCtx the manufacturing context
 * @param attributeMetadata The attribute's metadata
 * @param typeArgsMap a map relating the generic class arguments ("&lt;T, V&gt;" for example) with their actual types
 * @return Map with at least one element in it
 * @throws IllegalArgumentException <ul> <li>If the attribute name is null or empty</li> <li>If the array of types of the Map has length different from 2</li> </ul>
 * @throws PodamMockeryException If an error occurred while creating the Map object
 */
private Map<? super Object,? super Object> resolveMapValueWhenMapIsPojoAttribute(Object pojo,ManufacturingContext manufacturingCtx,AttributeMetadata attributeMetadata,Map<String,Type> typeArgsMap){
  String attributeName=attributeMetadata.getAttributeName();
  Map<Object,Object> defaultValue=null;
  if (null != pojo && null != attributeName) {
    defaultValue=PodamUtils.getFieldValue(pojo,attributeName);
  }
  Map<Object,Object> retValue;
  if (null != defaultValue && (defaultValue.getClass().getModifiers() & Modifier.PRIVATE) == 0) {
    retValue=defaultValue;
  }
 else {
    @SuppressWarnings("String_Node_Str") Class<Map<Object,Object>> mapType=(Class<Map<Object,Object>>)attributeMetadata.getAttributeType();
    retValue=strategy.getTypeValue(attributeMetadata,typeArgsMap,mapType);
    if (null != retValue && null != defaultValue) {
      retValue.putAll(defaultValue);
    }
  }
  if (null == retValue) {
    return null;
  }
  try {
    Class<?> keyClass=null;
    Class<?> elementClass=null;
    AtomicReference<Type[]> keyGenericTypeArgs=new AtomicReference<Type[]>(PodamConstants.NO_TYPES);
    AtomicReference<Type[]> elementGenericTypeArgs=new AtomicReference<Type[]>(PodamConstants.NO_TYPES);
    if (ArrayUtils.isEmpty(attributeMetadata.getAttrGenericArgs())) {
      MapArguments mapArgs=findInheretedMapElementType(retValue,manufacturingCtx,typeArgsMap,attributeMetadata.getAttrGenericArgs());
      keyClass=mapArgs.getKeyClass();
      elementClass=mapArgs.getElementClass();
    }
 else {
      if (attributeMetadata.getAttrGenericArgs().length != 2) {
        throw new IllegalStateException("String_Node_Str" + "String_Node_Str" + Arrays.toString(attributeMetadata.getAttrGenericArgs()));
      }
      Type[] actualTypeArguments=attributeMetadata.getAttrGenericArgs();
      keyClass=TypeManufacturerUtil.resolveGenericParameter(actualTypeArguments[0],typeArgsMap,keyGenericTypeArgs);
      elementClass=TypeManufacturerUtil.resolveGenericParameter(actualTypeArguments[1],typeArgsMap,elementGenericTypeArgs);
    }
    MapArguments mapArguments=new MapArguments();
    mapArguments.setAttributeName(attributeName);
    mapArguments.setAnnotations(attributeMetadata.getAttributeAnnotations());
    mapArguments.setMapToBeFilled(retValue);
    mapArguments.setKeyClass(keyClass);
    mapArguments.setElementClass(elementClass);
    mapArguments.setKeyGenericTypeArgs(keyGenericTypeArgs.get());
    mapArguments.setElementGenericTypeArgs(elementGenericTypeArgs.get());
    fillMap(mapArguments,manufacturingCtx);
  }
 catch (  InstantiationException e) {
    throw new PodamMockeryException(MAP_CREATION_EXCEPTION_STR,e);
  }
catch (  IllegalAccessException e) {
    throw new PodamMockeryException(MAP_CREATION_EXCEPTION_STR,e);
  }
catch (  SecurityException e) {
    throw new PodamMockeryException(MAP_CREATION_EXCEPTION_STR,e);
  }
catch (  ClassNotFoundException e) {
    throw new PodamMockeryException(MAP_CREATION_EXCEPTION_STR,e);
  }
catch (  InvocationTargetException e) {
    throw new PodamMockeryException(MAP_CREATION_EXCEPTION_STR,e);
  }
  return retValue;
}

Fixed version (ground truth):
/** 
 * It manufactures and returns a Map with at least one element in it
 * @param pojo The POJO being initialized
 * @param manufacturingCtx the manufacturing context
 * @param attributeMetadata The attribute's metadata
 * @param typeArgsMap a map relating the generic class arguments ("&lt;T, V&gt;" for example) with their actual types
 * @return Map with at least one element in it
 * @throws IllegalArgumentException <ul> <li>If the attribute name is null or empty</li> <li>If the array of types of the Map has length different from 2</li> </ul>
 * @throws PodamMockeryException If an error occurred while creating the Map object
 */
private Map<? super Object,? super Object> resolveMapValueWhenMapIsPojoAttribute(Object pojo,ManufacturingContext manufacturingCtx,AttributeMetadata attributeMetadata,Map<String,Type> typeArgsMap){
  String attributeName=attributeMetadata.getAttributeName();
  Map<Object,Object> defaultValue=null;
  if (null != pojo && !Character.isDigit(attributeName.charAt(0))) {
    defaultValue=PodamUtils.getFieldValue(pojo,attributeName);
  }
  Map<Object,Object> retValue;
  if (null != defaultValue && (defaultValue.getClass().getModifiers() & Modifier.PRIVATE) == 0) {
    retValue=defaultValue;
  }
 else {
    @SuppressWarnings("String_Node_Str") Class<Map<Object,Object>> mapType=(Class<Map<Object,Object>>)attributeMetadata.getAttributeType();
    retValue=strategy.getTypeValue(attributeMetadata,typeArgsMap,mapType);
    if (null != retValue && null != defaultValue) {
      retValue.putAll(defaultValue);
    }
  }
  if (null == retValue) {
    return null;
  }
  try {
    Class<?> keyClass=null;
    Class<?> elementClass=null;
    AtomicReference<Type[]> keyGenericTypeArgs=new AtomicReference<Type[]>(PodamConstants.NO_TYPES);
    AtomicReference<Type[]> elementGenericTypeArgs=new AtomicReference<Type[]>(PodamConstants.NO_TYPES);
    if (ArrayUtils.isEmpty(attributeMetadata.getAttrGenericArgs())) {
      MapArguments mapArgs=findInheretedMapElementType(retValue,manufacturingCtx,typeArgsMap,attributeMetadata.getAttrGenericArgs());
      keyClass=mapArgs.getKeyClass();
      elementClass=mapArgs.getElementClass();
    }
 else {
      if (attributeMetadata.getAttrGenericArgs().length != 2) {
        throw new IllegalStateException("String_Node_Str" + "String_Node_Str" + Arrays.toString(attributeMetadata.getAttrGenericArgs()));
      }
      Type[] actualTypeArguments=attributeMetadata.getAttrGenericArgs();
      keyClass=TypeManufacturerUtil.resolveGenericParameter(actualTypeArguments[0],typeArgsMap,keyGenericTypeArgs);
      elementClass=TypeManufacturerUtil.resolveGenericParameter(actualTypeArguments[1],typeArgsMap,elementGenericTypeArgs);
    }
    MapArguments mapArguments=new MapArguments();
    mapArguments.setAttributeName(attributeName);
    mapArguments.setAnnotations(attributeMetadata.getAttributeAnnotations());
    mapArguments.setMapToBeFilled(retValue);
    mapArguments.setKeyClass(keyClass);
    mapArguments.setElementClass(elementClass);
    mapArguments.setKeyGenericTypeArgs(keyGenericTypeArgs.get());
    mapArguments.setElementGenericTypeArgs(elementGenericTypeArgs.get());
    fillMap(mapArguments,manufacturingCtx);
  }
 catch (  InstantiationException e) {
    throw new PodamMockeryException(MAP_CREATION_EXCEPTION_STR,e);
  }
catch (  IllegalAccessException e) {
    throw new PodamMockeryException(MAP_CREATION_EXCEPTION_STR,e);
  }
catch (  SecurityException e) {
    throw new PodamMockeryException(MAP_CREATION_EXCEPTION_STR,e);
  }
catch (  ClassNotFoundException e) {
    throw new PodamMockeryException(MAP_CREATION_EXCEPTION_STR,e);
  }
catch (  InvocationTargetException e) {
    throw new PodamMockeryException(MAP_CREATION_EXCEPTION_STR,e);
  }
  return retValue;
}