Program: 68840
Project: 68840
Buggy source:
public void writeSingleValue(Object attributeValue,Object parent,XMLRecord row,AbstractSession session){
  DirectMapContainerPolicy cp=(DirectMapContainerPolicy)this.getContainerPolicy();
  if ((attributeValue == null) || (cp.sizeFor(attributeValue) == 0)) {
    return;
  }
  DOMRecord record=(DOMRecord)row;
  if (record.getDOM().getNodeType() != Node.ELEMENT_NODE) {
    return;
  }
  Element root=(Element)record.getDOM();
  if (field != null) {
    root=(Element)XPathEngine.getInstance().create((XMLField)getField(),root);
  }
  for (Object iter=cp.iteratorFor(attributeValue); cp.hasNext(iter); ) {
    Object key=cp.next(iter,session);
    if ((key != null) && key instanceof QName) {
      Object value=cp.valueFromKey(key,attributeValue);
      QName attributeName=(QName)key;
      String namespaceURI=attributeName.getNamespaceURI();
      String qualifiedName=attributeName.getLocalPart();
      NamespaceResolver nr=((XMLDescriptor)getDescriptor()).getNamespaceResolver();
      if (nr != null) {
        String prefix=nr.resolveNamespaceURI(attributeName.getNamespaceURI());
        if ((prefix != null) && !prefix.equals("String_Node_Str")) {
          qualifiedName=prefix + "String_Node_Str" + qualifiedName;
        }
      }
      if (namespaceURI != null) {
        root.setAttributeNS(namespaceURI,qualifiedName,value.toString());
      }
 else {
        root.setAttribute(attributeName.getLocalPart(),value.toString());
      }
    }
  }
}

Fixed version (ground truth):
public void writeSingleValue(Object attributeValue,Object parent,XMLRecord row,AbstractSession session){
  DirectMapContainerPolicy cp=(DirectMapContainerPolicy)this.getContainerPolicy();
  if ((attributeValue == null) || (cp.sizeFor(attributeValue) == 0)) {
    return;
  }
  DOMRecord record=(DOMRecord)row;
  if (record.getDOM().getNodeType() != Node.ELEMENT_NODE) {
    return;
  }
  Element root=(Element)record.getDOM();
  if (field != null) {
    root=(Element)XPathEngine.getInstance().create((XMLField)getField(),root);
  }
  List extraNamespaces=new ArrayList();
  NamespaceResolver nr=row.getNamespaceResolver();
  for (Object iter=cp.iteratorFor(attributeValue); cp.hasNext(iter); ) {
    Object key=cp.next(iter,session);
    if ((key != null) && key instanceof QName) {
      Object value=cp.valueFromKey(key,attributeValue);
      QName attributeName=(QName)key;
      String namespaceURI=attributeName.getNamespaceURI();
      String qualifiedName=attributeName.getLocalPart();
      if (nr != null) {
        String prefix=nr.resolveNamespaceURI(attributeName.getNamespaceURI());
        if ((prefix != null) && !prefix.equals("String_Node_Str")) {
          qualifiedName=prefix + "String_Node_Str" + qualifiedName;
        }
 else         if (attributeName.getNamespaceURI() != null && !attributeName.getNamespaceURI().equals("String_Node_Str")) {
          String generatedPrefix=nr.generatePrefix();
          qualifiedName=generatedPrefix + "String_Node_Str" + qualifiedName;
          nr.put(generatedPrefix,attributeName.getNamespaceURI());
          extraNamespaces.add(new Namespace(generatedPrefix,attributeName.getNamespaceURI()));
          row.getNamespaceResolver().put(generatedPrefix,attributeName.getNamespaceURI());
        }
      }
      if (namespaceURI != null) {
        root.setAttributeNS(namespaceURI,qualifiedName,value.toString());
      }
 else {
        root.setAttribute(attributeName.getLocalPart(),value.toString());
      }
    }
  }
  ((XMLObjectBuilder)descriptor.getObjectBuilder()).writeExtraNamespaces(extraNamespaces,row,session);
  ((XMLObjectBuilder)descriptor.getObjectBuilder()).removeExtraNamespacesFromNamespaceResolver(row,extraNamespaces,session);
}