Program: 175940
Project: 175940
Buggy source:
/** 
 * Generic method which returns an instance of the given class filled with values dictated by the strategy
 * @param < T > The type for which a filled instance is required
 * @param pojoClass The name of the class for which an instance filled with values is required
 * @param depth How many times  {@code pojoClass} has been found. This will beused for reentrant objects
 * @param genericTypeArgs The generic type arguments for the current generic class instance
 * @return An instance of <T> filled with dummy values
 * @throws PodamMockeryException if a problem occurred while creating a POJO instance or while setting its state
 */
@SuppressWarnings("String_Node_Str") private <T>T manufacturePojoInternal(Class<T> pojoClass,int depth,Type... genericTypeArgs){
  try {
    T retValue=null;
    final TypeVariable<?>[] typeParameters=pojoClass.getTypeParameters();
    if (typeParameters.length > genericTypeArgs.length) {
      LOG.info(pojoClass.getCanonicalName() + "String_Node_Str" + typeParameters.length+ "String_Node_Str"+ genericTypeArgs.length+ "String_Node_Str");
      return retValue;
    }
    if (pojoClass.isPrimitive()) {
      ArrayList<Annotation> annotations=new ArrayList<Annotation>();
      String noName=null;
      return (T)resolvePrimitiveValue(pojoClass,annotations,new AttributeMetadata(noName,pojoClass,annotations));
    }
    if (pojoClass.isInterface() || Modifier.isAbstract(pojoClass.getModifiers())) {
      LOG.warn("String_Node_Str");
      return null;
    }
    ClassInfo classInfo=PodamUtils.getClassInfo(pojoClass,excludeAnnotations);
    try {
      Constructor<?>[] constructors=pojoClass.getConstructors();
      if (constructors == null || constructors.length == 0) {
        LOG.warn("String_Node_Str" + "String_Node_Str");
        Constructor<T> defaultConstructor=pojoClass.getDeclaredConstructor(new Class[]{});
        LOG.info("String_Node_Str" + defaultConstructor);
        defaultConstructor.setAccessible(true);
        retValue=defaultConstructor.newInstance();
      }
 else {
        retValue=resolvePojoWithoutSetters(pojoClass,depth,genericTypeArgs);
      }
    }
 catch (    SecurityException e) {
      throw new PodamMockeryException("String_Node_Str",e);
    }
catch (    NoSuchMethodException e1) {
      LOG.warn("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
      Constructor<?>[] constructors=pojoClass.getDeclaredConstructors();
      if (constructors == null || constructors.length == 0) {
        throw new IllegalStateException("String_Node_Str" + pojoClass + "String_Node_Str");
      }
      LOG.info("String_Node_Str" + constructors[0]);
      Object[] parameterValuesForConstructor=getParameterValuesForConstructor(constructors[0],pojoClass,genericTypeArgs);
      constructors[0].setAccessible(true);
      retValue=(T)constructors[0].newInstance(parameterValuesForConstructor);
    }
    Class<?>[] parameterTypes=null;
    Class<?> attributeType=null;
    Object setterArg=null;
    for (    Method setter : classInfo.getClassSetters()) {
      List<Annotation> pojoAttributeAnnotations=retrieveFieldAnnotations(pojoClass,setter);
      String attributeName=PodamUtils.extractFieldNameFromSetterMethod(setter);
      parameterTypes=setter.getParameterTypes();
      if (parameterTypes.length != 1) {
        throw new IllegalStateException("String_Node_Str");
      }
      attributeType=parameterTypes[0];
      PodamStrategyValue attributeStrategyAnnotation=containsAttributeStrategyAnnotation(pojoAttributeAnnotations);
      if (null != attributeStrategyAnnotation) {
        AttributeStrategy<?> attributeStrategy=attributeStrategyAnnotation.value().newInstance();
        if (LOG.isDebugEnabled()) {
          LOG.debug("String_Node_Str" + attributeName + "String_Node_Str"+ attributeStrategy);
        }
        setterArg=returnAttributeDataStrategyValue(attributeType,attributeStrategy);
      }
 else {
        final Map<String,Type> typeArgsMap=new HashMap<String,Type>();
        Type[] genericTypeArgsExtra=fillTypeArgMap(typeArgsMap,typeParameters,genericTypeArgs);
        if (genericTypeArgsExtra != null) {
          LOG.warn(String.format("String_Node_Str",genericTypeArgsExtra.length));
        }
        if (attributeType.equals(pojoClass)) {
          if (depth < strategy.getMaxDepth(pojoClass)) {
            depth++;
            setterArg=this.manufacturePojoInternal(attributeType,depth);
            setter.invoke(retValue,setterArg);
            continue;
          }
 else {
            setterArg=createNewInstanceForClassWithoutConstructors(pojoClass,pojoClass);
            setter.invoke(retValue,setterArg);
            depth=0;
            continue;
          }
        }
        Type[] typeArguments=new Type[]{};
        if (setter.getGenericParameterTypes()[0] instanceof ParameterizedType) {
          final ParameterizedType attributeParameterizedType=(ParameterizedType)setter.getGenericParameterTypes()[0];
          typeArguments=attributeParameterizedType.getActualTypeArguments();
        }
 else         if (setter.getGenericParameterTypes()[0] instanceof TypeVariable) {
          final TypeVariable<?> typeVariable=(TypeVariable<?>)setter.getGenericParameterTypes()[0];
          Type type=typeArgsMap.get(typeVariable.getName());
          if (type instanceof ParameterizedType) {
            final ParameterizedType attributeParameterizedType=(ParameterizedType)type;
            typeArguments=attributeParameterizedType.getActualTypeArguments();
            attributeType=(Class<?>)attributeParameterizedType.getRawType();
          }
 else {
            attributeType=(Class<?>)type;
          }
        }
        setterArg=manufactureAttributeValue(pojoClass,attributeType,pojoAttributeAnnotations,attributeName,typeArgsMap,typeArguments);
      }
      if (setterArg != null) {
        if (!Modifier.isPublic(setter.getModifiers())) {
          LOG.warn("String_Node_Str" + setter.getName() + "String_Node_Str"+ "String_Node_Str");
          setter.setAccessible(true);
        }
        setter.invoke(retValue,setterArg);
      }
 else {
        LOG.warn("String_Node_Str" + attributeName + "String_Node_Str");
      }
    }
    return retValue;
  }
 catch (  InstantiationException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  IllegalAccessException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  IllegalArgumentException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  InvocationTargetException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  ClassNotFoundException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Generic method which returns an instance of the given class filled with values dictated by the strategy
 * @param < T > The type for which a filled instance is required
 * @param pojoClass The name of the class for which an instance filled with values is required
 * @param depth How many times  {@code pojoClass} has been found. This will beused for reentrant objects
 * @param genericTypeArgs The generic type arguments for the current generic class instance
 * @return An instance of <T> filled with dummy values
 * @throws PodamMockeryException if a problem occurred while creating a POJO instance or while setting its state
 */
@SuppressWarnings("String_Node_Str") private <T>T manufacturePojoInternal(Class<T> pojoClass,int depth,Type... genericTypeArgs){
  try {
    T retValue=null;
    final TypeVariable<?>[] typeParameters=pojoClass.getTypeParameters();
    if (typeParameters.length > genericTypeArgs.length) {
      LOG.info(pojoClass.getCanonicalName() + "String_Node_Str" + typeParameters.length+ "String_Node_Str"+ genericTypeArgs.length+ "String_Node_Str");
      return retValue;
    }
    if (pojoClass.isPrimitive()) {
      ArrayList<Annotation> annotations=new ArrayList<Annotation>();
      String noName=null;
      return (T)resolvePrimitiveValue(pojoClass,annotations,new AttributeMetadata(noName,pojoClass,annotations));
    }
    if (pojoClass.isInterface() || Modifier.isAbstract(pojoClass.getModifiers())) {
      LOG.warn("String_Node_Str");
      return null;
    }
    ClassInfo classInfo=PodamUtils.getClassInfo(pojoClass,excludeAnnotations);
    try {
      Constructor<?>[] constructors=pojoClass.getConstructors();
      if (constructors == null || constructors.length == 0) {
        LOG.warn("String_Node_Str" + "String_Node_Str");
        Constructor<T> defaultConstructor=pojoClass.getDeclaredConstructor(new Class[]{});
        LOG.info("String_Node_Str" + defaultConstructor);
        defaultConstructor.setAccessible(true);
        retValue=defaultConstructor.newInstance();
      }
 else {
        retValue=resolvePojoWithoutSetters(pojoClass,depth,genericTypeArgs);
      }
    }
 catch (    SecurityException e) {
      throw new PodamMockeryException("String_Node_Str",e);
    }
catch (    NoSuchMethodException e1) {
      LOG.warn("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
      Constructor<?>[] constructors=pojoClass.getDeclaredConstructors();
      if (constructors == null || constructors.length == 0) {
        throw new IllegalStateException("String_Node_Str" + pojoClass + "String_Node_Str");
      }
      LOG.info("String_Node_Str" + constructors[0]);
      Object[] parameterValuesForConstructor=getParameterValuesForConstructor(constructors[0],pojoClass,genericTypeArgs);
      constructors[0].setAccessible(true);
      retValue=(T)constructors[0].newInstance(parameterValuesForConstructor);
    }
    Class<?>[] parameterTypes=null;
    Class<?> attributeType=null;
    Object setterArg=null;
    for (    Method setter : classInfo.getClassSetters()) {
      List<Annotation> pojoAttributeAnnotations=retrieveFieldAnnotations(pojoClass,setter);
      String attributeName=PodamUtils.extractFieldNameFromSetterMethod(setter);
      parameterTypes=setter.getParameterTypes();
      if (parameterTypes.length != 1) {
        throw new IllegalStateException("String_Node_Str");
      }
      attributeType=parameterTypes[0];
      PodamStrategyValue attributeStrategyAnnotation=containsAttributeStrategyAnnotation(pojoAttributeAnnotations);
      if (null != attributeStrategyAnnotation) {
        AttributeStrategy<?> attributeStrategy=attributeStrategyAnnotation.value().newInstance();
        if (LOG.isDebugEnabled()) {
          LOG.debug("String_Node_Str" + attributeName + "String_Node_Str"+ attributeStrategy);
        }
        setterArg=returnAttributeDataStrategyValue(attributeType,attributeStrategy);
      }
 else {
        final Map<String,Type> typeArgsMap=new HashMap<String,Type>();
        Type[] genericTypeArgsExtra=fillTypeArgMap(typeArgsMap,typeParameters,genericTypeArgs);
        if (genericTypeArgsExtra != null) {
          LOG.warn(String.format("String_Node_Str",genericTypeArgsExtra.length));
        }
        if (depth >= strategy.getMaxDepth(pojoClass)) {
          setterArg=createNewInstanceForClassWithoutConstructors(attributeType,attributeType);
        }
 else {
          Type[] typeArguments=new Type[]{};
          if (setter.getGenericParameterTypes()[0] instanceof ParameterizedType) {
            final ParameterizedType attributeParameterizedType=(ParameterizedType)setter.getGenericParameterTypes()[0];
            typeArguments=attributeParameterizedType.getActualTypeArguments();
          }
 else           if (setter.getGenericParameterTypes()[0] instanceof TypeVariable) {
            final TypeVariable<?> typeVariable=(TypeVariable<?>)setter.getGenericParameterTypes()[0];
            Type type=typeArgsMap.get(typeVariable.getName());
            if (type instanceof ParameterizedType) {
              final ParameterizedType attributeParameterizedType=(ParameterizedType)type;
              typeArguments=attributeParameterizedType.getActualTypeArguments();
              attributeType=(Class<?>)attributeParameterizedType.getRawType();
            }
 else {
              attributeType=(Class<?>)type;
            }
          }
          setterArg=manufactureAttributeValueInternal(pojoClass,depth,attributeType,pojoAttributeAnnotations,attributeName,typeArgsMap,typeArguments);
        }
      }
      if (setterArg != null) {
        if (!Modifier.isPublic(setter.getModifiers())) {
          LOG.warn("String_Node_Str" + setter.getName() + "String_Node_Str"+ "String_Node_Str");
          setter.setAccessible(true);
        }
        setter.invoke(retValue,setterArg);
      }
 else {
        LOG.warn("String_Node_Str" + attributeName + "String_Node_Str");
      }
    }
    return retValue;
  }
 catch (  InstantiationException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  IllegalAccessException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  IllegalArgumentException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  InvocationTargetException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
catch (  ClassNotFoundException e) {
    throw new PodamMockeryException("String_Node_Str",e);
  }
}