Program: 67847
Project: 67847
Buggy source:
public void processGlobalElements(Project project){
  if (this.globalElements == null) {
    return;
  }
  Iterator<QName> keys=this.globalElements.keySet().iterator();
  while (keys.hasNext()) {
    QName next=keys.next();
    ElementDeclaration nextElement=this.globalElements.get(next);
    String nextClassName=nextElement.getJavaTypeName();
    TypeInfo type=this.typeInfo.get(nextClassName);
    if (type != null) {
      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=descriptor.getNamespaceResolver().resolveNamespaceURI(uri);
        if (prefix == null) {
          prefix=descriptor.getNamespaceResolver().generatePrefix();
          descriptor.getNamespaceResolver().put(prefix,uri);
        }
        descriptor.addRootElement(prefix + "String_Node_Str" + next.getLocalPart());
      }
    }
 else     if (helper.isBuiltInJavaType(nextElement.getJavaType())) {
      String namespaceUri=next.getNamespaceURI();
      if (namespaceUri == null || namespaceUri.equals("String_Node_Str")) {
        namespaceUri="String_Node_Str";
      }
      Class generatedClass=this.generateWrapperClass(WRAPPER_CLASS + wrapperCounter++,nextClassName);
      this.generatedClassesToQNames.put(generatedClass,next);
      XMLDescriptor desc=new XMLDescriptor();
      desc.setJavaClass(generatedClass);
      XMLDirectMapping mapping=new XMLDirectMapping();
      mapping.setAttributeName("String_Node_Str");
      mapping.setXPath("String_Node_Str");
      if (nextClassName.equals("String_Node_Str") || nextClassName.equals("String_Node_Str")) {
        ((XMLField)mapping.getField()).setSchemaType(XMLConstants.BASE_64_BINARY_QNAME);
      }
      desc.addMapping(mapping);
      NamespaceInfo info=getNamespaceInfoForURI(namespaceUri);
      if (info != null) {
        NamespaceResolver resolver=info.getNamespaceResolver();
        String prefix=resolver.resolveNamespaceURI(namespaceUri);
        desc.setNamespaceResolver(resolver);
        desc.setDefaultRootElement(prefix + "String_Node_Str" + next.getLocalPart());
      }
 else {
        if (namespaceUri.equals("String_Node_Str")) {
          desc.setDefaultRootElement(next.getLocalPart());
        }
 else {
          NamespaceResolver resolver=new NamespaceResolver();
          String prefix=resolver.generatePrefix();
          resolver.put(prefix,namespaceUri);
          desc.setNamespaceResolver(resolver);
          desc.setDefaultRootElement(prefix + "String_Node_Str" + next.getLocalPart());
        }
      }
      project.addDescriptor(desc);
    }
  }
}

Fixed version (ground truth):
public void processGlobalElements(Project project){
  if (this.globalElements == null) {
    return;
  }
  Iterator<QName> keys=this.globalElements.keySet().iterator();
  while (keys.hasNext()) {
    QName next=keys.next();
    ElementDeclaration nextElement=this.globalElements.get(next);
    String nextClassName=nextElement.getJavaTypeName();
    TypeInfo type=this.typeInfo.get(nextClassName);
    if (type != null) {
      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=descriptor.getNamespaceResolver().resolveNamespaceURI(uri);
        if (prefix == null) {
          prefix=descriptor.getNamespaceResolver().generatePrefix();
          descriptor.getNamespaceResolver().put(prefix,uri);
        }
        descriptor.addRootElement(prefix + "String_Node_Str" + next.getLocalPart());
      }
    }
 else     if (helper.isBuiltInJavaType(nextElement.getJavaType())) {
      String namespaceUri=next.getNamespaceURI();
      if (namespaceUri == null || namespaceUri.equals("String_Node_Str")) {
        namespaceUri="String_Node_Str";
      }
      Class generatedClass=this.generateWrapperClass(WRAPPER_CLASS + wrapperCounter++,nextClassName,nextElement.isList());
      this.generatedClassesToQNames.put(generatedClass,next);
      XMLDescriptor desc=new XMLDescriptor();
      desc.setJavaClass(generatedClass);
      if (nextElement.isList()) {
        XMLCompositeDirectCollectionMapping mapping=new XMLCompositeDirectCollectionMapping();
        mapping.setAttributeName("String_Node_Str");
        mapping.setXPath("String_Node_Str");
        mapping.setUsesSingleNode(true);
        try {
          Class fieldElementClass=PrivilegedAccessHelper.getClassForName(nextClassName,false,helper.getClassLoader());
          mapping.setFieldElementClass(fieldElementClass);
        }
 catch (        ClassNotFoundException e) {
        }
        if (nextClassName.equals("String_Node_Str") || nextClassName.equals("String_Node_Str")) {
          ((XMLField)mapping.getField()).setSchemaType(XMLConstants.BASE_64_BINARY_QNAME);
        }
        desc.addMapping(mapping);
      }
 else {
        XMLDirectMapping mapping=new XMLDirectMapping();
        mapping.setAttributeName("String_Node_Str");
        mapping.setXPath("String_Node_Str");
        if (nextClassName.equals("String_Node_Str") || nextClassName.equals("String_Node_Str")) {
          ((XMLField)mapping.getField()).setSchemaType(XMLConstants.BASE_64_BINARY_QNAME);
        }
        desc.addMapping(mapping);
      }
      NamespaceInfo info=getNamespaceInfoForURI(namespaceUri);
      if (info != null) {
        NamespaceResolver resolver=info.getNamespaceResolver();
        String prefix=resolver.resolveNamespaceURI(namespaceUri);
        desc.setNamespaceResolver(resolver);
        desc.setDefaultRootElement(prefix + "String_Node_Str" + next.getLocalPart());
      }
 else {
        if (namespaceUri.equals("String_Node_Str")) {
          desc.setDefaultRootElement(next.getLocalPart());
        }
 else {
          NamespaceResolver resolver=new NamespaceResolver();
          String prefix=resolver.generatePrefix();
          resolver.put(prefix,namespaceUri);
          desc.setNamespaceResolver(resolver);
          desc.setDefaultRootElement(prefix + "String_Node_Str" + next.getLocalPart());
        }
      }
      project.addDescriptor(desc);
    }
  }
}