Program: 29167
Project: 29167
Buggy source:
public Object resolveInjectionPoint(java.lang.reflect.Member member,Application app) throws javax.naming.NamingException {
  Object result=null;
  Field field=null;
  Method method=null;
  Annotation[] annotations;
  if (member instanceof Field) {
    field=(Field)member;
    annotations=field.getDeclaredAnnotations();
  }
 else   if (member instanceof Method) {
    method=(Method)member;
    annotations=method.getDeclaredAnnotations();
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Annotation envAnnotation=getEnvAnnotation(annotations);
  if (envAnnotation == null) {
    throw new IllegalArgumentException("String_Node_Str" + member);
  }
  String envAnnotationName=null;
  try {
    Method m=envAnnotation.annotationType().getDeclaredMethod("String_Node_Str");
    envAnnotationName=(String)m.invoke(envAnnotation);
  }
 catch (  Exception e) {
    throw new IllegalArgumentException("String_Node_Str" + envAnnotation.toString(),e);
  }
  String envDependencyName=envAnnotationName;
  Class declaringClass=member.getDeclaringClass();
  if ((envAnnotationName == null) || envAnnotationName.equals("String_Node_Str")) {
    if (field != null) {
      envDependencyName=declaringClass.getName() + "String_Node_Str" + field.getName();
    }
 else {
      envDependencyName=declaringClass.getName() + "String_Node_Str" + getInjectionMethodPropertyName(method);
    }
  }
  if (envAnnotationName.startsWith("String_Node_Str")) {
    javax.naming.Context ic=namingManager.getInitialContext();
    result=ic.lookup(envAnnotationName);
  }
 else {
    BundleDescriptor matchingBundle=null;
    for (    BundleDescriptor bundle : app.getBundleDescriptors()) {
      if ((bundle instanceof EjbBundleDescriptor) || (bundle instanceof WebBundleDescriptor)) {
        JndiNameEnvironment jndiEnv=(JndiNameEnvironment)bundle;
        for (        InjectionCapable next : jndiEnv.getInjectableResourcesByClass(declaringClass.getName())) {
          if (next.getComponentEnvName().equals(envDependencyName)) {
            matchingBundle=bundle;
            break;
          }
        }
      }
      if (matchingBundle != null) {
        break;
      }
    }
    if (matchingBundle == null) {
      throw new IllegalArgumentException("String_Node_Str" + member + "String_Node_Str"+ app.getAppName());
    }
    String componentId=compEnvManager.getComponentEnvId((JndiNameEnvironment)matchingBundle);
    String lookupName=envDependencyName.startsWith("String_Node_Str") ? envDependencyName : "String_Node_Str" + envDependencyName;
    result=namingManager.lookup(componentId,lookupName);
  }
  return result;
}

Fixed version (ground truth):
public Object resolveInjectionPoint(java.lang.reflect.Member member,Application app) throws javax.naming.NamingException {
  if (member == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (app == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Object result=null;
  Field field=null;
  Method method=null;
  Annotation[] annotations;
  if (member instanceof Field) {
    field=(Field)member;
    annotations=field.getDeclaredAnnotations();
  }
 else   if (member instanceof Method) {
    method=(Method)member;
    annotations=method.getDeclaredAnnotations();
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Annotation envAnnotation=getEnvAnnotation(annotations);
  if (envAnnotation == null) {
    throw new IllegalArgumentException("String_Node_Str" + member);
  }
  String envAnnotationName=null;
  try {
    Method m=envAnnotation.annotationType().getDeclaredMethod("String_Node_Str");
    envAnnotationName=(String)m.invoke(envAnnotation);
  }
 catch (  Exception e) {
    throw new IllegalArgumentException("String_Node_Str" + envAnnotation.toString(),e);
  }
  String envDependencyName=envAnnotationName;
  Class declaringClass=member.getDeclaringClass();
  if ((envAnnotationName == null) || envAnnotationName.equals("String_Node_Str")) {
    if (field != null) {
      envDependencyName=declaringClass.getName() + "String_Node_Str" + field.getName();
    }
 else {
      envDependencyName=declaringClass.getName() + "String_Node_Str" + getInjectionMethodPropertyName(method);
    }
  }
  if (envAnnotationName != null && envAnnotationName.startsWith("String_Node_Str")) {
    javax.naming.Context ic=namingManager.getInitialContext();
    result=ic.lookup(envAnnotationName);
  }
 else {
    BundleDescriptor matchingBundle=null;
    for (    BundleDescriptor bundle : app.getBundleDescriptors()) {
      if ((bundle instanceof EjbBundleDescriptor) || (bundle instanceof WebBundleDescriptor)) {
        JndiNameEnvironment jndiEnv=(JndiNameEnvironment)bundle;
        for (        InjectionCapable next : jndiEnv.getInjectableResourcesByClass(declaringClass.getName())) {
          if (next.getComponentEnvName().equals(envDependencyName)) {
            matchingBundle=bundle;
            break;
          }
        }
      }
      if (matchingBundle != null) {
        break;
      }
    }
    if (matchingBundle == null) {
      throw new IllegalArgumentException("String_Node_Str" + member + "String_Node_Str"+ app.getAppName());
    }
    String componentId=compEnvManager.getComponentEnvId((JndiNameEnvironment)matchingBundle);
    String lookupName=envDependencyName.startsWith("String_Node_Str") ? envDependencyName : "String_Node_Str" + envDependencyName;
    result=namingManager.lookup(componentId,lookupName);
  }
  return result;
}