Program: 67318
Project: 67318
Buggy source:
public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver){
  Object objectValue=directMapping.getAttributeValueFromObject(object);
  Object fieldValue=directMapping.getFieldValue(objectValue,session);
  if ((null == fieldValue) || (null == namespaceResolver)) {
    return false;
  }
  XMLField xmlField=(XMLField)directMapping.getField();
  QName schemaType=getSchemaType(xmlField,fieldValue,session);
  if (null == schemaType) {
    return false;
  }
  if (xmlField.getSchemaType() == null) {
    if (schemaType.equals(XMLConstants.STRING_QNAME)) {
      return false;
    }
  }
 else {
    if (xmlField.isSchemaType(schemaType)) {
      return false;
    }
  }
  XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
  String typeQName=namespaceResolver.resolveNamespaceURI(XMLConstants.SCHEMA_INSTANCE_URL) + "String_Node_Str";
  String schemaTypePrefix=namespaceResolver.resolveNamespaceURI(schemaType.getNamespaceURI());
  if (schemaTypePrefix == null) {
    if (XMLConstants.SCHEMA_URL.equals(schemaType.getNamespaceURI())) {
      schemaTypePrefix=namespaceResolver.generatePrefix(XMLConstants.SCHEMA_PREFIX);
    }
 else {
      schemaTypePrefix=namespaceResolver.generatePrefix();
    }
    marshalRecord.attribute(XMLConstants.XMLNS_URL,XMLConstants.XMLNS_URL,XMLConstants.XMLNS + "String_Node_Str" + schemaTypePrefix,schemaType.getNamespaceURI());
  }
  marshalRecord.attribute(XMLConstants.SCHEMA_INSTANCE_URL,schemaType.getLocalPart(),typeQName,schemaTypePrefix + ':' + schemaType.getLocalPart());
  marshalRecord.closeStartGroupingElements(groupingFragment);
  return true;
}

Fixed version (ground truth):
public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver){
  Object objectValue=directMapping.getAttributeValueFromObject(object);
  Object fieldValue=directMapping.getFieldValue(objectValue,session);
  if ((null == fieldValue) || (null == namespaceResolver)) {
    return false;
  }
  XMLField xmlField=(XMLField)directMapping.getField();
  QName schemaType=getSchemaType(xmlField,fieldValue,session);
  if (null == schemaType) {
    return false;
  }
  if (xmlField.getSchemaType() == null) {
    if (schemaType.equals(XMLConstants.STRING_QNAME)) {
      return false;
    }
  }
 else {
    if (xmlField.isSchemaType(schemaType)) {
      return false;
    }
  }
  XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
  String typeQName=namespaceResolver.resolveNamespaceURI(XMLConstants.SCHEMA_INSTANCE_URL) + "String_Node_Str";
  String schemaTypePrefix=namespaceResolver.resolveNamespaceURI(schemaType.getNamespaceURI());
  if (schemaTypePrefix == null) {
    if (XMLConstants.SCHEMA_URL.equals(schemaType.getNamespaceURI())) {
      schemaTypePrefix=namespaceResolver.generatePrefix(XMLConstants.SCHEMA_PREFIX);
    }
 else {
      schemaTypePrefix=namespaceResolver.generatePrefix();
    }
    marshalRecord.attribute(XMLConstants.XMLNS_URL,schemaTypePrefix,XMLConstants.XMLNS + "String_Node_Str" + schemaTypePrefix,schemaType.getNamespaceURI());
  }
  marshalRecord.attribute(XMLConstants.SCHEMA_INSTANCE_URL,"String_Node_Str",typeQName,schemaTypePrefix + ':' + schemaType.getLocalPart());
  marshalRecord.closeStartGroupingElements(groupingFragment);
  return true;
}