Program: 67188
Project: 67188
Buggy source:
/** 
 * Process a given XMLDirectMapping.
 * @param mapping
 * @param seq
 * @param ct
 * @param workingSchema
 */
protected void processXMLDirectMapping(XMLDirectMapping mapping,Sequence seq,ComplexType ct,HashMap<String,Schema> schemaForNamespace,Schema workingSchema,SchemaModelGeneratorProperties properties){
  XPathFragment frag=((XMLField)mapping.getField()).getXPathFragment();
  if (frag.isSelfFragment()) {
    return;
  }
  boolean isPk=isFragPrimaryKey(frag,mapping);
  String schemaTypeString=null;
  if (isPk) {
    schemaTypeString=XMLConstants.SCHEMA_PREFIX + COLON + ID;
  }
 else {
    schemaTypeString=getSchemaTypeForDirectMapping(mapping,workingSchema);
  }
  Class attributeClassification=mapping.getAttributeClassification();
  if (attributeClassification != null && Enum.class.isAssignableFrom(attributeClassification)) {
    Converter converter=mapping.getConverter();
    if (converter != null && converter instanceof EnumTypeConverter) {
      processEnumeration(schemaTypeString,frag,mapping,seq,ct,workingSchema,converter);
      return;
    }
  }
  if (frag.isAttribute()) {
    Attribute attr=buildAttribute(mapping,schemaTypeString);
    ct.getOrderedAttributes().add(attr);
  }
 else {
    seq=buildSchemaComponentsForXPath(frag,seq,schemaForNamespace,workingSchema,properties);
    frag=getTargetXPathFragment(frag);
    Element elem=elementExistsInSequence(frag.getLocalName(),frag.getShortName(),seq);
    if (elem == null) {
      if (frag.getNamespaceURI() != null) {
        elem=handleFragNamespace(frag,schemaForNamespace,workingSchema,properties,elem,schemaTypeString);
      }
 else {
        elem=buildElement(frag,schemaTypeString,Occurs.ZERO,null);
      }
      seq.addElement(elem);
    }
  }
}

Fixed version (ground truth):
/** 
 * Process a given XMLDirectMapping.
 * @param mapping
 * @param seq
 * @param ct
 * @param workingSchema
 */
protected void processXMLDirectMapping(XMLDirectMapping mapping,Sequence seq,ComplexType ct,HashMap<String,Schema> schemaForNamespace,Schema workingSchema,SchemaModelGeneratorProperties properties){
  XPathFragment frag=((XMLField)mapping.getField()).getXPathFragment();
  if (frag.isSelfFragment()) {
    return;
  }
  boolean isPk=isFragPrimaryKey(frag,mapping);
  String schemaTypeString=null;
  if (isPk) {
    schemaTypeString=XMLConstants.SCHEMA_PREFIX + COLON + ID;
  }
 else {
    schemaTypeString=getSchemaTypeForDirectMapping(mapping,workingSchema);
  }
  Class attributeClassification=mapping.getAttributeClassification();
  if (attributeClassification != null && Enum.class.isAssignableFrom(attributeClassification)) {
    Converter converter=mapping.getConverter();
    if (converter != null && converter instanceof EnumTypeConverter) {
      processEnumeration(schemaTypeString,frag,mapping,seq,ct,workingSchema,converter);
      return;
    }
  }
  if (frag.isAttribute()) {
    Attribute attr=buildAttribute(mapping,schemaTypeString);
    ct.getOrderedAttributes().add(attr);
  }
 else {
    seq=buildSchemaComponentsForXPath(frag,seq,schemaForNamespace,workingSchema,properties);
    frag=getTargetXPathFragment(frag);
    Element elem=elementExistsInSequence(frag.getLocalName(),frag.getShortName(),seq);
    if (elem == null) {
      if (frag.getNamespaceURI() != null) {
        elem=handleFragNamespace(frag,schemaForNamespace,workingSchema,properties,elem,schemaTypeString);
      }
 else {
        elem=buildElement(frag,schemaTypeString,Occurs.ZERO,null);
      }
      if (mapping.getNullPolicy().isNullRepresentedByXsiNil()) {
        elem.setNillable(true);
      }
      seq.addElement(elem);
    }
  }
}