Program: 67844
Project: 67844
Buggy source:
public void updateGlobalElements(ArrayList<JavaClass> classesToProcess){
  for (  JavaClass javaClass : classesToProcess) {
    if (helper.isAnnotationPresent(javaClass,XmlRootElement.class)) {
      XmlRootElement rootElemAnnotation=(XmlRootElement)helper.getAnnotation(javaClass,XmlRootElement.class);
      NamespaceInfo namespaceInfo;
      JavaPackage pack=javaClass.getPackage();
      namespaceInfo=this.packageToNamespaceMappings.get(pack.getQualifiedName());
      String elementName=rootElemAnnotation.name();
      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));
        }
      }
      String rootNamespace=rootElemAnnotation.namespace();
      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.getRawName());
      declaration.setIsXmlRootElement(true);
      if (this.globalElements == null) {
        globalElements=new HashMap<QName,ElementDeclaration>();
      }
      this.globalElements.put(rootElemName,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(ArrayList<JavaClass> classesToProcess){
  for (  JavaClass javaClass : classesToProcess) {
    if (helper.isAnnotationPresent(javaClass,XmlRootElement.class)) {
      XmlRootElement rootElemAnnotation=(XmlRootElement)helper.getAnnotation(javaClass,XmlRootElement.class);
      NamespaceInfo namespaceInfo;
      JavaPackage pack=javaClass.getPackage();
      namespaceInfo=this.packageToNamespaceMappings.get(pack.getQualifiedName());
      String elementName=rootElemAnnotation.name();
      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));
        }
      }
      String rootNamespace=rootElemAnnotation.namespace();
      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.getRawName(),false);
      declaration.setIsXmlRootElement(true);
      if (this.globalElements == null) {
        globalElements=new HashMap<QName,ElementDeclaration>();
      }
      this.globalElements.put(rootElemName,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);
    }
  }
}