Program: 66740
Project: 66740
Buggy source:
public void processGlobalElements(Project project){
  if (this.globalElements == null) {
    return;
  }
  List<ElementDeclaration> elements=new ArrayList<ElementDeclaration>();
  elements.addAll(this.localElements);
  elements.addAll(this.globalElements.values());
  for (  ElementDeclaration nextElement : elements) {
    QName next=nextElement.getElementName();
    String nextClassName=nextElement.getJavaTypeName();
    TypeInfo type=this.typeInfo.get(nextClassName);
    if (helper.isBuiltInJavaType(nextElement.getJavaType()) || (type != null && type.isEnumerationType())) {
      String attributeTypeName=nextClassName;
      if (nextElement.getAdaptedJavaTypeName() != null) {
        attributeTypeName=nextElement.getAdaptedJavaTypeName();
      }
      if (next == null) {
        if (areEquals(nextElement.getJavaType(),ClassConstants.ABYTE) || areEquals(nextElement.getJavaType(),ClassConstants.APBYTE) || areEquals(nextElement.getJavaType(),"String_Node_Str")) {
          Class generatedClass=addByteArrayWrapperAndDescriptor(type,nextElement.getJavaType().getRawName(),nextElement,nextClassName,attributeTypeName);
          this.qNamesToGeneratedClasses.put(next,generatedClass);
          if (nextElement.getTypeMappingInfo() != null) {
            typeMappingInfoToGeneratedClasses.put(nextElement.getTypeMappingInfo(),generatedClass);
          }
          try {
            Class declaredClass=PrivilegedAccessHelper.getClassForName(nextClassName,false,helper.getClassLoader());
            this.qNamesToDeclaredClasses.put(next,declaredClass);
          }
 catch (          Exception e) {
          }
          return;
        }
      }
      Class generatedClass=generateWrapperClassAndDescriptor(type,next,nextElement,nextClassName,attributeTypeName);
      this.qNamesToGeneratedClasses.put(next,generatedClass);
      if (nextElement.getTypeMappingInfo() != null) {
        typeMappingInfoToGeneratedClasses.put(nextElement.getTypeMappingInfo(),generatedClass);
      }
      try {
        Class declaredClass=PrivilegedAccessHelper.getClassForName(nextClassName,false,helper.getClassLoader());
        this.qNamesToDeclaredClasses.put(next,declaredClass);
      }
 catch (      Exception e) {
      }
    }
 else     if (type != null && !type.isTransient()) {
      if (next.getNamespaceURI() == null || next.getNamespaceURI().equals("String_Node_Str")) {
        type.getDescriptor().addRootElement(next.getLocalPart());
      }
 else {
        XMLDescriptor descriptor=type.getDescriptor();
        String uri=next.getNamespaceURI();
        String prefix=getPrefixForNamespace(uri,descriptor.getNamespaceResolver(),null);
        descriptor.addRootElement(getQualifiedString(prefix,next.getLocalPart()));
      }
    }
  }
}

Fixed version (ground truth):
public void processGlobalElements(Project project){
  if (this.globalElements == null && this.localElements == null) {
    return;
  }
  List<ElementDeclaration> elements=new ArrayList<ElementDeclaration>();
  elements.addAll(this.localElements);
  elements.addAll(this.globalElements.values());
  for (  ElementDeclaration nextElement : elements) {
    QName next=nextElement.getElementName();
    String nextClassName=nextElement.getJavaTypeName();
    TypeInfo type=this.typeInfo.get(nextClassName);
    if (helper.isBuiltInJavaType(nextElement.getJavaType()) || (type != null && type.isEnumerationType())) {
      String attributeTypeName=nextClassName;
      if (nextElement.getJavaType().isPrimitive()) {
        attributeTypeName=helper.getClassForJavaClass(nextElement.getJavaType()).getName();
      }
      if (nextElement.getAdaptedJavaTypeName() != null) {
        attributeTypeName=nextElement.getAdaptedJavaTypeName();
      }
      if (next == null) {
        if (areEquals(nextElement.getJavaType(),ClassConstants.ABYTE) || areEquals(nextElement.getJavaType(),ClassConstants.APBYTE) || areEquals(nextElement.getJavaType(),"String_Node_Str")) {
          Class generatedClass=addByteArrayWrapperAndDescriptor(type,nextElement.getJavaType().getRawName(),nextElement,nextClassName,attributeTypeName);
          this.qNamesToGeneratedClasses.put(next,generatedClass);
          if (nextElement.getTypeMappingInfo() != null) {
            typeMappingInfoToGeneratedClasses.put(nextElement.getTypeMappingInfo(),generatedClass);
          }
          try {
            Class declaredClass=PrivilegedAccessHelper.getClassForName(nextClassName,false,helper.getClassLoader());
            this.qNamesToDeclaredClasses.put(next,declaredClass);
          }
 catch (          Exception e) {
          }
          return;
        }
      }
      Class generatedClass=generateWrapperClassAndDescriptor(type,next,nextElement,nextClassName,attributeTypeName);
      this.qNamesToGeneratedClasses.put(next,generatedClass);
      if (nextElement.getTypeMappingInfo() != null) {
        typeMappingInfoToGeneratedClasses.put(nextElement.getTypeMappingInfo(),generatedClass);
      }
      try {
        Class declaredClass=PrivilegedAccessHelper.getClassForName(nextClassName,false,helper.getClassLoader());
        this.qNamesToDeclaredClasses.put(next,declaredClass);
      }
 catch (      Exception e) {
      }
    }
 else     if (type != null && !type.isTransient()) {
      if (next.getNamespaceURI() == null || next.getNamespaceURI().equals("String_Node_Str")) {
        type.getDescriptor().addRootElement(next.getLocalPart());
      }
 else {
        XMLDescriptor descriptor=type.getDescriptor();
        String uri=next.getNamespaceURI();
        String prefix=getPrefixForNamespace(uri,descriptor.getNamespaceResolver(),null);
        descriptor.addRootElement(getQualifiedString(prefix,next.getLocalPart()));
      }
    }
  }
}