Program: 67251
Project: 67251
Buggy source:
public void updateGlobalElements(JavaClass[] classesToProcess){
  for (  JavaClass javaClass : classesToProcess) {
    TypeInfo info=typeInfo.get(javaClass.getQualifiedName());
    if (info == null) {
      continue;
    }
    if (!info.isTransient() && info.isSetXmlRootElement()) {
      org.eclipse.persistence.jaxb.xmlmodel.XmlRootElement xmlRE=info.getXmlRootElement();
      NamespaceInfo namespaceInfo;
      namespaceInfo=getNamespaceInfoForPackage(javaClass);
      String elementName=xmlRE.getName();
      if (elementName.equals("String_Node_Str") || elementName.equals("String_Node_Str")) {
        if (javaClass.getName().indexOf("String_Node_Str") != -1) {
          elementName=Introspector.decapitalize(javaClass.getName().substring(javaClass.getName().lastIndexOf('$') + 1));
        }
 else {
          elementName=Introspector.decapitalize(javaClass.getName().substring(javaClass.getName().lastIndexOf('.') + 1));
        }
        if (elementName.length() >= 3) {
          int idx=elementName.length() - 1;
          char ch=elementName.charAt(idx - 1);
          if (Character.isDigit(ch)) {
            char lastCh=Character.toUpperCase(elementName.charAt(idx));
            elementName=elementName.substring(0,idx) + lastCh;
          }
        }
      }
      String rootNamespace=xmlRE.getNamespace();
      QName rootElemName=null;
      if (rootNamespace.equals("String_Node_Str")) {
        if (namespaceInfo == null) {
          rootElemName=new QName(elementName);
        }
 else {
          rootElemName=new QName(namespaceInfo.getNamespace(),elementName);
        }
      }
 else {
        rootElemName=new QName(rootNamespace,elementName);
      }
      ElementDeclaration declaration=new ElementDeclaration(rootElemName,javaClass,javaClass.getQualifiedName(),false);
      declaration.setIsXmlRootElement(true);
      if (this.globalElements == null) {
        globalElements=new HashMap<QName,ElementDeclaration>();
      }
      this.globalElements.put(rootElemName,declaration);
      this.xmlRootElements.put(javaClass.getQualifiedName(),declaration);
    }
  }
  if (this.globalElements == null) {
    return;
  }
  Iterator<QName> elementQnames=this.globalElements.keySet().iterator();
  while (elementQnames.hasNext()) {
    QName next=elementQnames.next();
    ElementDeclaration nextDeclaration=this.globalElements.get(next);
    if (nextDeclaration.getSubstitutionHead() != null) {
      ElementDeclaration rootDeclaration=this.globalElements.get(nextDeclaration.getSubstitutionHead());
      rootDeclaration.addSubstitutableElement(nextDeclaration);
    }
  }
}

Fixed version (ground truth):
public void updateGlobalElements(JavaClass[] classesToProcess){
  for (  JavaClass javaClass : classesToProcess) {
    TypeInfo info=typeInfo.get(javaClass.getQualifiedName());
    if (info == null) {
      continue;
    }
    if (!info.isTransient() && info.isSetXmlRootElement()) {
      org.eclipse.persistence.jaxb.xmlmodel.XmlRootElement xmlRE=info.getXmlRootElement();
      NamespaceInfo namespaceInfo;
      namespaceInfo=getNamespaceInfoForPackage(javaClass);
      String elementName=xmlRE.getName();
      if (elementName.equals("String_Node_Str") || elementName.equals("String_Node_Str")) {
        if (javaClass.getName().indexOf("String_Node_Str") != -1) {
          elementName=Introspector.decapitalize(javaClass.getName().substring(javaClass.getName().lastIndexOf('$') + 1));
        }
 else {
          elementName=Introspector.decapitalize(javaClass.getName().substring(javaClass.getName().lastIndexOf('.') + 1));
        }
        if (elementName.length() >= 3) {
          int idx=elementName.length() - 1;
          char ch=elementName.charAt(idx - 1);
          if (Character.isDigit(ch)) {
            char lastCh=Character.toUpperCase(elementName.charAt(idx));
            elementName=elementName.substring(0,idx) + lastCh;
          }
        }
      }
      String rootNamespace=xmlRE.getNamespace();
      QName rootElemName=null;
      if (rootNamespace.equals("String_Node_Str")) {
        if (namespaceInfo == null) {
          rootElemName=new QName(elementName);
        }
 else {
          rootElemName=new QName(namespaceInfo.getNamespace(),elementName);
        }
      }
 else {
        rootElemName=new QName(rootNamespace,elementName);
      }
      ElementDeclaration declaration=new ElementDeclaration(rootElemName,javaClass,javaClass.getQualifiedName(),false);
      declaration.setIsXmlRootElement(true);
      if (this.globalElements == null) {
        globalElements=new HashMap<QName,ElementDeclaration>();
      }
      this.globalElements.put(rootElemName,declaration);
      this.xmlRootElements.put(javaClass.getQualifiedName(),declaration);
    }
  }
  if (this.globalElements == null) {
    return;
  }
  Iterator<QName> elementQnames=this.globalElements.keySet().iterator();
  while (elementQnames.hasNext()) {
    QName next=elementQnames.next();
    ElementDeclaration nextDeclaration=this.globalElements.get(next);
    QName substitutionHead=nextDeclaration.getSubstitutionHead();
    while (substitutionHead != null) {
      ElementDeclaration rootDeclaration=this.globalElements.get(substitutionHead);
      rootDeclaration.addSubstitutableElement(nextDeclaration);
      substitutionHead=rootDeclaration.getSubstitutionHead();
    }
  }
}