Program: 66646
Project: 66646
Buggy source:
public void createElementsForTypeMappingInfo(){
  if (this.javaClassToTypeMappingInfos != null && !this.javaClassToTypeMappingInfos.isEmpty()) {
    Set<JavaClass> classes=this.javaClassToTypeMappingInfos.keySet();
    for (    JavaClass nextClass : classes) {
      TypeMappingInfo nextInfo=this.javaClassToTypeMappingInfos.get(nextClass);
      if (nextInfo != null) {
        boolean xmlAttachmentRef=false;
        String xmlMimeType=null;
        java.lang.annotation.Annotation[] annotations=getAnnotations(nextInfo);
        Class adapterClass=this.typeMappingInfoToAdapterClasses.get(nextInfo);
        if (annotations != null) {
          for (int j=0; j < annotations.length; j++) {
            java.lang.annotation.Annotation nextAnnotation=annotations[j];
            if (nextAnnotation != null) {
              if (nextAnnotation instanceof XmlMimeType) {
                XmlMimeType javaAnnotation=(XmlMimeType)nextAnnotation;
                xmlMimeType=javaAnnotation.value();
              }
 else               if (nextAnnotation instanceof XmlAttachmentRef) {
                xmlAttachmentRef=true;
              }
            }
          }
        }
        if (nextInfo.getXmlTagName() != null) {
          ElementDeclaration element=new ElementDeclaration(nextInfo.getXmlTagName(),nextClass,nextClass.getQualifiedName(),false);
          element.setTypeMappingInfo(nextInfo);
          element.setXmlMimeType(xmlMimeType);
          element.setXmlAttachmentRef(xmlAttachmentRef);
          if (adapterClass != null) {
            Method[] tacMethods=adapterClass.getMethods();
            Class declJavaType=Object.class;
            for (int i=0; i < tacMethods.length; i++) {
              Method method=tacMethods[i];
              if (method.getName().equals("String_Node_Str")) {
                if (!(method.getReturnType() == declJavaType)) {
                  declJavaType=method.getReturnType();
                  break;
                }
              }
            }
            element.setJavaType(helper.getJavaClass(declJavaType));
          }
          Class generatedClass=typeMappingInfoToGeneratedClasses.get(nextInfo);
          if (generatedClass != null) {
            element.setJavaType(helper.getJavaClass(generatedClass));
          }
          if (nextInfo.getElementScope() == TypeMappingInfo.ElementScope.Global) {
            this.globalElements.put(element.getElementName(),element);
          }
 else {
            this.localElements.add(element);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public void createElementsForTypeMappingInfo(){
  if (this.javaClassToTypeMappingInfos != null && !this.javaClassToTypeMappingInfos.isEmpty()) {
    Set<JavaClass> classes=this.javaClassToTypeMappingInfos.keySet();
    for (    JavaClass nextClass : classes) {
      TypeMappingInfo nextInfo=this.javaClassToTypeMappingInfos.get(nextClass);
      if (nextInfo != null) {
        boolean xmlAttachmentRef=false;
        String xmlMimeType=null;
        java.lang.annotation.Annotation[] annotations=getAnnotations(nextInfo);
        Class adapterClass=this.typeMappingInfoToAdapterClasses.get(nextInfo);
        if (annotations != null) {
          for (int j=0; j < annotations.length; j++) {
            java.lang.annotation.Annotation nextAnnotation=annotations[j];
            if (nextAnnotation != null) {
              if (nextAnnotation instanceof XmlMimeType) {
                XmlMimeType javaAnnotation=(XmlMimeType)nextAnnotation;
                xmlMimeType=javaAnnotation.value();
              }
 else               if (nextAnnotation instanceof XmlAttachmentRef) {
                xmlAttachmentRef=true;
              }
            }
          }
        }
        if (nextInfo.getXmlTagName() != null) {
          ElementDeclaration element=new ElementDeclaration(nextInfo.getXmlTagName(),nextClass,nextClass.getQualifiedName(),false);
          element.setTypeMappingInfo(nextInfo);
          element.setXmlMimeType(xmlMimeType);
          element.setXmlAttachmentRef(xmlAttachmentRef);
          if (adapterClass != null) {
            Method[] tacMethods=PrivilegedAccessHelper.getMethods(adapterClass);
            Class declJavaType=Object.class;
            for (int i=0; i < tacMethods.length; i++) {
              Method method=tacMethods[i];
              if (method.getName().equals("String_Node_Str")) {
                if (!(PrivilegedAccessHelper.getMethodReturnType(method) == declJavaType)) {
                  declJavaType=method.getReturnType();
                  break;
                }
              }
            }
            element.setJavaType(helper.getJavaClass(declJavaType));
          }
          Class generatedClass=typeMappingInfoToGeneratedClasses.get(nextInfo);
          if (generatedClass != null) {
            element.setJavaType(helper.getJavaClass(generatedClass));
          }
          if (nextInfo.getElementScope() == TypeMappingInfo.ElementScope.Global) {
            this.globalElements.put(element.getElementName(),element);
          }
 else {
            this.localElements.add(element);
          }
        }
      }
    }
  }
}