Program: 86972
Project: 86972
Buggy source:
/** 
 * Reflection based producer method. <p/> This method uses reflection to find producer methods to the following rules: <ul> <li>public <b>static</b> Foo createFoo(ICS ics, Factory factory){}</li> <li>public Foo createFoo(ICS ics){}</li> </ul> If the non-static version is used the implementing class needs to have a public constructor that takes   {@see ICS} and {@see Factory} as arguments.To this class the current ICS and this object will be passed.
 * @param name the simple name of the object to produce
 * @param c the class with the type information of the object to produce
 * @return the created object, null if no producer method was found or whenthat method returned null.
 * @throws InvocationTargetException when the create&lt;Type&gt; methodthrows an exception.
 */
@SuppressWarnings("String_Node_Str") protected <T>T reflectionStrategy(String name,Class<T> c) throws InvocationTargetException {
  T o=null;
  for (  Class<?> reflectionClass : findClasses(ics)) {
    for (    Method m : reflectionClass.getMethods()) {
      if (m.getName().equals("String_Node_Str" + name)) {
        if (m.getReturnType().isAssignableFrom(c)) {
          if (m.getParameterTypes().length == 2 && Modifier.isStatic(m.getModifiers()) && m.getParameterTypes()[0].isAssignableFrom(ICS.class) && m.getParameterTypes()[1].isAssignableFrom(Factory.class)) {
            try {
              o=(T)m.invoke(null,ics,this);
              if (shouldCache(m))               objectCache.put(c.getName(),o);
            }
 catch (            IllegalArgumentException e) {
              LOG.error("String_Node_Str" + m.toString() + "String_Node_Str"+ e.getMessage());
            }
catch (            IllegalAccessException e) {
              LOG.error("String_Node_Str" + m.toString() + "String_Node_Str"+ e.getMessage());
            }
            return o;
          }
 else           if (m.getParameterTypes().length == 1 && m.getParameterTypes()[0].isAssignableFrom(ICS.class)) {
            try {
              Object factory=null;
              if (reflectionClass.equals(getClass())) {
                factory=this;
              }
 else {
                Constructor<?> ctor;
                ctor=reflectionClass.getConstructor(ICS.class,Factory.class);
                if (Modifier.isPublic(ctor.getModifiers())) {
                  factory=ctor.newInstance(ics,this);
                }
 else {
                  LOG.warn(reflectionClass.getName() + "String_Node_Str");
                }
              }
              if (factory != null) {
                if (LOG.isTraceEnabled())                 LOG.trace("String_Node_Str" + name + "String_Node_Str"+ m.getName());
                o=(T)m.invoke(factory,ics);
                if (shouldCache(m))                 objectCache.put(c.getName(),o);
              }
              return o;
            }
 catch (            SecurityException e) {
              LOG.debug("String_Node_Str" + m.toString());
            }
catch (            NoSuchMethodException e) {
              throw new NoSuchMethodExceptionRuntimeException(reflectionClass.getName() + "String_Node_Str");
            }
catch (            IllegalArgumentException e) {
              LOG.error("String_Node_Str" + m.toString() + "String_Node_Str"+ e.getMessage());
            }
catch (            InstantiationException e) {
              LOG.error(e.getMessage());
            }
catch (            IllegalAccessException e) {
              LOG.error("String_Node_Str" + m.toString() + "String_Node_Str"+ e.getMessage());
            }
          }
        }
      }
    }
  }
  return o;
}

Fixed version (ground truth):
/** 
 * Reflection based producer method. <p/> This method uses reflection to find producer methods to the following rules: <ul> <li>public <b>static</b> Foo createFoo(ICS ics, Factory factory){}</li> <li>public Foo createFoo(ICS ics){}</li> </ul> If the non-static version is used the implementing class needs to have a public constructor that takes   {@link ICS} and {@link Factory} as arguments.To this class the current ICS and this object will be passed.
 * @param name the simple name of the object to produce
 * @param c the class with the type information of the object to produce
 * @return the created object, null if no producer method was found or whenthat method returned null.
 * @throws InvocationTargetException when the create&lt;Type&gt; methodthrows an exception.
 */
@SuppressWarnings("String_Node_Str") protected <T>T reflectionStrategy(String name,Class<T> c) throws InvocationTargetException {
  T o=null;
  for (  Class<?> reflectionClass : findClasses(ics)) {
    for (    Method m : reflectionClass.getMethods()) {
      if (m.getName().equals("String_Node_Str" + name)) {
        if (m.getReturnType().isAssignableFrom(c)) {
          if (m.getParameterTypes().length == 2 && Modifier.isStatic(m.getModifiers()) && m.getParameterTypes()[0].isAssignableFrom(ICS.class) && m.getParameterTypes()[1].isAssignableFrom(Factory.class)) {
            try {
              o=(T)m.invoke(null,ics,this);
              if (shouldCache(m))               objectCache.put(c.getName(),o);
            }
 catch (            IllegalArgumentException e) {
              LOG.error("String_Node_Str" + m.toString() + "String_Node_Str"+ e.getMessage());
            }
catch (            IllegalAccessException e) {
              LOG.error("String_Node_Str" + m.toString() + "String_Node_Str"+ e.getMessage());
            }
            return o;
          }
 else           if (m.getParameterTypes().length == 1 && m.getParameterTypes()[0].isAssignableFrom(ICS.class)) {
            try {
              Object factory=null;
              if (reflectionClass.equals(getClass())) {
                factory=this;
              }
 else {
                Constructor<?> ctor;
                ctor=reflectionClass.getConstructor(ICS.class,Factory.class);
                if (Modifier.isPublic(ctor.getModifiers())) {
                  factory=ctor.newInstance(ics,this);
                }
 else {
                  LOG.warn(reflectionClass.getName() + "String_Node_Str");
                }
              }
              if (factory != null) {
                if (LOG.isTraceEnabled())                 LOG.trace("String_Node_Str" + name + "String_Node_Str"+ m.getName());
                o=(T)m.invoke(factory,ics);
                if (shouldCache(m))                 objectCache.put(c.getName(),o);
              }
              return o;
            }
 catch (            SecurityException e) {
              LOG.debug("String_Node_Str" + m.toString());
            }
catch (            NoSuchMethodException e) {
              throw new NoSuchMethodExceptionRuntimeException(reflectionClass.getName() + "String_Node_Str");
            }
catch (            IllegalArgumentException e) {
              LOG.error("String_Node_Str" + m.toString() + "String_Node_Str"+ e.getMessage());
            }
catch (            InstantiationException e) {
              LOG.error(e.getMessage());
            }
catch (            IllegalAccessException e) {
              LOG.error("String_Node_Str" + m.toString() + "String_Node_Str"+ e.getMessage());
            }
          }
        }
      }
    }
  }
  return o;
}