Program: 177951
Project: 177951
Buggy source:
/** 
 * It returns a collection of some sort with some data in it.
 * @param pojoClass The POJO being analysed
 * @param collectionType The type of the attribute being evaluated
 * @param annotations The set of annotations for the annotated attribute. It might be empty
 * @param attributeName The name of the field being set
 * @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
 */
@SuppressWarnings({"String_Node_Str"}) private Collection<? super Object> resolveCollectionValueWhenCollectionIsPojoAttribute(Class<?> pojoClass,Class<?> collectionType,String attributeName,List<Annotation> annotations){
  this.validateAttributeName(attributeName);
  Collection<? super Object> retValue=null;
  try {
    Object newInstance=pojoClass.newInstance();
    Field field=pojoClass.getDeclaredField(attributeName);
    field.setAccessible(true);
    Collection<? super Object> coll=(Collection<? super Object>)field.get(newInstance);
    if (null != coll) {
      retValue=coll;
    }
 else {
      retValue=this.resolveCollectionType(collectionType);
    }
    Class<?> typeClass=null;
    Type genericType=field.getGenericType();
    if (!(genericType instanceof ParameterizedType)) {
      LOG.warn("String_Node_Str" + attributeName + "String_Node_Str");
      typeClass=Object.class;
    }
 else {
      ParameterizedType pType=(ParameterizedType)genericType;
      Type actualTypeArguments=pType.getActualTypeArguments()[0];
      typeClass=Class.forName(PodamUtils.extractClassNameFromParameterisedTypeInField(actualTypeArguments));
    }
    this.fillCollection(pojoClass,attributeName,annotations,retValue,typeClass);
  }
 catch (  SecurityException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  NoSuchFieldException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  IllegalArgumentException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  InstantiationException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  IllegalAccessException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  ClassNotFoundException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  InvocationTargetException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
  return retValue;
}

Fixed version (ground truth):
/** 
 * It returns a collection of some sort with some data in it.
 * @param pojoClass The POJO being analysed
 * @param collectionType The type of the attribute being evaluated
 * @param annotations The set of annotations for the annotated attribute. It might be empty
 * @param attributeName The name of the field being set
 * @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
 */
@SuppressWarnings({"String_Node_Str"}) private Collection<? super Object> resolveCollectionValueWhenCollectionIsPojoAttribute(Class<?> pojoClass,Class<?> collectionType,String attributeName,List<Annotation> annotations){
  this.validateAttributeName(attributeName);
  Collection<? super Object> retValue=null;
  try {
    Object newInstance=pojoClass.newInstance();
    Field field=null;
    Class<?> clazz=pojoClass;
    while (clazz != null) {
      try {
        field=clazz.getDeclaredField(attributeName);
        break;
      }
 catch (      NoSuchFieldException e) {
        clazz=clazz.getSuperclass();
      }
catch (      SecurityException e) {
        throw e;
      }
    }
    if (field == null) {
      throw new NoSuchFieldException();
    }
    field.setAccessible(true);
    Collection<? super Object> coll=(Collection<? super Object>)field.get(newInstance);
    if (null != coll) {
      retValue=coll;
    }
 else {
      retValue=this.resolveCollectionType(collectionType);
    }
    Class<?> typeClass=null;
    Type genericType=field.getGenericType();
    if (!(genericType instanceof ParameterizedType)) {
      LOG.warn("String_Node_Str" + attributeName + "String_Node_Str");
      typeClass=Object.class;
    }
 else {
      ParameterizedType pType=(ParameterizedType)genericType;
      Type actualTypeArguments=pType.getActualTypeArguments()[0];
      typeClass=Class.forName(PodamUtils.extractClassNameFromParameterisedTypeInField(actualTypeArguments));
    }
    this.fillCollection(pojoClass,attributeName,annotations,retValue,typeClass);
  }
 catch (  SecurityException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  NoSuchFieldException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  IllegalArgumentException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  InstantiationException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  IllegalAccessException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  ClassNotFoundException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  InvocationTargetException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
  return retValue;
}