Program: 64400
Project: 64400
Buggy source:
public boolean marshalSingleValue(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,Object objectValue,CoreAbstractSession session,NamespaceResolver namespaceResolver,MarshalContext marshalContext){
  Object fieldValue=directMapping.getFieldValue(objectValue,(AbstractSession)session);
  if ((null == fieldValue) || (null == namespaceResolver)) {
    return false;
  }
  Field xmlField=(Field)directMapping.getField();
  QName schemaType=getSchemaType(xmlField,fieldValue,session);
  if (null == schemaType) {
    return false;
  }
  if (xmlField.getSchemaType() == null) {
    if (schemaType.equals(Constants.STRING_QNAME)) {
      return false;
    }
  }
 else {
    if (xmlField.isSchemaType(schemaType)) {
      return false;
    }
  }
  XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
  String typeQName=namespaceResolver.resolveNamespaceURI(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI) + Constants.COLON + Constants.SCHEMA_TYPE_ATTRIBUTE;
  String schemaTypePrefix=namespaceResolver.resolveNamespaceURI(schemaType.getNamespaceURI());
  if (schemaTypePrefix == null) {
    if (javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(schemaType.getNamespaceURI())) {
      schemaTypePrefix=namespaceResolver.generatePrefix(Constants.SCHEMA_PREFIX);
    }
 else {
      schemaTypePrefix=namespaceResolver.generatePrefix();
    }
    marshalRecord.namespaceDeclaration(schemaTypePrefix,schemaType.getNamespaceURI());
  }
  marshalRecord.attribute(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI,Constants.SCHEMA_TYPE_ATTRIBUTE,typeQName,schemaTypePrefix + Constants.COLON + schemaType.getLocalPart());
  marshalRecord.closeStartGroupingElements(groupingFragment);
  return true;
}

Fixed version (ground truth):
public boolean marshalSingleValue(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,Object objectValue,CoreAbstractSession session,NamespaceResolver namespaceResolver,MarshalContext marshalContext){
  Object fieldValue=directMapping.getFieldValue(objectValue,session,marshalRecord);
  if ((null == fieldValue) || (null == namespaceResolver)) {
    return false;
  }
  Field xmlField=(Field)directMapping.getField();
  QName schemaType=getSchemaType(xmlField,fieldValue,session);
  if (null == schemaType) {
    return false;
  }
  if (xmlField.getSchemaType() == null) {
    if (schemaType.equals(Constants.STRING_QNAME)) {
      return false;
    }
  }
 else {
    if (xmlField.isSchemaType(schemaType)) {
      return false;
    }
  }
  XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
  String typeQName=namespaceResolver.resolveNamespaceURI(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI) + Constants.COLON + Constants.SCHEMA_TYPE_ATTRIBUTE;
  String schemaTypePrefix=namespaceResolver.resolveNamespaceURI(schemaType.getNamespaceURI());
  if (schemaTypePrefix == null) {
    if (javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(schemaType.getNamespaceURI())) {
      schemaTypePrefix=namespaceResolver.generatePrefix(Constants.SCHEMA_PREFIX);
    }
 else {
      schemaTypePrefix=namespaceResolver.generatePrefix();
    }
    marshalRecord.namespaceDeclaration(schemaTypePrefix,schemaType.getNamespaceURI());
  }
  marshalRecord.attribute(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI,Constants.SCHEMA_TYPE_ATTRIBUTE,typeQName,schemaTypePrefix + Constants.COLON + schemaType.getLocalPart());
  marshalRecord.closeStartGroupingElements(groupingFragment);
  return true;
}