Program: 66626
Project: 66626
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) {
            Class declJavaType=CompilerHelper.getTypeFromAdapterClass(adapterClass);
            if (declJavaType != null) {
              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);
        Class declJavaType=null;
        if (adapterClass != null) {
          declJavaType=CompilerHelper.getTypeFromAdapterClass(adapterClass);
        }
        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;
              }
            }
          }
        }
        QName qname=null;
        String nextClassName=nextClass.getRawName();
        if (declJavaType != null) {
          nextClassName=declJavaType.getCanonicalName();
        }
        if (typeMappingInfoToGeneratedClasses != null) {
          Class generatedClass=typeMappingInfoToGeneratedClasses.get(nextInfo);
          if (generatedClass != null) {
            nextClassName=generatedClass.getCanonicalName();
          }
        }
        TypeInfo nextTypeInfo=typeInfo.get(nextClassName);
        if (nextTypeInfo != null) {
          qname=new QName(nextTypeInfo.getClassNamespace(),nextTypeInfo.getSchemaTypeName());
        }
 else {
          qname=getUserDefinedSchemaTypes().get(nextClassName);
          if (qname == null) {
            if (nextClassName.equals(ClassConstants.ABYTE.getCanonicalName()) || nextClassName.equals(ClassConstants.APBYTE.getCanonicalName()) || nextClassName.equals(Image.class.getCanonicalName())|| nextClassName.equals(Source.class.getCanonicalName())|| nextClassName.equals("String_Node_Str")) {
              if (xmlAttachmentRef) {
                qname=XMLConstants.SWA_REF_QNAME;
              }
 else {
                qname=XMLConstants.BASE_64_BINARY_QNAME;
              }
            }
 else             if (nextClassName.equals(ClassConstants.OBJECT.getCanonicalName())) {
              qname=XMLConstants.ANY_TYPE_QNAME;
            }
 else {
              Class theClass=helper.getClassForJavaClass(nextClass);
              qname=(QName)XMLConversionManager.getDefaultJavaTypes().get(theClass);
            }
          }
        }
        if (qname != null) {
          typeMappingInfoToSchemaType.put(nextInfo,qname);
        }
        if (nextInfo.getXmlTagName() != null) {
          ElementDeclaration element=new ElementDeclaration(nextInfo.getXmlTagName(),nextClass,nextClass.getQualifiedName(),false);
          element.setTypeMappingInfo(nextInfo);
          element.setXmlMimeType(xmlMimeType);
          element.setXmlAttachmentRef(xmlAttachmentRef);
          if (declJavaType != null) {
            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);
          }
        }
      }
    }
  }
}