Program: 177945
Project: 177945
Buggy source:
/** 
 * It manufactures and returns the value for a POJO attribute.
 * @param pojo The POJO being filled with values
 * @param pojos Set of manufactured pojos' types
 * @param attributeType The type of the attribute for which a value is being manufactured
 * @param genericAttributeType The generic type of the attribute for which a value is being manufactured
 * @param annotations The annotations for the attribute being considered
 * @param attributeName The attribute name
 * @param typeArgsMap a map relating the generic class arguments ("<T, V>" for example) with their actual types
 * @param genericTypeArgs The generic type arguments for the current generic class instance
 * @return The value for an attribute
 * @throws InstantiationException If an exception occurred during instantiation
 * @throws IllegalAccessException If security was violated while creating the object
 * @throws InvocationTargetException If an exception occurred while invoking the constructor or factory method
 * @throws ClassNotFoundException If it was not possible to create a class from a string
 * @throws IllegalArgumentException <ul> <li>If an illegal argument was passed</li> <li>If an invalid value was set for a precise value in an annotation and such value could not be converted to the desired type</li> </ul>
 */
private Object manufactureAttributeValue(Object pojo,Map<Class<?>,Integer> pojos,Class<?> attributeType,Type genericAttributeType,List<Annotation> annotations,String attributeName,Map<String,Type> typeArgsMap,Type... genericTypeArgs) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException {
  Object attributeValue=null;
  Class<?> realAttributeType;
  if (Object.class.equals(attributeType) && attributeType != genericAttributeType) {
    AtomicReference<Type[]> elementGenericTypeArgs=new AtomicReference<Type[]>(NO_TYPES);
    realAttributeType=resolveGenericParameter(genericAttributeType,typeArgsMap,elementGenericTypeArgs);
  }
 else {
    realAttributeType=attributeType;
  }
  AttributeMetadata attributeMetadata=new AttributeMetadata(attributeName,realAttributeType,annotations,pojo.getClass());
  if (realAttributeType.isPrimitive()) {
    attributeValue=resolvePrimitiveValue(realAttributeType,annotations,attributeMetadata);
  }
 else   if (isWrapper(realAttributeType)) {
    attributeValue=resolveWrapperValue(realAttributeType,annotations,attributeMetadata);
  }
 else   if (realAttributeType.equals(String.class)) {
    attributeValue=resolveStringValue(annotations,attributeMetadata);
  }
 else   if (realAttributeType.isArray()) {
    attributeValue=resolveArrayElementValue(realAttributeType,genericAttributeType,pojos,annotations,pojo,attributeName,typeArgsMap);
  }
 else   if (Collection.class.isAssignableFrom(realAttributeType)) {
    attributeValue=resolveCollectionValueWhenCollectionIsPojoAttribute(pojo,pojos,realAttributeType,attributeName,annotations,typeArgsMap,genericTypeArgs);
  }
 else   if (Map.class.isAssignableFrom(realAttributeType)) {
    attributeValue=resolveMapValueWhenMapIsPojoAttribute(pojo,pojos,realAttributeType,attributeName,annotations,typeArgsMap,genericTypeArgs);
  }
 else   if (realAttributeType.isEnum()) {
    int enumConstantsLength=realAttributeType.getEnumConstants().length;
    if (enumConstantsLength > 0) {
      int enumIndex=strategy.getIntegerInRange(0,enumConstantsLength,attributeMetadata) % enumConstantsLength;
      attributeValue=realAttributeType.getEnumConstants()[enumIndex];
    }
  }
 else   if (Type.class.isAssignableFrom(realAttributeType)) {
    if (genericTypeArgs.length > 0 && genericTypeArgs[0] != null) {
      AtomicReference<Type[]> elementGenericTypeArgs=new AtomicReference<Type[]>(NO_TYPES);
      attributeValue=resolveGenericParameter(genericTypeArgs[0],typeArgsMap,elementGenericTypeArgs);
    }
 else {
      LOG.error("String_Node_Str",genericAttributeType,typeArgsMap,Arrays.toString(genericTypeArgs));
    }
  }
  if (attributeValue == null) {
    TypeVariable<?>[] typeParams=attributeType.getTypeParameters();
    Type[] genericTypeArgsAll=mergeActualAndSuppliedGenericTypes(typeParams,genericTypeArgs,typeArgsMap);
    Integer depth=pojos.get(realAttributeType);
    if (depth == null) {
      depth=-1;
    }
    if (depth <= strategy.getMaxDepth(pojo.getClass())) {
      pojos.put(realAttributeType,depth + 1);
      attributeValue=this.manufacturePojoInternal(realAttributeType,pojos,genericTypeArgsAll);
      pojos.put(realAttributeType,depth);
    }
 else {
      LOG.warn("String_Node_Str",realAttributeType);
      attributeValue=externalFactory.manufacturePojo(realAttributeType,genericTypeArgsAll);
    }
  }
  return attributeValue;
}

Fixed version (ground truth):
/** 
 * It manufactures and returns the value for a POJO attribute.
 * @param pojo The POJO being filled with values
 * @param pojos Set of manufactured pojos' types
 * @param attributeType The type of the attribute for which a value is being manufactured
 * @param genericAttributeType The generic type of the attribute for which a value is being manufactured
 * @param annotations The annotations for the attribute being considered
 * @param attributeName The attribute name
 * @param typeArgsMap a map relating the generic class arguments ("<T, V>" for example) with their actual types
 * @param genericTypeArgs The generic type arguments for the current generic class instance
 * @return The value for an attribute
 * @throws InstantiationException If an exception occurred during instantiation
 * @throws IllegalAccessException If security was violated while creating the object
 * @throws InvocationTargetException If an exception occurred while invoking the constructor or factory method
 * @throws ClassNotFoundException If it was not possible to create a class from a string
 * @throws IllegalArgumentException <ul> <li>If an illegal argument was passed</li> <li>If an invalid value was set for a precise value in an annotation and such value could not be converted to the desired type</li> </ul>
 */
private Object manufactureAttributeValue(Object pojo,Map<Class<?>,Integer> pojos,Class<?> attributeType,Type genericAttributeType,List<Annotation> annotations,String attributeName,Map<String,Type> typeArgsMap,Type... genericTypeArgs) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException {
  Object attributeValue=null;
  Class<?> realAttributeType;
  if (Object.class.equals(attributeType) && attributeType != genericAttributeType) {
    AtomicReference<Type[]> elementGenericTypeArgs=new AtomicReference<Type[]>(NO_TYPES);
    realAttributeType=resolveGenericParameter(genericAttributeType,typeArgsMap,elementGenericTypeArgs);
  }
 else {
    realAttributeType=attributeType;
  }
  AttributeMetadata attributeMetadata=new AttributeMetadata(attributeName,realAttributeType,annotations,pojo.getClass());
  if (realAttributeType.isPrimitive()) {
    attributeValue=resolvePrimitiveValue(realAttributeType,annotations,attributeMetadata);
  }
 else   if (isWrapper(realAttributeType)) {
    attributeValue=resolveWrapperValue(realAttributeType,annotations,attributeMetadata);
  }
 else   if (realAttributeType.equals(String.class)) {
    attributeValue=resolveStringValue(annotations,attributeMetadata);
  }
 else   if (realAttributeType.isArray()) {
    attributeValue=resolveArrayElementValue(realAttributeType,genericAttributeType,pojos,annotations,pojo,attributeName,typeArgsMap);
  }
 else   if (Collection.class.isAssignableFrom(realAttributeType)) {
    attributeValue=resolveCollectionValueWhenCollectionIsPojoAttribute(pojo,pojos,realAttributeType,attributeName,annotations,typeArgsMap,genericTypeArgs);
  }
 else   if (Map.class.isAssignableFrom(realAttributeType)) {
    attributeValue=resolveMapValueWhenMapIsPojoAttribute(pojo,pojos,realAttributeType,attributeName,annotations,typeArgsMap,genericTypeArgs);
  }
 else   if (realAttributeType.isEnum()) {
    int enumConstantsLength=realAttributeType.getEnumConstants().length;
    if (enumConstantsLength > 0) {
      int enumIndex=strategy.getIntegerInRange(0,enumConstantsLength,attributeMetadata) % enumConstantsLength;
      attributeValue=realAttributeType.getEnumConstants()[enumIndex];
    }
  }
 else   if (Type.class.isAssignableFrom(realAttributeType)) {
    Type paremeterType=null;
    if (genericAttributeType instanceof ParameterizedType) {
      ParameterizedType parametrized=(ParameterizedType)genericAttributeType;
      Type[] arguments=parametrized.getActualTypeArguments();
      if (arguments.length > 0) {
        paremeterType=arguments[0];
      }
    }
 else     if (realAttributeType.getTypeParameters().length > 0) {
      paremeterType=realAttributeType.getTypeParameters()[0];
    }
    if (paremeterType != null) {
      AtomicReference<Type[]> elementGenericTypeArgs=new AtomicReference<Type[]>(NO_TYPES);
      attributeValue=resolveGenericParameter(paremeterType,typeArgsMap,elementGenericTypeArgs);
    }
 else {
      LOG.error("String_Node_Str",genericAttributeType,typeArgsMap,Arrays.toString(genericTypeArgs));
    }
  }
  if (attributeValue == null) {
    TypeVariable<?>[] typeParams=attributeType.getTypeParameters();
    Type[] genericTypeArgsAll=mergeActualAndSuppliedGenericTypes(typeParams,genericTypeArgs,typeArgsMap);
    Integer depth=pojos.get(realAttributeType);
    if (depth == null) {
      depth=-1;
    }
    if (depth <= strategy.getMaxDepth(pojo.getClass())) {
      pojos.put(realAttributeType,depth + 1);
      attributeValue=this.manufacturePojoInternal(realAttributeType,pojos,genericTypeArgsAll);
      pojos.put(realAttributeType,depth);
    }
 else {
      LOG.warn("String_Node_Str",realAttributeType);
      attributeValue=externalFactory.manufacturePojo(realAttributeType,genericTypeArgsAll);
    }
  }
  return attributeValue;
}