nus-yam/ex-repair huggingface dataset:
Program: 66092
Project: 66092
Buggy source:
public void fatalError(SAXParseException exception) throws SAXException {
  if (null == exception) {
    throw exception;
  }
  errorHandler.fatalError(marshalSAXParseException(exception));
}

Fixed version (ground truth):
public void fatalError(SAXParseException exception) throws SAXException {
  if (null == errorHandler) {
    throw exception;
  }
  errorHandler.fatalError(marshalSAXParseException(exception));
}
Program: 66093
Project: 66093
Buggy source:
public void error(SAXParseException exception) throws SAXException {
  if (null == exception) {
    throw exception;
  }
  errorHandler.error(marshalSAXParseException(exception));
}

Fixed version (ground truth):
public void error(SAXParseException exception) throws SAXException {
  if (null == errorHandler) {
    throw exception;
  }
  errorHandler.error(marshalSAXParseException(exception));
}
Program: 66094
Project: 66094
Buggy source:
public static JAXBException incorrectNumberOfXmlJoinNodesOnXmlElements(String propertyName,String className){
  Object[] args={propertyName,className};
  JAXBException validationException=new JAXBException(ExceptionMessageGenerator.buildMessage(JAXBException.class,INCORRECT_NUMBER_OF_XMLJOINNODES_ON_XMLELEMENTS,args));
  validationException.setErrorCode(INCORRECT_NUMBER_OF_XMLJOINNODES_ON_XMLELEMENTS);
  return validationException;
}

Fixed version (ground truth):
/** 
 * PUBLIC: Cause: There is a different number of XmlElements and XmlJoinNodes entries in a given XmlElementsJoinNodes.  There must be an equal number of each.
 * @param propertyName name of the Property containing the XmlElementsJoinNodes
 * @param className name of the owning class
 * @return
 */
public static JAXBException incorrectNumberOfXmlJoinNodesOnXmlElements(String propertyName,String className){
  Object[] args={propertyName,className};
  JAXBException validationException=new JAXBException(ExceptionMessageGenerator.buildMessage(JAXBException.class,INCORRECT_NUMBER_OF_XMLJOINNODES_ON_XMLELEMENTS,args));
  validationException.setErrorCode(INCORRECT_NUMBER_OF_XMLJOINNODES_ON_XMLELEMENTS);
  return validationException;
}
Program: 66095
Project: 66095
Buggy source:
/** 
 * The underlying choice element node value will handle attributes.
 */
public void attribute(UnmarshalRecord unmarshalRecord,String URI,String localName,String value){
  this.choiceElementNodeValue.attribute(unmarshalRecord,URI,localName,value);
}

Fixed version (ground truth):
/** 
 * The underlying choice element node value will handle attributes.
 */
public void attribute(UnmarshalRecord unmarshalRecord,String URI,String localName,String value){
  unmarshalRecord.removeNullCapableValue(this.nullCapableNodeValue);
  this.choiceElementNodeValue.attribute(unmarshalRecord,URI,localName,value);
}
Program: 66096
Project: 66096
Buggy source:
private void addChoiceElementMapping(XMLField xmlField,Class theClass){
  if (xmlField.getLastXPathFragment().nameIsText()) {
    XMLCompositeDirectCollectionMapping xmlMapping=new XMLCompositeDirectCollectionMapping();
    xmlMapping.setAttributeElementClass(theClass);
    xmlMapping.setField(xmlField);
    xmlMapping.setAttributeAccessor(temporaryAccessor);
    this.choiceElementMappings.put(xmlField,xmlMapping);
  }
 else {
    if (isBinaryType(theClass)) {
      XMLBinaryDataCollectionMapping xmlMapping=new XMLBinaryDataCollectionMapping();
      xmlMapping.setField(xmlField);
      xmlMapping.setAttributeElementClass(theClass);
      xmlMapping.setAttributeAccessor(temporaryAccessor);
      this.fieldsToConverters.put(xmlField,xmlMapping.getValueConverter());
      this.choiceElementMappings.put(xmlField,xmlMapping);
    }
 else {
      XMLCompositeCollectionMapping xmlMapping=new XMLCompositeCollectionMapping();
      if (!theClass.equals(ClassConstants.OBJECT)) {
        xmlMapping.setReferenceClass(theClass);
      }
      xmlMapping.setField(xmlField);
      xmlMapping.setAttributeAccessor(temporaryAccessor);
      this.choiceElementMappings.put(xmlField,xmlMapping);
    }
  }
}

Fixed version (ground truth):
private void addChoiceElementMapping(XMLField xmlField,Class theClass){
  if (xmlField.getLastXPathFragment().nameIsText() || xmlField.getLastXPathFragment().isAttribute()) {
    XMLCompositeDirectCollectionMapping xmlMapping=new XMLCompositeDirectCollectionMapping();
    xmlMapping.setAttributeElementClass(theClass);
    xmlMapping.setField(xmlField);
    xmlMapping.setAttributeAccessor(temporaryAccessor);
    this.choiceElementMappings.put(xmlField,xmlMapping);
  }
 else {
    if (isBinaryType(theClass)) {
      XMLBinaryDataCollectionMapping xmlMapping=new XMLBinaryDataCollectionMapping();
      xmlMapping.setField(xmlField);
      xmlMapping.setAttributeElementClass(theClass);
      xmlMapping.setAttributeAccessor(temporaryAccessor);
      this.fieldsToConverters.put(xmlField,xmlMapping.getValueConverter());
      this.choiceElementMappings.put(xmlField,xmlMapping);
    }
 else {
      XMLCompositeCollectionMapping xmlMapping=new XMLCompositeCollectionMapping();
      if (!theClass.equals(ClassConstants.OBJECT)) {
        xmlMapping.setReferenceClass(theClass);
      }
      xmlMapping.setField(xmlField);
      xmlMapping.setAttributeAccessor(temporaryAccessor);
      this.choiceElementMappings.put(xmlField,xmlMapping);
    }
  }
}
Program: 66097
Project: 66097
Buggy source:
public XMLInlineBinaryHandler(UnmarshalRecord parent,NodeValue nodeValue,DatabaseMapping mapping,Converter converter,boolean isCollection){
  super(null);
  this.nodeValue=nodeValue;
  this.isCollection=isCollection;
  this.mapping=mapping;
  this.parent=parent;
  this.setUnmarshaller(parent.getUnmarshaller());
}

Fixed version (ground truth):
public XMLInlineBinaryHandler(UnmarshalRecord parent,NodeValue nodeValue,DatabaseMapping mapping,Converter converter,boolean isCollection){
  super(null);
  this.nodeValue=nodeValue;
  this.isCollection=isCollection;
  this.mapping=mapping;
  this.parent=parent;
  this.converter=converter;
  this.setUnmarshaller(parent.getUnmarshaller());
}
Program: 66099
Project: 66099
Buggy source:
/** 
 * INTERNAL: Get the QName which the given Type corresponds to. Valid types should be all the boundTypes used to create the JAXBContext. If the JAXBContext was not created with the construction that takes a Type[] then  this will be return null.
 */
private QName getSchemaTypeForTypeMappingInfo(Type type){
  QName name=null;
  if (type instanceof Class) {
    name=this.generator.getAnnotationsProcessor().getUserDefinedSchemaTypes().get(((Class)type).getName());
    if (name == null) {
      Class theClass=(Class)type;
      if (type == ClassConstants.ABYTE || type == ClassConstants.APBYTE || type == Image.class || type == Source.class || theClass.getCanonicalName().equals("String_Node_Str")) {
        name=XMLConstants.BASE_64_BINARY_QNAME;
      }
 else       if (type == ClassConstants.OBJECT) {
        name=XMLConstants.ANY_TYPE_QNAME;
      }
 else {
        name=(QName)XMLConversionManager.getDefaultJavaTypes().get(type);
      }
    }
  }
  return name;
}

Fixed version (ground truth):
/** 
 * INTERNAL: Get the QName which the given Type corresponds to. Valid types should be all the boundTypes used to create the JAXBContext. If the JAXBContext was not created with the construction that takes a Type[] then  this will be return null.
 */
private QName getSchemaTypeForTypeMappingInfo(Type type){
  QName name=null;
  if (type instanceof Class) {
    name=this.generator.getAnnotationsProcessor().getUserDefinedSchemaTypes().get(((Class)type).getName());
    if (name == null) {
      Class theClass=(Class)type;
      if (type == ClassConstants.ABYTE || type == ClassConstants.APBYTE || type == Image.class || type == Source.class || theClass.getCanonicalName().equals("String_Node_Str")) {
        name=XMLConstants.BASE_64_BINARY_QNAME;
      }
 else       if (type == ClassConstants.OBJECT) {
        name=XMLConstants.ANY_TYPE_QNAME;
      }
 else       if (type == ClassConstants.XML_GREGORIAN_CALENDAR) {
        name=XMLConstants.ANY_SIMPLE_TYPE_QNAME;
      }
 else {
        name=(QName)XMLConversionManager.getDefaultJavaTypes().get(type);
      }
    }
  }
  return name;
}
Program: 66105
Project: 66105
Buggy source:
protected void addNamespaceDeclaration(Element parentElement,String prefix,String uri){
  if (prefix.length() == 0) {
    parentElement.setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS,uri);
  }
 else {
    parentElement.setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS + XMLConstants.COLON + prefix,uri);
  }
}

Fixed version (ground truth):
protected void addNamespaceDeclaration(Element parentElement,String prefix,String uri){
  if (prefix.length() == 0 || XMLConstants.XMLNS.equals(prefix)) {
    parentElement.setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS,uri);
  }
 else {
    parentElement.setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS + XMLConstants.COLON + prefix,uri);
  }
}
Program: 66106
Project: 66106
Buggy source:
protected void addNamespaceDeclaration(Element parentElement,String prefix,String uri){
  if (prefix.length() == 0) {
    parentElement.setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS,uri);
  }
 else {
    parentElement.setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS + XMLConstants.COLON + prefix,uri);
  }
}

Fixed version (ground truth):
protected void addNamespaceDeclaration(Element parentElement,String prefix,String uri){
  if (prefix.length() == 0 || XMLConstants.XMLNS.equals(prefix)) {
    parentElement.setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS,uri);
  }
 else {
    parentElement.setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS + XMLConstants.COLON + prefix,uri);
  }
}
Program: 66107
Project: 66107
Buggy source:
public void testBindingFormatSource() throws Exception {
  Map<String,Object> properties=new HashMap<String,Object>();
  properties.put(JAXBContextFactory.ECLIPSELINK_OXM_XML_KEY,new StreamSource(SOURCE_OXM_XML));
  Class[] classes=new Class[]{org.eclipse.persistence.testing.jaxb.externalizedmetadata.jaxbcontextfactory.bindingformat.source.Foo.class};
  JAXBContext jCtx=(JAXBContext)JAXBContextFactory.createContext(classes,properties,loader);
  doTestSource(jCtx);
}

Fixed version (ground truth):
public void testBindingFormatSource() throws Exception {
  Map<String,Object> properties=new HashMap<String,Object>();
  InputStream is=ClassLoader.getSystemResourceAsStream(SOURCE_OXM_XML);
  properties.put(JAXBContextFactory.ECLIPSELINK_OXM_XML_KEY,new StreamSource(is));
  Class[] classes=new Class[]{org.eclipse.persistence.testing.jaxb.externalizedmetadata.jaxbcontextfactory.bindingformat.source.Foo.class};
  JAXBContext jCtx=(JAXBContext)JAXBContextFactory.createContext(classes,properties,loader);
  doTestSource(jCtx);
}
Program: 66108
Project: 66108
Buggy source:
protected void addNamespaceDeclaration(Element parentElement,String prefix,String uri){
  if (prefix.length() == 0 || XMLConstants.XMLNS.equals(prefix)) {
    parentElement.setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS,uri);
  }
 else {
    parentElement.setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS + XMLConstants.COLON + prefix,uri);
  }
}

Fixed version (ground truth):
protected void addNamespaceDeclaration(Element parentElement,String prefix,String uri){
  if (prefix.length() == 0) {
    parentElement.setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS,uri);
  }
 else {
    parentElement.setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS + XMLConstants.COLON + prefix,uri);
  }
}
Program: 66109
Project: 66109
Buggy source:
protected String getValueToWrite(QName schemaType,Object value,XMLConversionManager xmlConversionManager,NamespaceResolver namespaceResolver){
  if (schemaType != null && XMLConstants.QNAME_QNAME.equals(schemaType)) {
    return getStringForQName((QName)value,namespaceResolver);
  }
  return (String)xmlConversionManager.convertObject(value,ClassConstants.STRING,schemaType);
}

Fixed version (ground truth):
protected String getValueToWrite(QName schemaType,Object value,XMLConversionManager xmlConversionManager,MarshalRecord marshalRecord){
  if (schemaType != null && XMLConstants.QNAME_QNAME.equals(schemaType)) {
    return getStringForQName((QName)value,marshalRecord);
  }
  return (String)xmlConversionManager.convertObject(value,ClassConstants.STRING,schemaType);
}
Program: 66110
Project: 66110
Buggy source:
protected String getStringForQName(QName qName,NamespaceResolver namespaceResolver){
  if (null == qName) {
    return null;
  }
  if (null == qName.getNamespaceURI()) {
    return qName.getLocalPart();
  }
 else {
    String namespaceURI=qName.getNamespaceURI();
    if (namespaceResolver == null) {
      throw XMLMarshalException.namespaceResolverNotSpecified(namespaceURI);
    }
    String prefix=namespaceResolver.resolveNamespaceURI(namespaceURI);
    if (null == prefix) {
      return qName.getLocalPart();
    }
 else {
      return prefix + XMLConstants.COLON + qName.getLocalPart();
    }
  }
}

Fixed version (ground truth):
protected String getStringForQName(QName qName,MarshalRecord marshalRecord){
  if (null == qName) {
    return null;
  }
  String namespaceURI=qName.getNamespaceURI();
  if (null == namespaceURI) {
    return qName.getLocalPart();
  }
 else {
    NamespaceResolver namespaceResolver=marshalRecord.getNamespaceResolver();
    if (namespaceResolver == null) {
      throw XMLMarshalException.namespaceResolverNotSpecified(namespaceURI);
    }
    if (namespaceURI.equals(namespaceResolver.getDefaultNamespaceURI())) {
      return qName.getLocalPart();
    }
    String prefix=namespaceResolver.resolveNamespaceURI(namespaceURI);
    if (null == prefix) {
      prefix=namespaceResolver.generatePrefix();
      marshalRecord.attribute(XMLConstants.XMLNS_URL,prefix,XMLConstants.XMLNS + XMLConstants.COLON + prefix,namespaceURI);
    }
    return prefix + XMLConstants.COLON + qName.getLocalPart();
  }
}
Program: 66111
Project: 66111
Buggy source:
private void marshalSimpleValue(XPathFragment xmlRootFragment,MarshalRecord marshalRecord,Object originalValue,Object object,Object value,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlRootFragment != null) {
    QName qname=((XMLRoot)originalValue).getSchemaType();
    value=getValueToWrite(qname,value,(XMLConversionManager)session.getDatasourcePlatform().getConversionManager(),namespaceResolver);
    Namespace generatedNamespace=setupFragment((XMLRoot)originalValue,xmlRootFragment,marshalRecord);
    getXPathNode().startElement(marshalRecord,xmlRootFragment,object,session,namespaceResolver,null,null);
    if (generatedNamespace != null) {
      marshalRecord.attribute(XMLConstants.XMLNS_URL,generatedNamespace.getPrefix(),XMLConstants.XMLNS + XMLConstants.COLON + generatedNamespace.getPrefix(),generatedNamespace.getNamespaceURI());
    }
    updateNamespaces(qname,marshalRecord,null);
  }
  marshalRecord.characters((String)value);
  if (xmlRootFragment != null) {
    marshalRecord.endElement(xmlRootFragment,namespaceResolver);
  }
}

Fixed version (ground truth):
private void marshalSimpleValue(XPathFragment xmlRootFragment,MarshalRecord marshalRecord,Object originalValue,Object object,Object value,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlRootFragment != null) {
    QName qname=((XMLRoot)originalValue).getSchemaType();
    value=getValueToWrite(qname,value,(XMLConversionManager)session.getDatasourcePlatform().getConversionManager(),marshalRecord);
    Namespace generatedNamespace=setupFragment((XMLRoot)originalValue,xmlRootFragment,marshalRecord);
    getXPathNode().startElement(marshalRecord,xmlRootFragment,object,session,namespaceResolver,null,null);
    if (generatedNamespace != null) {
      marshalRecord.attribute(XMLConstants.XMLNS_URL,generatedNamespace.getPrefix(),XMLConstants.XMLNS + XMLConstants.COLON + generatedNamespace.getPrefix(),generatedNamespace.getNamespaceURI());
    }
    updateNamespaces(qname,marshalRecord,null);
  }
  marshalRecord.characters((String)value);
  if (xmlRootFragment != null) {
    marshalRecord.endElement(xmlRootFragment,namespaceResolver);
  }
}
Program: 66112
Project: 66112
Buggy source:
private void marshalSimpleValue(XPathFragment xmlRootFragment,MarshalRecord marshalRecord,Object originalValue,Object object,Object value,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlRootFragment != null) {
    QName qname=((XMLRoot)originalValue).getSchemaType();
    value=getValueToWrite(qname,value,(XMLConversionManager)session.getDatasourcePlatform().getConversionManager(),namespaceResolver);
    Namespace generatedNamespace=setupFragment(((XMLRoot)originalValue),xmlRootFragment,marshalRecord);
    getXPathNode().startElement(marshalRecord,xmlRootFragment,object,session,namespaceResolver,null,null);
    if (generatedNamespace != null) {
      marshalRecord.attribute(XMLConstants.XMLNS_URL,generatedNamespace.getPrefix(),XMLConstants.XMLNS + XMLConstants.COLON + generatedNamespace.getPrefix(),generatedNamespace.getNamespaceURI());
    }
    updateNamespaces(qname,marshalRecord,null);
  }
  if (value instanceof String) {
    marshalRecord.characters((String)value);
  }
 else {
    marshalRecord.node((org.w3c.dom.Node)value,marshalRecord.getNamespaceResolver());
  }
  if (xmlRootFragment != null) {
    marshalRecord.endElement(xmlRootFragment,namespaceResolver);
  }
}

Fixed version (ground truth):
private void marshalSimpleValue(XPathFragment xmlRootFragment,MarshalRecord marshalRecord,Object originalValue,Object object,Object value,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlRootFragment != null) {
    QName qname=((XMLRoot)originalValue).getSchemaType();
    value=getValueToWrite(qname,value,(XMLConversionManager)session.getDatasourcePlatform().getConversionManager(),marshalRecord);
    Namespace generatedNamespace=setupFragment(((XMLRoot)originalValue),xmlRootFragment,marshalRecord);
    getXPathNode().startElement(marshalRecord,xmlRootFragment,object,session,namespaceResolver,null,null);
    if (generatedNamespace != null) {
      marshalRecord.attribute(XMLConstants.XMLNS_URL,generatedNamespace.getPrefix(),XMLConstants.XMLNS + XMLConstants.COLON + generatedNamespace.getPrefix(),generatedNamespace.getNamespaceURI());
    }
    updateNamespaces(qname,marshalRecord,null);
  }
  if (value instanceof String) {
    marshalRecord.characters((String)value);
  }
 else {
    marshalRecord.node((org.w3c.dom.Node)value,marshalRecord.getNamespaceResolver());
  }
  if (xmlRootFragment != null) {
    marshalRecord.endElement(xmlRootFragment,namespaceResolver);
  }
}
Program: 66113
Project: 66113
Buggy source:
@Override public boolean marshalSingleValue(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,Object value,AbstractSession session,NamespaceResolver namespaceResolver,MarshalContext marshalContext){
  Object fieldValue=xmlCollectionReferenceMapping.buildFieldValue(value,xmlField,session);
  if (fieldValue == null) {
    if (null != value) {
      XMLField f2=(XMLField)xmlCollectionReferenceMapping.getSourceToTargetKeyFieldAssociations().get(xmlField);
      fieldValue=marshalRecord.getMarshaller().getXMLContext().getValueByXPath(value,f2.getXPath(),f2.getNamespaceResolver(),Object.class);
    }
    if (null == fieldValue) {
      return false;
    }
  }
  QName schemaType=getSchemaType(xmlField,fieldValue,session);
  String stringValue=getValueToWrite(schemaType,fieldValue,(XMLConversionManager)session.getDatasourcePlatform().getConversionManager(),namespaceResolver);
  if (stringValue != null) {
    if (xPathFragment.isAttribute()) {
      marshalRecord.attribute(xPathFragment,namespaceResolver,stringValue);
      marshalRecord.closeStartElement();
    }
 else {
      marshalRecord.closeStartElement();
      marshalRecord.characters(stringValue);
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean marshalSingleValue(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,Object value,AbstractSession session,NamespaceResolver namespaceResolver,MarshalContext marshalContext){
  Object fieldValue=xmlCollectionReferenceMapping.buildFieldValue(value,xmlField,session);
  if (fieldValue == null) {
    if (null != value) {
      XMLField f2=(XMLField)xmlCollectionReferenceMapping.getSourceToTargetKeyFieldAssociations().get(xmlField);
      fieldValue=marshalRecord.getMarshaller().getXMLContext().getValueByXPath(value,f2.getXPath(),f2.getNamespaceResolver(),Object.class);
    }
    if (null == fieldValue) {
      return false;
    }
  }
  QName schemaType=getSchemaType(xmlField,fieldValue,session);
  String stringValue=getValueToWrite(schemaType,fieldValue,(XMLConversionManager)session.getDatasourcePlatform().getConversionManager(),marshalRecord);
  if (stringValue != null) {
    if (xPathFragment.isAttribute()) {
      marshalRecord.attribute(xPathFragment,namespaceResolver,stringValue);
      marshalRecord.closeStartElement();
    }
 else {
      marshalRecord.closeStartElement();
      marshalRecord.characters(stringValue);
    }
    return true;
  }
  return false;
}
Program: 66120
Project: 66120
Buggy source:
public boolean marshalSingleValue(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,Object objectValue,AbstractSession session,NamespaceResolver namespaceResolver,MarshalContext marshalContext){
  Object fieldValue=xmlDirectMapping.getFieldValue(objectValue,session,marshalRecord);
  if (null == fieldValue) {
    return xmlDirectMapping.getNullPolicy().directMarshal(xPathFragment,marshalRecord,object,session,namespaceResolver);
  }
 else {
    QName schemaType=getSchemaType((XMLField)xmlDirectMapping.getField(),fieldValue,session);
    String stringValue=getValueToWrite(schemaType,fieldValue,(XMLConversionManager)session.getDatasourcePlatform().getConversionManager(),namespaceResolver);
    XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
    if (xPathFragment.isAttribute()) {
      marshalRecord.attribute(xPathFragment,namespaceResolver,stringValue);
      marshalRecord.closeStartGroupingElements(groupingFragment);
    }
 else {
      marshalRecord.closeStartGroupingElements(groupingFragment);
      if (xmlDirectMapping.isCDATA()) {
        marshalRecord.cdata(stringValue);
      }
 else {
        marshalRecord.characters(stringValue);
      }
    }
    return true;
  }
}

Fixed version (ground truth):
public boolean marshalSingleValue(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,Object objectValue,AbstractSession session,NamespaceResolver namespaceResolver,MarshalContext marshalContext){
  Object fieldValue=xmlDirectMapping.getFieldValue(objectValue,session,marshalRecord);
  if (null == fieldValue) {
    return xmlDirectMapping.getNullPolicy().directMarshal(xPathFragment,marshalRecord,object,session,namespaceResolver);
  }
 else {
    XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
    QName schemaType=getSchemaType((XMLField)xmlDirectMapping.getField(),fieldValue,session);
    String stringValue=getValueToWrite(schemaType,fieldValue,(XMLConversionManager)session.getDatasourcePlatform().getConversionManager(),marshalRecord);
    if (xPathFragment.isAttribute()) {
      marshalRecord.attribute(xPathFragment,namespaceResolver,stringValue);
      marshalRecord.closeStartGroupingElements(groupingFragment);
    }
 else {
      marshalRecord.closeStartGroupingElements(groupingFragment);
      if (xmlDirectMapping.isCDATA()) {
        marshalRecord.cdata(stringValue);
      }
 else {
        marshalRecord.characters(stringValue);
      }
    }
    return true;
  }
}
Program: 66122
Project: 66122
Buggy source:
/** 
 * INTERNAL: Create a start element tag - this call results in a complete start element,  i.e. closeStartElement() does not need to be called after a call to this  method.
 */
private void openAndCloseStartElement(){
  try {
    contentHandler.startElement(xPathFragment.getNamespaceURI(),xPathFragment.getLocalName(),xPathFragment.getShortName(),attributes);
  }
 catch (  SAXException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Create a start element tag - this call results in a complete start element,  i.e. closeStartElement() does not need to be called after a call to this  method.
 */
private void openAndCloseStartElement(){
  try {
    level++;
    contentHandler.startElement(xPathFragment.getNamespaceURI(),xPathFragment.getLocalName(),xPathFragment.getShortName(),attributes);
  }
 catch (  SAXException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66123
Project: 66123
Buggy source:
/** 
 * INTERNAL:
 */
public void startPrefixMapping(String prefix,String namespaceURI){
  try {
    contentHandler.startPrefixMapping(prefix,namespaceURI);
  }
 catch (  SAXException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void startPrefixMapping(String prefix,String namespaceURI){
  try {
    contentHandler.startPrefixMapping(prefix,namespaceURI);
    List<String> currentLevelPrefixMappings=prefixMappings.get(level);
    if (null == currentLevelPrefixMappings) {
      currentLevelPrefixMappings=new ArrayList<String>();
      prefixMappings.put(level,currentLevelPrefixMappings);
    }
    currentLevelPrefixMappings.add(prefix);
  }
 catch (  SAXException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66124
Project: 66124
Buggy source:
/** 
 * INTERNAL:
 */
public void endElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  if (isStartElementOpen) {
    openAndCloseStartElement();
    isStartElementOpen=false;
  }
  try {
    contentHandler.endElement(xPathFragment.getNamespaceURI(),xPathFragment.getLocalName(),xPathFragment.getShortName());
    isStartElementOpen=false;
  }
 catch (  SAXException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void endElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  if (isStartElementOpen) {
    openAndCloseStartElement();
    isStartElementOpen=false;
  }
  try {
    contentHandler.endElement(xPathFragment.getNamespaceURI(),xPathFragment.getLocalName(),xPathFragment.getShortName());
    level--;
    List<String> currentLevelPrefixMappings=prefixMappings.get(level);
    if (null != currentLevelPrefixMappings) {
      for (      String prefix : currentLevelPrefixMappings) {
        contentHandler.endPrefixMapping(prefix);
      }
      currentLevelPrefixMappings.clear();
    }
    isStartElementOpen=false;
  }
 catch (  SAXException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66125
Project: 66125
Buggy source:
public ContentHandlerRecord(){
  attributes=new AttributesImpl();
}

Fixed version (ground truth):
public ContentHandlerRecord(){
  level=0;
  prefixMappings=new HashMap<Integer,List<String>>();
  attributes=new AttributesImpl();
}
Program: 66126
Project: 66126
Buggy source:
public void testBindingFormatList() throws Exception {
  List<Object> inputFiles=new ArrayList<Object>();
  inputFiles.add(new File(FILE_OXM_XML));
  inputFiles.add(new InputSource(new FileInputStream(INPUT_SRC_OXM_XML)));
  inputFiles.add(new FileInputStream(INPUT_STRM_OXM_XML));
  inputFiles.add(new InputStreamReader(new FileInputStream(READER_OXM_XML)));
  inputFiles.add(new StreamSource(SOURCE_OXM_XML));
  Map<String,Object> properties=new HashMap<String,Object>();
  properties.put(JAXBContextFactory.ECLIPSELINK_OXM_XML_KEY,inputFiles);
  Class[] listClasses=new Class[]{org.eclipse.persistence.testing.jaxb.externalizedmetadata.jaxbcontextfactory.bindingformat.file.Foo.class,org.eclipse.persistence.testing.jaxb.externalizedmetadata.jaxbcontextfactory.bindingformat.inputsource.Foo.class,org.eclipse.persistence.testing.jaxb.externalizedmetadata.jaxbcontextfactory.bindingformat.inputstream.Foo.class,org.eclipse.persistence.testing.jaxb.externalizedmetadata.jaxbcontextfactory.bindingformat.reader.Foo.class,org.eclipse.persistence.testing.jaxb.externalizedmetadata.jaxbcontextfactory.bindingformat.source.Foo.class};
  JAXBContext jCtx=(JAXBContext)JAXBContextFactory.createContext(listClasses,properties,loader);
  doTestFile(jCtx);
  doTestInputSrc(jCtx);
  doTestInputStrm(jCtx);
  doTestReader(jCtx);
  doTestSource(jCtx);
}

Fixed version (ground truth):
public void testBindingFormatList() throws Exception {
  List<Object> inputFiles=new ArrayList<Object>();
  inputFiles.add(new File(FILE_OXM_XML));
  inputFiles.add(new InputSource(new FileInputStream(INPUT_SRC_OXM_XML)));
  inputFiles.add(new FileInputStream(INPUT_STRM_OXM_XML));
  inputFiles.add(new InputStreamReader(new FileInputStream(READER_OXM_XML)));
  inputFiles.add(new StreamSource(ClassLoader.getSystemResourceAsStream(SOURCE_OXM_XML)));
  Map<String,Object> properties=new HashMap<String,Object>();
  properties.put(JAXBContextFactory.ECLIPSELINK_OXM_XML_KEY,inputFiles);
  Class[] listClasses=new Class[]{org.eclipse.persistence.testing.jaxb.externalizedmetadata.jaxbcontextfactory.bindingformat.file.Foo.class,org.eclipse.persistence.testing.jaxb.externalizedmetadata.jaxbcontextfactory.bindingformat.inputsource.Foo.class,org.eclipse.persistence.testing.jaxb.externalizedmetadata.jaxbcontextfactory.bindingformat.inputstream.Foo.class,org.eclipse.persistence.testing.jaxb.externalizedmetadata.jaxbcontextfactory.bindingformat.reader.Foo.class,org.eclipse.persistence.testing.jaxb.externalizedmetadata.jaxbcontextfactory.bindingformat.source.Foo.class};
  JAXBContext jCtx=(JAXBContext)JAXBContextFactory.createContext(listClasses,properties,loader);
  doTestFile(jCtx);
  doTestInputSrc(jCtx);
  doTestInputStrm(jCtx);
  doTestReader(jCtx);
  doTestSource(jCtx);
}
Program: 66127
Project: 66127
Buggy source:
public void testFailOnSecondErrorXMLStreamWriter() throws Exception {
  CustomErrorValidationEventHandler eventHandler=new CustomErrorValidationEventHandler();
  marshaller.setEventHandler(eventHandler);
  try {
    XMLOutputFactory xof=XMLOutputFactory.newInstance();
    XMLStreamWriter xmlStreamWriter=xof.createXMLStreamWriter(new ByteArrayOutputStream());
    marshaller.marshal(employee,xmlStreamWriter);
  }
 catch (  MarshalException ex) {
    assertEquals(2,eventHandler.getErrorCount());
    return;
  }
catch (  XMLStreamException e) {
    return;
  }
catch (  Exception e) {
    throw e;
  }
  fail("String_Node_Str");
}

Fixed version (ground truth):
public void testFailOnSecondErrorXMLStreamWriter() throws Exception {
  CustomErrorValidationEventHandler eventHandler=new CustomErrorValidationEventHandler();
  marshaller.setEventHandler(eventHandler);
  try {
    if (null == XML_OUTPUT_FACTORY) {
      return;
    }
    XMLStreamWriter xmlStreamWriter=XML_OUTPUT_FACTORY.createXMLStreamWriter(new ByteArrayOutputStream());
    marshaller.marshal(employee,xmlStreamWriter);
  }
 catch (  MarshalException ex) {
    assertEquals(2,eventHandler.getErrorCount());
    return;
  }
catch (  XMLStreamException e) {
    return;
  }
catch (  Exception e) {
    throw e;
  }
  fail("String_Node_Str");
}
Program: 66128
Project: 66128
Buggy source:
public void testFailOnSecondErrorXMLEventWriter() throws Exception {
  CustomErrorValidationEventHandler eventHandler=new CustomErrorValidationEventHandler();
  marshaller.setEventHandler(eventHandler);
  try {
    XMLOutputFactory xof=XMLOutputFactory.newInstance();
    XMLEventWriter xmlEventWriter=xof.createXMLEventWriter(new ByteArrayOutputStream());
    marshaller.marshal(employee,xmlEventWriter);
  }
 catch (  MarshalException ex) {
    assertEquals(2,eventHandler.getErrorCount());
    return;
  }
catch (  XMLStreamException e) {
    return;
  }
catch (  Exception e) {
    throw e;
  }
  fail("String_Node_Str");
}

Fixed version (ground truth):
public void testFailOnSecondErrorXMLEventWriter() throws Exception {
  CustomErrorValidationEventHandler eventHandler=new CustomErrorValidationEventHandler();
  marshaller.setEventHandler(eventHandler);
  try {
    if (null == XML_OUTPUT_FACTORY) {
      return;
    }
    XMLEventWriter xmlEventWriter=XML_OUTPUT_FACTORY.createXMLEventWriter(new ByteArrayOutputStream());
    marshaller.marshal(employee,xmlEventWriter);
  }
 catch (  MarshalException ex) {
    assertEquals(2,eventHandler.getErrorCount());
    return;
  }
catch (  XMLStreamException e) {
    return;
  }
catch (  Exception e) {
    throw e;
  }
  fail("String_Node_Str");
}
Program: 66129
Project: 66129
Buggy source:
private XMLEventReader createXMLEventReader(InputStream stream){
  try {
    XMLInputFactory xif=XMLInputFactory.newInstance();
    XMLEventReader xmlEventReader=xif.createXMLEventReader(stream);
    return xmlEventReader;
  }
 catch (  XMLStreamException e) {
    return null;
  }
}

Fixed version (ground truth):
private XMLEventReader createXMLEventReader(InputStream stream){
  try {
    if (null == XML_INPUT_FACTORY) {
      return null;
    }
    XMLEventReader xmlEventReader=XML_INPUT_FACTORY.createXMLEventReader(stream);
    return xmlEventReader;
  }
 catch (  XMLStreamException e) {
    return null;
  }
}
Program: 66130
Project: 66130
Buggy source:
private XMLStreamReader createXMLStreamReader(InputStream stream){
  try {
    XMLInputFactory xif=XMLInputFactory.newInstance();
    XMLStreamReader xmlStreamReader=xif.createXMLStreamReader(stream);
    return xmlStreamReader;
  }
 catch (  XMLStreamException e) {
    return null;
  }
}

Fixed version (ground truth):
private XMLStreamReader createXMLStreamReader(InputStream stream){
  try {
    if (null == XML_INPUT_FACTORY) {
      return null;
    }
    XMLStreamReader xmlStreamReader=XML_INPUT_FACTORY.createXMLStreamReader(stream);
    return xmlStreamReader;
  }
 catch (  XMLStreamException e) {
    return null;
  }
}
Program: 66131
Project: 66131
Buggy source:
public void testFailXMLEventReaderWithNullClass() throws Exception {
  try {
    InputStream stream=ClassLoader.getSystemResourceAsStream(DOUBLE_ERROR_XML);
    XMLInputFactory xif=XMLInputFactory.newInstance();
    XMLEventReader xmlEventReader=xif.createXMLEventReader(stream);
    unmarshaller.unmarshal(xmlEventReader,(Class)null);
  }
 catch (  IllegalArgumentException e) {
    return;
  }
  fail("String_Node_Str");
}

Fixed version (ground truth):
public void testFailXMLEventReaderWithNullClass() throws Exception {
  try {
    if (null == XML_INPUT_FACTORY) {
      return;
    }
    InputStream stream=ClassLoader.getSystemResourceAsStream(DOUBLE_ERROR_XML);
    XMLEventReader xmlEventReader=XML_INPUT_FACTORY.createXMLEventReader(stream);
    unmarshaller.unmarshal(xmlEventReader,(Class)null);
  }
 catch (  IllegalArgumentException e) {
    return;
  }
  fail("String_Node_Str");
}
Program: 66132
Project: 66132
Buggy source:
public void testFailXMLStreamReaderWithNullClass() throws Exception {
  try {
    InputStream stream=ClassLoader.getSystemResourceAsStream(DOUBLE_ERROR_XML);
    XMLInputFactory xif=XMLInputFactory.newInstance();
    XMLStreamReader xmlStreamReader=xif.createXMLStreamReader(stream);
    unmarshaller.unmarshal(xmlStreamReader,(Class)null);
  }
 catch (  IllegalArgumentException e) {
    return;
  }
  fail("String_Node_Str");
}

Fixed version (ground truth):
public void testFailXMLStreamReaderWithNullClass() throws Exception {
  try {
    if (null == XML_INPUT_FACTORY) {
      return;
    }
    InputStream stream=ClassLoader.getSystemResourceAsStream(DOUBLE_ERROR_XML);
    XMLStreamReader xmlStreamReader=XML_INPUT_FACTORY.createXMLStreamReader(stream);
    unmarshaller.unmarshal(xmlStreamReader,(Class)null);
  }
 catch (  IllegalArgumentException e) {
    return;
  }
  fail("String_Node_Str");
}
Program: 66133
Project: 66133
Buggy source:
public void testFailXMLEventReaderWithNullType() throws Exception {
  try {
    InputStream stream=ClassLoader.getSystemResourceAsStream(DOUBLE_ERROR_XML);
    XMLInputFactory xif=XMLInputFactory.newInstance();
    XMLEventReader xmlEventReader=xif.createXMLEventReader(stream);
    unmarshaller.unmarshal(xmlEventReader,(Type)null);
  }
 catch (  IllegalArgumentException e) {
    return;
  }
  fail("String_Node_Str");
}

Fixed version (ground truth):
public void testFailXMLEventReaderWithNullType() throws Exception {
  try {
    if (null == XML_INPUT_FACTORY) {
      return;
    }
    InputStream stream=ClassLoader.getSystemResourceAsStream(DOUBLE_ERROR_XML);
    XMLEventReader xmlEventReader=XML_INPUT_FACTORY.createXMLEventReader(stream);
    unmarshaller.unmarshal(xmlEventReader,(Type)null);
  }
 catch (  IllegalArgumentException e) {
    return;
  }
  fail("String_Node_Str");
}
Program: 66134
Project: 66134
Buggy source:
public void testFailXMLStreamReaderWithNullType() throws Exception {
  try {
    InputStream stream=ClassLoader.getSystemResourceAsStream(DOUBLE_ERROR_XML);
    XMLInputFactory xif=XMLInputFactory.newInstance();
    XMLStreamReader xmlStreamReader=xif.createXMLStreamReader(stream);
    unmarshaller.unmarshal(xmlStreamReader,(Type)null);
  }
 catch (  IllegalArgumentException e) {
    return;
  }
  fail("String_Node_Str");
}

Fixed version (ground truth):
public void testFailXMLStreamReaderWithNullType() throws Exception {
  try {
    if (null == XML_INPUT_FACTORY) {
      return;
    }
    InputStream stream=ClassLoader.getSystemResourceAsStream(DOUBLE_ERROR_XML);
    XMLStreamReader xmlStreamReader=XML_INPUT_FACTORY.createXMLStreamReader(stream);
    unmarshaller.unmarshal(xmlStreamReader,(Type)null);
  }
 catch (  IllegalArgumentException e) {
    return;
  }
  fail("String_Node_Str");
}
Program: 66135
Project: 66135
Buggy source:
protected String getStringForQName(QName qName,MarshalRecord marshalRecord){
  if (null == qName) {
    return null;
  }
  String namespaceURI=qName.getNamespaceURI();
  if (null == namespaceURI) {
    return qName.getLocalPart();
  }
 else {
    NamespaceResolver namespaceResolver=marshalRecord.getNamespaceResolver();
    if (namespaceResolver == null) {
      throw XMLMarshalException.namespaceResolverNotSpecified(namespaceURI);
    }
    if (namespaceURI.equals(namespaceResolver.getDefaultNamespaceURI())) {
      return qName.getLocalPart();
    }
    String prefix=namespaceResolver.resolveNamespaceURI(namespaceURI);
    if (null == prefix) {
      prefix=namespaceResolver.generatePrefix();
      marshalRecord.attribute(XMLConstants.XMLNS_URL,prefix,XMLConstants.XMLNS + XMLConstants.COLON + prefix,namespaceURI);
    }
    return prefix + XMLConstants.COLON + qName.getLocalPart();
  }
}

Fixed version (ground truth):
protected String getStringForQName(QName qName,MarshalRecord marshalRecord){
  if (null == qName) {
    return null;
  }
  String namespaceURI=qName.getNamespaceURI();
  if (null == namespaceURI || 0 == namespaceURI.length()) {
    return qName.getLocalPart();
  }
 else {
    NamespaceResolver namespaceResolver=marshalRecord.getNamespaceResolver();
    if (namespaceResolver == null) {
      throw XMLMarshalException.namespaceResolverNotSpecified(namespaceURI);
    }
    if (namespaceURI.equals(namespaceResolver.getDefaultNamespaceURI())) {
      return qName.getLocalPart();
    }
    String prefix=namespaceResolver.resolveNamespaceURI(namespaceURI);
    if (null == prefix) {
      prefix=namespaceResolver.generatePrefix();
      marshalRecord.attribute(XMLConstants.XMLNS_URL,prefix,XMLConstants.XMLNS + XMLConstants.COLON + prefix,namespaceURI);
    }
    return prefix + XMLConstants.COLON + qName.getLocalPart();
  }
}
Program: 66136
Project: 66136
Buggy source:
@Override public void writeFromObjectIntoRow(Object object,AbstractRecord row,AbstractSession session,WriteType writeType) throws DescriptorException {
  Object value=getAttributeValueFromObject(object);
  Class valueClass=value.getClass();
  if (valueClass == XMLRoot.class) {
    XMLRoot root=(XMLRoot)value;
    for (    DatabaseField next : this.fields) {
      XMLField xmlField=(XMLField)next;
      XPathFragment fragment=xmlField.getXPathFragment();
      while (fragment != null && !fragment.nameIsText()) {
        if (fragment.getNextFragment() == null || fragment.getHasText()) {
          if (fragment.getLocalName().equals(root.getLocalName())) {
            String fragUri=fragment.getNamespaceURI();
            String namespaceUri=root.getNamespaceURI();
            if ((namespaceUri == null && fragUri == null) || (namespaceUri != null && fragUri != null && namespaceUri.equals(fragUri))) {
              XMLMapping mapping=choiceElementMappings.get(xmlField);
              mapping.writeSingleValue(value,object,(XMLRecord)row,session);
              return;
            }
          }
        }
        fragment=fragment.getNextFragment();
      }
    }
    valueClass=root.getObject().getClass();
  }
  XMLField valueField=this.classToFieldMappings.get(valueClass);
  XMLMapping mapping=this.choiceElementMappings.get(valueField);
  if (mapping != null) {
    mapping.writeSingleValue(value,object,(XMLRecord)row,session);
  }
}

Fixed version (ground truth):
@Override public void writeFromObjectIntoRow(Object object,AbstractRecord row,AbstractSession session,WriteType writeType) throws DescriptorException {
  Object value=getAttributeValueFromObject(object);
  Class valueClass=value.getClass();
  if (valueClass == XMLRoot.class) {
    XMLRoot root=(XMLRoot)value;
    for (    DatabaseField next : this.fields) {
      XMLField xmlField=(XMLField)next;
      XPathFragment fragment=xmlField.getXPathFragment();
      while (fragment != null && !fragment.nameIsText()) {
        if (fragment.getNextFragment() == null || fragment.getHasText()) {
          if (fragment.getLocalName().equals(root.getLocalName())) {
            String fragUri=fragment.getNamespaceURI();
            String namespaceUri=root.getNamespaceURI();
            if ((namespaceUri == null && fragUri == null) || (namespaceUri != null && fragUri != null && namespaceUri.equals(fragUri))) {
              XMLMapping mapping=choiceElementMappings.get(xmlField);
              mapping.writeSingleValue(value,object,(XMLRecord)row,session);
              return;
            }
          }
        }
        fragment=fragment.getNextFragment();
      }
    }
    valueClass=root.getObject().getClass();
  }
  XMLField valueField=this.classToFieldMappings.get(valueClass);
  if (valueField == null) {
    List<XMLField> xflds=getClassToSourceFieldsMappings().get(valueClass);
    if (xflds != null) {
      valueField=xflds.get(0);
    }
  }
  XMLMapping mapping=this.choiceElementMappings.get(valueField);
  if (mapping != null) {
    mapping.writeSingleValue(value,object,(XMLRecord)row,session);
  }
}
Program: 66141
Project: 66141
Buggy source:
public void testXmlSchemaQualified() throws Exception {
  ClassLoader classLoader=Thread.currentThread().getContextClassLoader();
  InputStream iStream=classLoader.getResourceAsStream(XMLSCHEMA_QUALIFIED);
  if (iStream == null) {
    fail("String_Node_Str" + XMLSCHEMA_QUALIFIED + "String_Node_Str");
  }
  Map<String,Object> properties=new HashMap<String,Object>();
  properties.put(JAXBContextFactory.ECLIPSELINK_OXM_XML_KEY,iStream);
  jaxbContext=DynamicJAXBContextFactory.createContextFromOXM(classLoader,properties);
  DynamicEntity person=jaxbContext.newDynamicEntity(PACKAGE + "String_Node_Str" + PERSON);
  assertNotNull("String_Node_Str",person);
  person.set("String_Node_Str",456);
  person.set("String_Node_Str","String_Node_Str");
  person.set("String_Node_Str",45000.00);
  Document marshalDoc=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
  jaxbContext.createMarshaller().marshal(person,marshalDoc);
  Node node=marshalDoc.getChildNodes().item(0);
  assertEquals("String_Node_Str","String_Node_Str",node.getNamespaceURI());
  assertNotNull("String_Node_Str",node.getPrefix());
  Node attr=node.getAttributes().item(0);
  assertNotNull("String_Node_Str",attr.getPrefix());
  Node childNode=node.getChildNodes().item(0);
  assertNotNull("String_Node_Str",childNode.getPrefix());
}

Fixed version (ground truth):
public void testXmlSchemaQualified() throws Exception {
  ClassLoader classLoader=Thread.currentThread().getContextClassLoader();
  InputStream iStream=classLoader.getResourceAsStream(XMLSCHEMA_QUALIFIED);
  if (iStream == null) {
    fail("String_Node_Str" + XMLSCHEMA_QUALIFIED + "String_Node_Str");
  }
  Map<String,Object> properties=new HashMap<String,Object>();
  properties.put(JAXBContextFactory.ECLIPSELINK_OXM_XML_KEY,iStream);
  jaxbContext=DynamicJAXBContextFactory.createContextFromOXM(classLoader,properties);
  DynamicEntity person=jaxbContext.newDynamicEntity(PACKAGE + "String_Node_Str" + PERSON);
  assertNotNull("String_Node_Str",person);
  person.set("String_Node_Str",456);
  person.set("String_Node_Str","String_Node_Str");
  person.set("String_Node_Str",45000.00);
  Document marshalDoc=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
  jaxbContext.createMarshaller().marshal(person,marshalDoc);
  Element element=marshalDoc.getDocumentElement();
  assertEquals("String_Node_Str","String_Node_Str",element.getNamespaceURI());
  assertNotNull("String_Node_Str",element.getPrefix());
  Node attr=element.getAttributeNodeNS("String_Node_Str","String_Node_Str");
  assertNotNull("String_Node_Str",attr.getPrefix());
  Node childNode=element.getElementsByTagNameNS("String_Node_Str","String_Node_Str").item(0);
  assertNotNull("String_Node_Str",childNode.getPrefix());
}
Program: 66142
Project: 66142
Buggy source:
public void testXmlSchemaDefaults() throws Exception {
  ClassLoader classLoader=Thread.currentThread().getContextClassLoader();
  InputStream iStream=classLoader.getResourceAsStream(XMLSCHEMA_DEFAULTS);
  if (iStream == null) {
    fail("String_Node_Str" + XMLSCHEMA_DEFAULTS + "String_Node_Str");
  }
  HashMap<String,Source> metadataSourceMap=new HashMap<String,Source>();
  metadataSourceMap.put("String_Node_Str",new StreamSource(iStream));
  Map<String,Map<String,Source>> properties=new HashMap<String,Map<String,Source>>();
  properties.put(JAXBContextFactory.ECLIPSELINK_OXM_XML_KEY,metadataSourceMap);
  jaxbContext=DynamicJAXBContextFactory.createContextFromOXM(classLoader,properties);
  DynamicEntity person=jaxbContext.newDynamicEntity(PERSON);
  assertNotNull("String_Node_Str",person);
  person.set("String_Node_Str",456);
  person.set("String_Node_Str","String_Node_Str");
  person.set("String_Node_Str",45000.00);
  Document marshalDoc=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
  jaxbContext.createMarshaller().marshal(person,marshalDoc);
  Node node=marshalDoc.getChildNodes().item(0);
  assertNull("String_Node_Str",node.getNamespaceURI());
  assertNull("String_Node_Str",node.getPrefix());
  Node attr=node.getAttributes().item(0);
  assertNull("String_Node_Str",attr.getPrefix());
  Node childNode=node.getChildNodes().item(0);
  assertNull("String_Node_Str",childNode.getPrefix());
}

Fixed version (ground truth):
public void testXmlSchemaDefaults() throws Exception {
  ClassLoader classLoader=Thread.currentThread().getContextClassLoader();
  InputStream iStream=classLoader.getResourceAsStream(XMLSCHEMA_DEFAULTS);
  if (iStream == null) {
    fail("String_Node_Str" + XMLSCHEMA_DEFAULTS + "String_Node_Str");
  }
  HashMap<String,Source> metadataSourceMap=new HashMap<String,Source>();
  metadataSourceMap.put("String_Node_Str",new StreamSource(iStream));
  Map<String,Map<String,Source>> properties=new HashMap<String,Map<String,Source>>();
  properties.put(JAXBContextFactory.ECLIPSELINK_OXM_XML_KEY,metadataSourceMap);
  jaxbContext=DynamicJAXBContextFactory.createContextFromOXM(classLoader,properties);
  DynamicEntity person=jaxbContext.newDynamicEntity(PERSON);
  assertNotNull("String_Node_Str",person);
  person.set("String_Node_Str",456);
  person.set("String_Node_Str","String_Node_Str");
  person.set("String_Node_Str",45000.00);
  Document marshalDoc=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
  jaxbContext.createMarshaller().marshal(person,marshalDoc);
  Element element=marshalDoc.getDocumentElement();
  assertNull("String_Node_Str",element.getNamespaceURI());
  assertNull("String_Node_Str",element.getPrefix());
  Node attr=element.getAttributeNode("String_Node_Str");
  assertNull("String_Node_Str",attr.getPrefix());
  Node childNode=element.getElementsByTagName("String_Node_Str").item(0);
  assertNull("String_Node_Str",childNode.getPrefix());
}