Program: 68048
Project: 68048
Buggy source:
/** 
 * INTERNAL:
 */
public void storeXMLDescriptorByQName(XMLDescriptor xmlDescriptor){
  QName descriptorQName;
  String defaultRootName;
  Vector tableNames=xmlDescriptor.getTableNames();
  for (int i=0; i < tableNames.size(); i++) {
    defaultRootName=(String)tableNames.get(i);
    if (null != defaultRootName) {
      int index=defaultRootName.indexOf(':');
      String defaultRootLocalName=defaultRootName.substring(index + 1);
      if (index > -1) {
        String defaultRootPrefix=defaultRootName.substring(0,index);
        String defaultRootNamespaceURI=xmlDescriptor.getNamespaceResolver().resolveNamespacePrefix(defaultRootPrefix);
        descriptorQName=new QName(defaultRootNamespaceURI,defaultRootLocalName);
      }
 else {
        if (xmlDescriptor.getNamespaceResolver() != null) {
          descriptorQName=new QName(xmlDescriptor.getNamespaceResolver().getDefaultNamespaceURI(),defaultRootLocalName);
        }
 else {
          descriptorQName=new QName(defaultRootLocalName);
        }
      }
      if (!xmlDescriptor.hasInheritance() || xmlDescriptor.getInheritancePolicy().isRootParentDescriptor()) {
        descriptorsByQName.put(descriptorQName,xmlDescriptor);
      }
 else {
        XMLDescriptor existingDescriptor=(XMLDescriptor)descriptorsByQName.get(descriptorQName);
        if (existingDescriptor == null) {
          descriptorsByQName.put(descriptorQName,xmlDescriptor);
        }
      }
    }
  }
  XMLSchemaReference xmlSchemaReference=xmlDescriptor.getSchemaReference();
  if (null != xmlSchemaReference) {
    String schemaContext=xmlSchemaReference.getSchemaContext();
    if ((xmlSchemaReference.getType() == XMLSchemaReference.COMPLEX_TYPE) || (xmlSchemaReference.getType() == XMLSchemaReference.SIMPLE_TYPE)) {
      if ((null != schemaContext) && (schemaContext.lastIndexOf('/') == 0)) {
        schemaContext=schemaContext.substring(1,schemaContext.length());
        XPathFragment typeFragment=new XPathFragment(schemaContext);
        if (null != xmlDescriptor.getNamespaceResolver()) {
          typeFragment.setNamespaceURI(xmlDescriptor.getNamespaceResolver().resolveNamespacePrefix(typeFragment.getPrefix()));
        }
        this.descriptorsByGlobalType.put(typeFragment,xmlDescriptor);
      }
 else {
        QName qname=xmlSchemaReference.getSchemaContextAsQName();
        if (qname != null) {
          XPathFragment typeFragment=new XPathFragment();
          typeFragment.setLocalName(qname.getLocalPart());
          typeFragment.setNamespaceURI(qname.getNamespaceURI());
          this.descriptorsByGlobalType.put(typeFragment,xmlDescriptor);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void storeXMLDescriptorByQName(XMLDescriptor xmlDescriptor){
  QName descriptorQName;
  String defaultRootName;
  Vector tableNames=xmlDescriptor.getTableNames();
  for (int i=0; i < tableNames.size(); i++) {
    defaultRootName=(String)tableNames.get(i);
    if (null != defaultRootName) {
      int index=defaultRootName.indexOf(':');
      String defaultRootLocalName=defaultRootName.substring(index + 1);
      if (index > -1) {
        String defaultRootPrefix=defaultRootName.substring(0,index);
        String defaultRootNamespaceURI=xmlDescriptor.getNamespaceResolver().resolveNamespacePrefix(defaultRootPrefix);
        descriptorQName=new QName(defaultRootNamespaceURI,defaultRootLocalName);
      }
 else {
        if (xmlDescriptor.getNamespaceResolver() != null) {
          descriptorQName=new QName(xmlDescriptor.getNamespaceResolver().getDefaultNamespaceURI(),defaultRootLocalName);
        }
 else {
          descriptorQName=new QName(defaultRootLocalName);
        }
      }
      if (!xmlDescriptor.hasInheritance() || xmlDescriptor.getInheritancePolicy().isRootParentDescriptor()) {
        descriptorsByQName.put(descriptorQName,xmlDescriptor);
      }
 else {
        XMLDescriptor existingDescriptor=(XMLDescriptor)descriptorsByQName.get(descriptorQName);
        if (existingDescriptor == null) {
          descriptorsByQName.put(descriptorQName,xmlDescriptor);
        }
      }
    }
  }
  XMLSchemaReference xmlSchemaReference=xmlDescriptor.getSchemaReference();
  if (null != xmlSchemaReference) {
    String schemaContext=xmlSchemaReference.getSchemaContext();
    if ((xmlSchemaReference.getType() == XMLSchemaReference.COMPLEX_TYPE) || (xmlSchemaReference.getType() == XMLSchemaReference.SIMPLE_TYPE)) {
      if ((null != schemaContext) && (schemaContext.lastIndexOf('/') == 0)) {
        schemaContext=schemaContext.substring(1,schemaContext.length());
        XPathFragment typeFragment=new XPathFragment(schemaContext);
        if (null != xmlDescriptor.getNamespaceResolver()) {
          typeFragment.setNamespaceURI(xmlDescriptor.getNamespaceResolver().resolveNamespacePrefix(typeFragment.getPrefix()));
        }
        this.descriptorsByGlobalType.put(typeFragment,xmlDescriptor);
      }
 else {
        QName qname=xmlSchemaReference.getSchemaContextAsQName();
        if (qname != null) {
          if (xmlDescriptor.isWrapper() && xmlDescriptor.getJavaClassName().contains("String_Node_Str")) {
            return;
          }
          XPathFragment typeFragment=new XPathFragment();
          typeFragment.setLocalName(qname.getLocalPart());
          typeFragment.setNamespaceURI(qname.getNamespaceURI());
          this.descriptorsByGlobalType.put(typeFragment,xmlDescriptor);
        }
      }
    }
  }
}