Program: 65888
Project: 65888
Buggy source:
/** 
 * Create a JAXBElement instance.  If the object is an instance of XMLRoot, we will use its field values to create the JAXBElement.  If the object is not an XMLRoot instance, we will have to determine the 'name' value.  This will be done using the object's descriptor default root element - any prefix will be resolved, and a QName created.
 * @param obj
 * @return
 */
private JAXBElement buildJAXBElementFromObject(Object obj,Class declaredClass){
  if (obj instanceof XMLRoot) {
    JAXBElement jaxbElement=createJAXBElementFromXMLRoot(((XMLRoot)obj),declaredClass);
    if (((XMLRoot)obj).isNil()) {
      jaxbElement.setNil(((XMLRoot)obj).isNil());
      jaxbElement.setValue(null);
    }
    return jaxbElement;
  }
  if (obj instanceof JAXBElement) {
    return (JAXBElement)obj;
  }
  org.eclipse.persistence.sessions.Session sess=xmlUnmarshaller.getXMLContext().getSession(obj);
  XMLDescriptor desc=(XMLDescriptor)sess.getClassDescriptor(obj);
  String rootName=desc.getDefaultRootElement();
  if (rootName == null) {
    return createJAXBElement(new QName("String_Node_Str"),obj.getClass(),obj);
  }
  String rootNamespaceUri=null;
  int idx=rootName.indexOf("String_Node_Str");
  if (idx != -1) {
    rootNamespaceUri=desc.getNamespaceResolver().resolveNamespacePrefix(rootName.substring(0,idx));
    rootName=rootName.substring(idx + 1);
  }
  QName qname;
  if (rootNamespaceUri == null) {
    qname=new QName(rootName);
  }
 else {
    qname=new QName(rootNamespaceUri,rootName);
  }
  return createJAXBElement(qname,obj.getClass(),obj);
}

Fixed version (ground truth):
/** 
 * Create a JAXBElement instance.  If the object is an instance of XMLRoot, we will use its field values to create the JAXBElement.  If the object is not an XMLRoot instance, we will have to determine the 'name' value.  This will be done using the object's descriptor default root element - any prefix will be resolved, and a QName created.
 * @param obj
 * @return
 */
private JAXBElement buildJAXBElementFromObject(Object obj,Class declaredClass){
  if (obj instanceof XMLRoot) {
    JAXBElement jaxbElement=createJAXBElementFromXMLRoot(((XMLRoot)obj),declaredClass);
    if (((XMLRoot)obj).isNil()) {
      jaxbElement.setNil(((XMLRoot)obj).isNil());
      jaxbElement.setValue(null);
    }
    return jaxbElement;
  }
  if (obj instanceof JAXBElement) {
    return (JAXBElement)obj;
  }
  org.eclipse.persistence.sessions.Session sess=xmlUnmarshaller.getXMLContext().getSession(obj);
  XMLDescriptor desc=(XMLDescriptor)sess.getClassDescriptor(obj);
  String rootName=desc.getDefaultRootElement();
  if (rootName == null) {
    return createJAXBElement(new QName("String_Node_Str"),obj.getClass(),obj);
  }
  String rootNamespaceUri=null;
  int idx=rootName.indexOf("String_Node_Str");
  if (idx != -1) {
    rootNamespaceUri=desc.getNamespaceResolver().resolveNamespacePrefix(rootName.substring(0,idx));
    rootName=rootName.substring(idx + 1);
  }
  QName qname;
  if (rootNamespaceUri == null) {
    qname=new QName(rootName);
  }
 else {
    qname=new QName(rootNamespaceUri,rootName);
  }
  if (declaredClass != null) {
    return createJAXBElement(qname,declaredClass,obj);
  }
 else {
    return createJAXBElement(qname,obj.getClass(),obj);
  }
}