Program: 30110
Project: 30110
Buggy source:
/** 
 * Process a particular annotation whose type is the same as the one returned by @see getAnnotationType(). All information pertinent to the annotation and its context is encapsulated in the passed AnnotationInfo instance.
 * @param ainfo the annotation information
 * @param rcContexts an array of ResourceContainerContext
 * @param ejbAn
 * @return HandlerProcessingResult
 */
protected HandlerProcessingResult processEJB(AnnotationInfo ainfo,ResourceContainerContext[] rcContexts,EJB ejbAn) throws AnnotationProcessorException {
  EjbReferenceDescriptor ejbRefs[]=null;
  String defaultLogicalName=null;
  Class defaultBeanInterface=null;
  InjectionTarget target=null;
  if (ElementType.FIELD.equals(ainfo.getElementType())) {
    Field f=(Field)ainfo.getAnnotatedElement();
    String targetClassName=f.getDeclaringClass().getName();
    defaultLogicalName=targetClassName + "String_Node_Str" + f.getName();
    defaultBeanInterface=f.getType();
    target=new InjectionTarget();
    target.setClassName(targetClassName);
    target.setFieldName(f.getName());
    target.setMetadataSource(MetadataSource.ANNOTATION);
  }
 else   if (ElementType.METHOD.equals(ainfo.getElementType())) {
    Method m=(Method)ainfo.getAnnotatedElement();
    String targetClassName=m.getDeclaringClass().getName();
    validateInjectionMethod(m,ainfo);
    String propertyName=getInjectionMethodPropertyName(m,ainfo);
    defaultLogicalName=targetClassName + "String_Node_Str" + propertyName;
    defaultBeanInterface=m.getParameterTypes()[0];
    target=new InjectionTarget();
    target.setClassName(targetClassName);
    target.setMethodName(m.getName());
    target.setMetadataSource(MetadataSource.ANNOTATION);
  }
 else   if (ElementType.TYPE.equals(ainfo.getElementType())) {
    if (ejbAn.name().equals("String_Node_Str") || ejbAn.beanInterface() == Object.class) {
      Class c=(Class)ainfo.getAnnotatedElement();
      log(Level.SEVERE,ainfo,localStrings.getLocalString("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str",new Object[]{ejbAn.name(),ejbAn.beanInterface(),c}));
      return getDefaultFailedResult();
    }
  }
 else {
    return getDefaultFailedResult();
  }
  Class beanInterface=(ejbAn.beanInterface() == Object.class) ? defaultBeanInterface : ejbAn.beanInterface();
  String logicalName=ejbAn.name().equals("String_Node_Str") ? defaultLogicalName : ejbAn.name();
  ejbRefs=getEjbReferenceDescriptors(logicalName,rcContexts);
  for (  EjbReferenceDescriptor ejbRef : ejbRefs) {
    if (target != null)     ejbRef.addInjectionTarget(target);
    if (!ok(ejbRef.getName()))     ejbRef.setName(logicalName);
    setEjbType(ejbRef,beanInterface);
    if (!ok(ejbRef.getDescription()) && ok(ejbAn.description()))     ejbRef.setDescription(ejbAn.description());
    if (!ejbRef.hasLookupName() && ok(ejbAn.lookup()))     ejbRef.setLookupName(ejbAn.lookup());
    if (!ok(ejbRef.getMappedName()) && ok(ejbAn.mappedName()))     ejbRef.setMappedName(ejbAn.mappedName());
    if (!ok(ejbRef.getLinkName()) && ok(ejbAn.beanName()))     ejbRef.setLinkName(ejbAn.beanName());
  }
  return getDefaultProcessedResult();
}

Fixed version (ground truth):
/** 
 * Process a particular annotation whose type is the same as the one returned by @see getAnnotationType(). All information pertinent to the annotation and its context is encapsulated in the passed AnnotationInfo instance.
 * @param ainfo the annotation information
 * @param rcContexts an array of ResourceContainerContext
 * @param ejbAn
 * @return HandlerProcessingResult
 */
protected HandlerProcessingResult processEJB(AnnotationInfo ainfo,ResourceContainerContext[] rcContexts,EJB ejbAn) throws AnnotationProcessorException {
  EjbReferenceDescriptor ejbRefs[]=null;
  String defaultLogicalName=null;
  Class defaultBeanInterface=null;
  InjectionTarget target=null;
  if (ElementType.FIELD.equals(ainfo.getElementType())) {
    Field f=(Field)ainfo.getAnnotatedElement();
    String targetClassName=f.getDeclaringClass().getName();
    defaultLogicalName=targetClassName + "String_Node_Str" + f.getName();
    defaultBeanInterface=f.getType();
    target=new InjectionTarget();
    target.setClassName(targetClassName);
    target.setFieldName(f.getName());
    target.setMetadataSource(MetadataSource.ANNOTATION);
  }
 else   if (ElementType.METHOD.equals(ainfo.getElementType())) {
    Method m=(Method)ainfo.getAnnotatedElement();
    String targetClassName=m.getDeclaringClass().getName();
    validateInjectionMethod(m,ainfo);
    String propertyName=getInjectionMethodPropertyName(m,ainfo);
    defaultLogicalName=targetClassName + "String_Node_Str" + propertyName;
    defaultBeanInterface=m.getParameterTypes()[0];
    target=new InjectionTarget();
    target.setClassName(targetClassName);
    target.setMethodName(m.getName());
    target.setMetadataSource(MetadataSource.ANNOTATION);
  }
 else   if (ElementType.TYPE.equals(ainfo.getElementType())) {
    if (ejbAn.name().equals("String_Node_Str") || ejbAn.beanInterface() == Object.class) {
      Class c=(Class)ainfo.getAnnotatedElement();
      AnnotationProcessorException fatalException=new AnnotationProcessorException(localStrings.getLocalString("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str",new Object[]{ejbAn.name(),ejbAn.beanInterface(),c}),ainfo);
      fatalException.setFatal(true);
      throw fatalException;
    }
  }
 else {
    return getDefaultFailedResult();
  }
  Class beanInterface=(ejbAn.beanInterface() == Object.class) ? defaultBeanInterface : ejbAn.beanInterface();
  String logicalName=ejbAn.name().equals("String_Node_Str") ? defaultLogicalName : ejbAn.name();
  ejbRefs=getEjbReferenceDescriptors(logicalName,rcContexts);
  for (  EjbReferenceDescriptor ejbRef : ejbRefs) {
    if (target != null)     ejbRef.addInjectionTarget(target);
    if (!ok(ejbRef.getName()))     ejbRef.setName(logicalName);
    setEjbType(ejbRef,beanInterface);
    if (!ok(ejbRef.getDescription()) && ok(ejbAn.description()))     ejbRef.setDescription(ejbAn.description());
    if (!ejbRef.hasLookupName() && ok(ejbAn.lookup()))     ejbRef.setLookupName(ejbAn.lookup());
    if (!ok(ejbRef.getMappedName()) && ok(ejbAn.mappedName()))     ejbRef.setMappedName(ejbAn.mappedName());
    if (!ok(ejbRef.getLinkName()) && ok(ejbAn.beanName()))     ejbRef.setLinkName(ejbAn.beanName());
  }
  return getDefaultProcessedResult();
}