Program: 66555
Project: 66555
Buggy source:
public void initTypeToSchemaType(){
  this.typeToSchemaType=new HashMap<Type,QName>();
  if (typeToTypeMappingInfo == null || typeToTypeMappingInfo.size() == 0) {
    return;
  }
  Iterator descriptors=xmlContext.getSession(0).getProject().getOrderedDescriptors().iterator();
  while (descriptors.hasNext()) {
    XMLDescriptor next=(XMLDescriptor)descriptors.next();
    Class javaClass=next.getJavaClass();
    if (next.getSchemaReference() != null) {
      QName schemaType=next.getSchemaReference().getSchemaContextAsQName(next.getNamespaceResolver());
      Type type=null;
      if (generator != null) {
        type=generator.getAnnotationsProcessor().getGeneratedClassesToCollectionClasses().get(javaClass);
        if (type == null) {
          JavaClass arrayClass=(JavaClass)generator.getAnnotationsProcessor().getGeneratedClassesToArrayClasses().get(javaClass);
          if (arrayClass != null) {
            String arrayClassName=arrayClass.getName();
            try {
              type=PrivilegedAccessHelper.getClassForName(arrayClassName);
            }
 catch (            Exception ex) {
            }
          }
          if (type == null && getTypeMappingInfoToGeneratedType() != null) {
            Iterator<Map.Entry<TypeMappingInfo,Class>> iter=getTypeMappingInfoToGeneratedType().entrySet().iterator();
            while (iter.hasNext()) {
              Map.Entry<TypeMappingInfo,Class> entry=iter.next();
              if (entry.getValue().equals(javaClass)) {
                type=entry.getKey().getType();
                break;
              }
            }
          }
        }
        if (type == null) {
          type=javaClass;
        }
      }
 else {
        type=javaClass;
      }
      this.typeToSchemaType.put(type,schemaType);
    }
  }
  if (boundTypes != null) {
    for (    TypeMappingInfo next : this.boundTypes) {
      if (this.typeToSchemaType.get(next) == null) {
        Type nextType=next.getType();
        QName name=getSchemaTypeForTypeMappingInfo(nextType);
        if (name != null) {
          this.typeToSchemaType.put(nextType,name);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Populate the map of which Type corresponds to which QName. The keys should be all the boundTypes used to create the JAXBContext. If the JAXBContext was not created with the constructor that takes a Type[] then  this Map will be empty.
 */
public void initTypeToSchemaType(){
  this.typeToSchemaType=new HashMap<Type,QName>();
  if (typeToTypeMappingInfo == null || typeToTypeMappingInfo.size() == 0) {
    return;
  }
  Iterator descriptors=xmlContext.getSession(0).getProject().getOrderedDescriptors().iterator();
  while (descriptors.hasNext()) {
    XMLDescriptor next=(XMLDescriptor)descriptors.next();
    Class javaClass=next.getJavaClass();
    if (next.getSchemaReference() != null) {
      QName schemaType=next.getSchemaReference().getSchemaContextAsQName(next.getNamespaceResolver());
      Type type=null;
      if (generator != null) {
        type=generator.getAnnotationsProcessor().getGeneratedClassesToCollectionClasses().get(javaClass);
        if (type == null) {
          JavaClass arrayClass=(JavaClass)generator.getAnnotationsProcessor().getGeneratedClassesToArrayClasses().get(javaClass);
          if (arrayClass != null) {
            String arrayClassName=arrayClass.getName();
            try {
              type=PrivilegedAccessHelper.getClassForName(arrayClassName);
            }
 catch (            Exception ex) {
            }
          }
          if (type == null && getTypeMappingInfoToGeneratedType() != null) {
            Iterator<Map.Entry<TypeMappingInfo,Class>> iter=getTypeMappingInfoToGeneratedType().entrySet().iterator();
            while (iter.hasNext()) {
              Map.Entry<TypeMappingInfo,Class> entry=iter.next();
              if (entry.getValue().equals(javaClass)) {
                type=entry.getKey().getType();
                break;
              }
            }
          }
        }
        if (type == null) {
          type=javaClass;
        }
      }
 else {
        type=javaClass;
      }
      this.typeToSchemaType.put(type,schemaType);
    }
  }
  if (boundTypes != null) {
    for (    TypeMappingInfo next : this.boundTypes) {
      if (this.typeToSchemaType.get(next) == null) {
        Type nextType=next.getType();
        QName name=getSchemaTypeForTypeMappingInfo(nextType);
        if (name != null) {
          this.typeToSchemaType.put(nextType,name);
        }
      }
    }
  }
}