Program: 175917
Project: 175917
Buggy source:
/** 
 * It returns a collection of some sort with some data in it.
 * @param pojo The POJO being analyzed
 * @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 a collection of some sort with some data in it
 * @throws PodamMockeryException An exception occurred while resolving the collection
 * @throws IllegalArgumentException If the field name is null or empty
 */
private Collection<? super Object> resolveCollectionValueWhenCollectionIsPojoAttribute(Object pojo,ManufacturingContext manufacturingCtx,AttributeMetadata attributeMetadata,Map<String,Type> typeArgsMap){
  String attributeName=attributeMetadata.getAttributeName();
  Collection<Object> defaultValue=null;
  if (null != pojo && null != attributeName) {
    defaultValue=PodamUtils.getFieldValue(pojo,attributeName);
  }
  Collection<Object> retValue=null;
  if (null != defaultValue && (defaultValue.getClass().getModifiers() & Modifier.PRIVATE) == 0) {
    retValue=defaultValue;
  }
 else {
    @SuppressWarnings("String_Node_Str") Class<Collection<Object>> collectionType=(Class<Collection<Object>>)attributeMetadata.getAttributeType();
    retValue=strategy.getTypeValue(attributeMetadata,typeArgsMap,collectionType);
    if (null != retValue && null != defaultValue) {
      retValue.addAll(defaultValue);
    }
  }
  if (null == retValue) {
    return null;
  }
  try {
    Class<?> typeClass=null;
    AtomicReference<Type[]> elementGenericTypeArgs=new AtomicReference<Type[]>(PodamConstants.NO_TYPES);
    if (ArrayUtils.isEmpty(attributeMetadata.getAttrGenericArgs())) {
      typeClass=findInheretedCollectionElementType(retValue,manufacturingCtx,elementGenericTypeArgs,typeArgsMap,attributeMetadata.getAttrGenericArgs());
    }
 else {
      Type actualTypeArgument=attributeMetadata.getAttrGenericArgs()[0];
      typeClass=TypeManufacturerUtil.resolveGenericParameter(actualTypeArgument,typeArgsMap,elementGenericTypeArgs);
    }
    fillCollection(manufacturingCtx,attributeMetadata.getAttributeAnnotations(),attributeName,retValue,typeClass,elementGenericTypeArgs.get());
  }
 catch (  SecurityException e) {
    throw new PodamMockeryException(RESOLVING_COLLECTION_EXCEPTION_STR,e);
  }
catch (  IllegalArgumentException e) {
    throw new PodamMockeryException(RESOLVING_COLLECTION_EXCEPTION_STR,e);
  }
catch (  InstantiationException e) {
    throw new PodamMockeryException(RESOLVING_COLLECTION_EXCEPTION_STR,e);
  }
catch (  IllegalAccessException e) {
    throw new PodamMockeryException(RESOLVING_COLLECTION_EXCEPTION_STR,e);
  }
catch (  ClassNotFoundException e) {
    throw new PodamMockeryException(RESOLVING_COLLECTION_EXCEPTION_STR,e);
  }
catch (  InvocationTargetException e) {
    throw new PodamMockeryException(RESOLVING_COLLECTION_EXCEPTION_STR,e);
  }
  return retValue;
}

Fixed version (ground truth):
/** 
 * It returns a collection of some sort with some data in it.
 * @param pojo The POJO being analyzed
 * @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 a collection of some sort with some data in it
 * @throws PodamMockeryException An exception occurred while resolving the collection
 * @throws IllegalArgumentException If the field name is null or empty
 */
private Collection<? super Object> resolveCollectionValueWhenCollectionIsPojoAttribute(Object pojo,ManufacturingContext manufacturingCtx,AttributeMetadata attributeMetadata,Map<String,Type> typeArgsMap){
  String attributeName=attributeMetadata.getAttributeName();
  Collection<Object> defaultValue=null;
  if (null != pojo && !Character.isDigit(attributeName.charAt(0))) {
    defaultValue=PodamUtils.getFieldValue(pojo,attributeName);
  }
  Collection<Object> retValue=null;
  if (null != defaultValue && (defaultValue.getClass().getModifiers() & Modifier.PRIVATE) == 0) {
    retValue=defaultValue;
  }
 else {
    @SuppressWarnings("String_Node_Str") Class<Collection<Object>> collectionType=(Class<Collection<Object>>)attributeMetadata.getAttributeType();
    retValue=strategy.getTypeValue(attributeMetadata,typeArgsMap,collectionType);
    if (null != retValue && null != defaultValue) {
      retValue.addAll(defaultValue);
    }
  }
  if (null == retValue) {
    return null;
  }
  try {
    Class<?> typeClass=null;
    AtomicReference<Type[]> elementGenericTypeArgs=new AtomicReference<Type[]>(PodamConstants.NO_TYPES);
    if (ArrayUtils.isEmpty(attributeMetadata.getAttrGenericArgs())) {
      typeClass=findInheretedCollectionElementType(retValue,manufacturingCtx,elementGenericTypeArgs,typeArgsMap,attributeMetadata.getAttrGenericArgs());
    }
 else {
      Type actualTypeArgument=attributeMetadata.getAttrGenericArgs()[0];
      typeClass=TypeManufacturerUtil.resolveGenericParameter(actualTypeArgument,typeArgsMap,elementGenericTypeArgs);
    }
    fillCollection(manufacturingCtx,attributeMetadata.getAttributeAnnotations(),attributeName,retValue,typeClass,elementGenericTypeArgs.get());
  }
 catch (  SecurityException e) {
    throw new PodamMockeryException(RESOLVING_COLLECTION_EXCEPTION_STR,e);
  }
catch (  IllegalArgumentException e) {
    throw new PodamMockeryException(RESOLVING_COLLECTION_EXCEPTION_STR,e);
  }
catch (  InstantiationException e) {
    throw new PodamMockeryException(RESOLVING_COLLECTION_EXCEPTION_STR,e);
  }
catch (  IllegalAccessException e) {
    throw new PodamMockeryException(RESOLVING_COLLECTION_EXCEPTION_STR,e);
  }
catch (  ClassNotFoundException e) {
    throw new PodamMockeryException(RESOLVING_COLLECTION_EXCEPTION_STR,e);
  }
catch (  InvocationTargetException e) {
    throw new PodamMockeryException(RESOLVING_COLLECTION_EXCEPTION_STR,e);
  }
  return retValue;
}