nus-yam/ex-repair huggingface dataset:
Program: 63655
Project: 63655
Buggy source:
public void initializeDescriptor(XMLDescriptor descriptor){
  AbstractSession theSession=(AbstractSession)getXmlContext().getSession();
  descriptor.preInitialize(theSession);
  descriptor.initialize(theSession);
  descriptor.postInitialize(theSession);
  descriptor.getObjectBuilder().initializePrimaryKey(theSession);
  getXmlContext().storeXMLDescriptorByQName(descriptor);
}

Fixed version (ground truth):
public void initializeDescriptor(XMLDescriptor descriptor){
  AbstractSession theSession=(AbstractSession)getXmlContext().getSession();
  boolean isInitialized=descriptor.isFullyInitialized();
  descriptor.preInitialize(theSession);
  descriptor.initialize(theSession);
  descriptor.postInitialize(theSession);
  if (isInitialized && descriptor.hasInheritance() && descriptor.getInheritancePolicy().isRootParentDescriptor()) {
    descriptor.getInheritancePolicy().initialize(theSession);
  }
  descriptor.getObjectBuilder().initializePrimaryKey(theSession);
  getXmlContext().storeXMLDescriptorByQName(descriptor);
}
Program: 63660
Project: 63660
Buggy source:
private String appendTimeZone(String string,Date date){
  if (!timeZoneQualified) {
    return string;
  }
  StringBuilder stringBuilder=new StringBuilder(string);
  int rawMinuteOffset=getTimeZone().getOffset(date.getTime()) / 60000;
  if (0 == rawMinuteOffset) {
    stringBuilder.append(GMT_SUFFIX);
    return stringBuilder.toString();
  }
  if (rawMinuteOffset < 0) {
    stringBuilder.append('-');
    rawMinuteOffset=Math.abs(rawMinuteOffset);
  }
 else {
    stringBuilder.append('+');
  }
  int hourOffset=rawMinuteOffset / 60;
  if (hourOffset < 10) {
    stringBuilder.append('0');
  }
  stringBuilder.append(hourOffset);
  stringBuilder.append(Constants.COLON);
  int minuteOffset=rawMinuteOffset % 60;
  if (minuteOffset < 10) {
    stringBuilder.append('0');
  }
  stringBuilder.append(minuteOffset);
  return stringBuilder.toString();
}

Fixed version (ground truth):
private String appendTimeZone(String string,Date date){
  StringBuilder stringBuilder=new StringBuilder(string);
  int rawMinuteOffset=getTimeZone().getOffset(date.getTime()) / 60000;
  if (0 == rawMinuteOffset) {
    stringBuilder.append(GMT_SUFFIX);
    return stringBuilder.toString();
  }
  if (rawMinuteOffset < 0) {
    stringBuilder.append('-');
    rawMinuteOffset=Math.abs(rawMinuteOffset);
  }
 else {
    stringBuilder.append('+');
  }
  int hourOffset=rawMinuteOffset / 60;
  if (hourOffset < 10) {
    stringBuilder.append('0');
  }
  stringBuilder.append(hourOffset);
  stringBuilder.append(Constants.COLON);
  int minuteOffset=rawMinuteOffset % 60;
  if (minuteOffset < 10) {
    stringBuilder.append('0');
  }
  stringBuilder.append(minuteOffset);
  return stringBuilder.toString();
}
Program: 63663
Project: 63663
Buggy source:
public void testFailedGetIdenitifier(){
  EntityManagerFactory factory=(EntityManagerFactory)JpaHelper.getEntityManagerFactory(createEntityManager());
  Cubicle cube=new Cubicle();
  cube.setId(1);
  cube.setCode("String_Node_Str");
  try {
    factory.getPersistenceUnitUtil().getIdentifier(cube);
  }
 catch (  PersistenceException e) {
    return;
  }
  fail("String_Node_Str");
}

Fixed version (ground truth):
public void testFailedGetIdenitifier(){
  EntityManagerFactory factory=getEntityManagerFactory();
  Cubicle cube=new Cubicle();
  cube.setId(1);
  cube.setCode("String_Node_Str");
  try {
    factory.getPersistenceUnitUtil().getIdentifier(cube);
  }
 catch (  PersistenceException e) {
    return;
  }
  fail("String_Node_Str");
}
Program: 63664
Project: 63664
Buggy source:
/** 
 * Test unmarshal by reference non existing nested object.
 * @throws IOException Signals that an I/O exception has occurred.
 * @throws JAXBException the jAXB exception
 */
@Test(expected=ConversionException.class) public void testUnmarshalByReferenceNonExistingNestedObject() throws IOException, JAXBException {
  String jsonMessage=RestUtils.getJSONMessage("String_Node_Str");
  assertTrue(jsonMessage != null);
  unmarshal(jsonMessage,StaticAuction.class.getSimpleName());
}

Fixed version (ground truth):
/** 
 * Test unmarshal by reference non existing nested object.
 * @throws IOException Signals that an I/O exception has occurred.
 * @throws JAXBException the jAXB exception
 */
@Test public void testUnmarshalByReferenceNonExistingNestedObject() throws IOException, JAXBException {
  String jsonMessage=RestUtils.getJSONMessage("String_Node_Str");
  assertTrue(jsonMessage != null);
  try {
    unmarshal(jsonMessage,StaticAuction.class.getSimpleName());
  }
 catch (  JPARSException ex) {
    assertTrue(ex.getErrorCode() == JPARSErrorCodes.OBJECT_REFERRED_BY_LINK_DOES_NOT_EXIST);
  }
}
Program: 63668
Project: 63668
Buggy source:
public void xPathNode(XPathNode xPathNode,NullCapableValue nullCapableValue){
  if (!(isNullRepresentedByXsiNil() || marshalNullRepresentation == XMLNullRepresentationType.XSI_NIL)) {
    if (xPathNode.getXPathFragment().isAttribute()) {
      return;
    }
  }
  XPathNode parentNode=xPathNode.getParent();
  if (isNullRepresentedByXsiNil() || marshalNullRepresentation == XMLNullRepresentationType.XSI_NIL) {
    XPathFragment xPathFragment=new XPathFragment();
    xPathFragment.setXPath('@' + Constants.SCHEMA_NIL_ATTRIBUTE);
    xPathFragment.setNamespaceURI(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
    NodeValue aNodeValue=new NillableNodeValue(nullCapableValue);
    parentNode.addChild(xPathFragment,aNodeValue,null);
  }
 else {
    NodeValue aNodeValue=new OptionalNodeValue(nullCapableValue);
    parentNode.setNodeValue(aNodeValue);
  }
}

Fixed version (ground truth):
public void xPathNode(XPathNode xPathNode,NullCapableValue nullCapableValue){
  if (!(isNullRepresentedByXsiNil() || marshalNullRepresentation == XMLNullRepresentationType.XSI_NIL)) {
    if (xPathNode.getXPathFragment().isAttribute()) {
      return;
    }
  }
  XPathNode parentNode=xPathNode.getParent();
  parentNode.setNullCapableValue(nullCapableValue);
}
Program: 63669
Project: 63669
Buggy source:
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;
}

Fixed version (ground truth):
public boolean marshalSingleValue(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,Object objectValue,CoreAbstractSession session,NamespaceResolver namespaceResolver,MarshalContext marshalContext){
  return false;
}
Program: 63670
Project: 63670
Buggy source:
public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,CoreAbstractSession session,NamespaceResolver namespaceResolver,MarshalContext marshalContext){
  Object objectValue=directMapping.getAttributeValueFromObject(object);
  return this.marshalSingleValue(xPathFragment,marshalRecord,object,objectValue,session,namespaceResolver,marshalContext);
}

Fixed version (ground truth):
@Override public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,CoreAbstractSession session,NamespaceResolver namespaceResolver){
  return false;
}
Program: 63672
Project: 63672
Buggy source:
public void setXPathNode(XPathNode xPathNode){
  super.setXPathNode(xPathNode);
  xmlDirectMapping.getNullPolicy().xPathNode(xPathNode,this);
}

Fixed version (ground truth):
public void setXPathNode(XPathNode xPathNode){
  super.setXPathNode(xPathNode);
  xmlDirectMapping.getNullPolicy().xPathNode(xPathNode,this);
  if (((Field)xmlDirectMapping.getField()).isTypedTextField()) {
    XPathFragment typeAttributeXPathFragment=new XPathFragment();
    typeAttributeXPathFragment.setAttribute(true);
    typeAttributeXPathFragment.setLocalName(Constants.SCHEMA_TYPE_ATTRIBUTE);
    typeAttributeXPathFragment.setNamespaceURI(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
    xPathNode.getParent().addChild(typeAttributeXPathFragment,new TypeNodeValue(),null);
  }
}
Program: 63675
Project: 63675
Buggy source:
private Field getFieldForName(String localName,String namespaceUri){
  Iterator<Field> fields=fieldToNodeValues.keySet().iterator();
  while (fields.hasNext()) {
    Field nextField=fields.next();
    XPathFragment fragment=nextField.getXPathFragment();
    while (fragment != null && (!fragment.nameIsText())) {
      if (fragment.getNextFragment() == null || fragment.getHasText()) {
        if (fragment.getLocalName().equals(localName)) {
          String fragUri=fragment.getNamespaceURI();
          if ((namespaceUri == null && fragUri == null) || (namespaceUri != null && fragUri != null && namespaceUri.equals(fragUri))) {
            return nextField;
          }
        }
      }
      fragment=fragment.getNextFragment();
    }
  }
  return null;
}

Fixed version (ground truth):
private Field getFieldForName(String localName,String namespaceUri){
  Iterator<Field> fields=fieldToNodeValues.keySet().iterator();
  while (fields.hasNext()) {
    Field nextField=fields.next();
    if (nextField != null) {
      XPathFragment fragment=nextField.getXPathFragment();
      while (fragment != null && (!fragment.nameIsText())) {
        if (fragment.getNextFragment() == null || fragment.getHasText()) {
          if (fragment.getLocalName().equals(localName)) {
            String fragUri=fragment.getNamespaceURI();
            if ((namespaceUri == null && fragUri == null) || (namespaceUri != null && fragUri != null && namespaceUri.equals(fragUri))) {
              return nextField;
            }
          }
        }
        fragment=fragment.getNextFragment();
      }
    }
  }
  return null;
}
Program: 63676
Project: 63676
Buggy source:
public boolean marshalSingleValue(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,Object value,CoreAbstractSession session,NamespaceResolver namespaceResolver,MarshalContext marshalContext){
  value=xmlChoiceCollectionMapping.convertObjectValueToDataValue(value,session,marshalRecord.getMarshaller());
  if (value != null && value.getClass() == CoreClassConstants.STRING && this.xmlChoiceCollectionMapping.isMixedContent()) {
    marshalMixedContent(marshalRecord,(String)value);
    return true;
  }
  NodeValue associatedNodeValue=getNodeValueForValue(value);
  if (associatedNodeValue != null) {
    XPathFragment frag=associatedNodeValue.getXPathNode().getXPathFragment();
    if (frag != null) {
      frag=getOwningFragment(associatedNodeValue,frag);
      NodeValue unwrappedNodeValue=((XMLChoiceCollectionMappingUnmarshalNodeValue)associatedNodeValue).getChoiceElementMarshalNodeValue();
      return marshalSingleValueWithNodeValue(frag,marshalRecord,object,value,session,namespaceResolver,marshalContext,unwrappedNodeValue);
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean marshalSingleValue(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,Object value,CoreAbstractSession session,NamespaceResolver namespaceResolver,MarshalContext marshalContext){
  value=xmlChoiceCollectionMapping.convertObjectValueToDataValue(value,session,marshalRecord.getMarshaller());
  if (value != null && value.getClass() == CoreClassConstants.STRING && this.xmlChoiceCollectionMapping.isMixedContent()) {
    marshalMixedContent(marshalRecord,(String)value);
    return true;
  }
  NodeValue associatedNodeValue=getNodeValueForValue(value);
  if (associatedNodeValue != null) {
    if (associatedNodeValue.isAnyMappingNodeValue()) {
      return marshalSingleValueWithNodeValue(null,marshalRecord,object,value,session,namespaceResolver,marshalContext,associatedNodeValue);
    }
 else {
      XPathFragment frag=associatedNodeValue.getXPathNode().getXPathFragment();
      if (frag != null) {
        frag=getOwningFragment(associatedNodeValue,frag);
        NodeValue unwrappedNodeValue=((XMLChoiceCollectionMappingUnmarshalNodeValue)associatedNodeValue).getChoiceElementMarshalNodeValue();
        return marshalSingleValueWithNodeValue(frag,marshalRecord,object,value,session,namespaceResolver,marshalContext,unwrappedNodeValue);
      }
    }
  }
  return true;
}
Program: 63678
Project: 63678
Buggy source:
private void initializeNodeValue(){
  Mapping xmlMapping=(Mapping)xmlChoiceCollectionMapping.getChoiceElementMappings().get(xmlField);
  if (xmlMapping instanceof BinaryDataCollectionMapping) {
    choiceElementNodeValue=new XMLBinaryDataCollectionMappingNodeValue((BinaryDataCollectionMapping)xmlMapping);
  }
 else   if (xmlMapping instanceof DirectCollectionMapping) {
    choiceElementNodeValue=new XMLCompositeDirectCollectionMappingNodeValue((DirectCollectionMapping)xmlMapping);
  }
 else   if (xmlMapping instanceof CompositeCollectionMapping) {
    choiceElementNodeValue=new XMLCompositeCollectionMappingNodeValue((CompositeCollectionMapping)xmlMapping);
  }
 else {
    CollectionReferenceMapping refMapping=((CollectionReferenceMapping)xmlMapping);
    if (refMapping.usesSingleNode() || refMapping.getFields().size() == 1) {
      choiceElementNodeValue=new XMLCollectionReferenceMappingNodeValue(refMapping,xmlField);
    }
 else {
      choiceElementNodeValue=new XMLCollectionReferenceMappingMarshalNodeValue((CollectionReferenceMapping)xmlMapping);
    }
  }
}

Fixed version (ground truth):
private void initializeNodeValue(){
  Mapping xmlMapping=(Mapping)xmlChoiceCollectionMapping.getChoiceElementMappings().get(xmlField);
  if (xmlMapping instanceof BinaryDataCollectionMapping) {
    choiceElementNodeValue=new XMLBinaryDataCollectionMappingNodeValue((BinaryDataCollectionMapping)xmlMapping);
  }
 else   if (xmlMapping instanceof DirectCollectionMapping) {
    choiceElementNodeValue=new XMLCompositeDirectCollectionMappingNodeValue((DirectCollectionMapping)xmlMapping);
  }
 else   if (xmlMapping instanceof CompositeCollectionMapping) {
    choiceElementNodeValue=new XMLCompositeCollectionMappingNodeValue((CompositeCollectionMapping)xmlMapping);
  }
 else {
    CollectionReferenceMapping refMapping=((CollectionReferenceMapping)xmlMapping);
    if (refMapping.usesSingleNode() || refMapping.getFields().size() == 1) {
      choiceElementNodeValue=new XMLCollectionReferenceMappingNodeValue(refMapping,xmlField);
    }
 else {
      choiceElementNodeValue=new XMLCollectionReferenceMappingMarshalNodeValue((CollectionReferenceMapping)xmlMapping);
    }
  }
  if (isAny) {
    anyNodeValue=new XMLChoiceCollectionMappingUnmarshalNodeValue(xmlChoiceCollectionMapping,null,xmlChoiceCollectionMapping.getAnyMapping());
  }
}
Program: 63679
Project: 63679
Buggy source:
public XMLChoiceCollectionMappingMarshalNodeValue(ChoiceCollectionMapping mapping,Field xmlField){
  this.xmlChoiceCollectionMapping=mapping;
  this.xmlField=xmlField;
  initializeNodeValue();
}

Fixed version (ground truth):
public XMLChoiceCollectionMappingMarshalNodeValue(ChoiceCollectionMapping mapping,Field xmlField){
  this.xmlChoiceCollectionMapping=mapping;
  this.xmlField=xmlField;
  isAny=mapping.isAny();
  initializeNodeValue();
}
Program: 63681
Project: 63681
Buggy source:
private void initializeNodeValue(){
  Mapping xmlMapping=this.nestedMapping;
  if (xmlMapping instanceof BinaryDataCollectionMapping) {
    choiceElementNodeValue=new XMLBinaryDataCollectionMappingNodeValue((BinaryDataCollectionMapping)xmlMapping);
    choiceElementMarshalNodeValue=choiceElementNodeValue;
  }
 else   if (xmlMapping instanceof DirectCollectionMapping) {
    choiceElementNodeValue=new XMLCompositeDirectCollectionMappingNodeValue((DirectCollectionMapping)xmlMapping);
    choiceElementMarshalNodeValue=choiceElementNodeValue;
  }
 else   if (xmlMapping instanceof CompositeCollectionMapping) {
    choiceElementNodeValue=new XMLCompositeCollectionMappingNodeValue((CompositeCollectionMapping)xmlMapping);
    choiceElementMarshalNodeValue=choiceElementNodeValue;
  }
 else {
    choiceElementNodeValue=new XMLCollectionReferenceMappingNodeValue((CollectionReferenceMapping)xmlMapping,xmlField);
    CollectionReferenceMapping refMapping=((CollectionReferenceMapping)xmlMapping);
    if (refMapping.usesSingleNode() || refMapping.getFields().size() == 1) {
      choiceElementMarshalNodeValue=new XMLCollectionReferenceMappingNodeValue(refMapping,xmlField);
    }
 else {
      choiceElementMarshalNodeValue=new XMLCollectionReferenceMappingMarshalNodeValue((CollectionReferenceMapping)xmlMapping);
    }
  }
}

Fixed version (ground truth):
private void initializeNodeValue(){
  if (nestedMapping == null && isAny) {
    nestedMapping=xmlChoiceCollectionMapping.getAnyMapping();
  }
  Mapping xmlMapping=this.nestedMapping;
  if (xmlMapping instanceof BinaryDataCollectionMapping) {
    choiceElementNodeValue=new XMLBinaryDataCollectionMappingNodeValue((BinaryDataCollectionMapping)xmlMapping);
    choiceElementMarshalNodeValue=choiceElementNodeValue;
  }
 else   if (xmlMapping instanceof DirectCollectionMapping) {
    choiceElementNodeValue=new XMLCompositeDirectCollectionMappingNodeValue((DirectCollectionMapping)xmlMapping);
    choiceElementMarshalNodeValue=choiceElementNodeValue;
  }
 else   if (xmlMapping instanceof CompositeCollectionMapping) {
    choiceElementNodeValue=new XMLCompositeCollectionMappingNodeValue((CompositeCollectionMapping)xmlMapping);
    choiceElementMarshalNodeValue=choiceElementNodeValue;
  }
 else   if (xmlMapping instanceof AnyCollectionMapping) {
    choiceElementNodeValue=new XMLAnyCollectionMappingNodeValue((AnyCollectionMapping)xmlMapping);
    choiceElementMarshalNodeValue=choiceElementNodeValue;
  }
 else {
    choiceElementNodeValue=new XMLCollectionReferenceMappingNodeValue((CollectionReferenceMapping)xmlMapping,xmlField);
    CollectionReferenceMapping refMapping=((CollectionReferenceMapping)xmlMapping);
    if (refMapping.usesSingleNode() || refMapping.getFields().size() == 1) {
      choiceElementMarshalNodeValue=new XMLCollectionReferenceMappingNodeValue(refMapping,xmlField);
    }
 else {
      choiceElementMarshalNodeValue=new XMLCollectionReferenceMappingMarshalNodeValue((CollectionReferenceMapping)xmlMapping);
    }
  }
}
Program: 63685
Project: 63685
Buggy source:
public boolean isMixedContent(){
  return this.mixedContentMapping != null;
}

Fixed version (ground truth):
public boolean isMixedContent(){
  return isMixedContent;
}
Program: 63686
Project: 63686
Buggy source:
public void preInitialize(AbstractSession session) throws DescriptorException {
  getAttributeAccessor().setIsWriteOnly(this.isWriteOnly());
  getAttributeAccessor().setIsReadOnly(this.isReadOnly());
  super.preInitialize(session);
  ArrayList<XMLMapping> mappingsList=new ArrayList<XMLMapping>();
  mappingsList.addAll(getChoiceElementMappings().values());
  for (  XMLMapping next : getChoiceElementMappingsByClass().values()) {
    if (!(mappingsList.contains(next))) {
      mappingsList.add(next);
    }
  }
  for (  XMLMapping next : getChoiceElementMappingsByClass().values()) {
    if (!(mappingsList.contains(next))) {
      mappingsList.add(next);
    }
  }
  Iterator<XMLMapping> mappings=mappingsList.iterator();
  while (mappings.hasNext()) {
    DatabaseMapping nextMapping=(DatabaseMapping)mappings.next();
    nextMapping.setAttributeName(this.getAttributeName());
    if (nextMapping.getAttributeAccessor() == temporaryAccessor) {
      nextMapping.setAttributeAccessor(getAttributeAccessor());
    }
    nextMapping.setIsReadOnly(this.isReadOnly());
    ((XMLMapping)nextMapping).setIsWriteOnly(this.isWriteOnly());
    nextMapping.setDescriptor(getDescriptor());
    nextMapping.preInitialize(session);
  }
}

Fixed version (ground truth):
public void preInitialize(AbstractSession session) throws DescriptorException {
  getAttributeAccessor().setIsWriteOnly(this.isWriteOnly());
  getAttributeAccessor().setIsReadOnly(this.isReadOnly());
  super.preInitialize(session);
  ArrayList<XMLMapping> mappingsList=new ArrayList<XMLMapping>();
  mappingsList.addAll(getChoiceElementMappings().values());
  if (isAny) {
    anyMapping=new XMLAnyCollectionMapping();
    anyMapping.setMixedContent(false);
    anyMapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT);
    mappingsList.add(anyMapping);
  }
  for (  XMLMapping next : getChoiceElementMappingsByClass().values()) {
    if (!(mappingsList.contains(next))) {
      mappingsList.add(next);
    }
  }
  for (  XMLMapping next : getChoiceElementMappingsByClass().values()) {
    if (!(mappingsList.contains(next))) {
      mappingsList.add(next);
    }
  }
  Iterator<XMLMapping> mappings=mappingsList.iterator();
  while (mappings.hasNext()) {
    DatabaseMapping nextMapping=(DatabaseMapping)mappings.next();
    nextMapping.setAttributeName(this.getAttributeName());
    if (nextMapping.getAttributeAccessor() == temporaryAccessor) {
      nextMapping.setAttributeAccessor(getAttributeAccessor());
    }
    nextMapping.setIsReadOnly(this.isReadOnly());
    ((XMLMapping)nextMapping).setIsWriteOnly(this.isWriteOnly());
    nextMapping.setDescriptor(getDescriptor());
    nextMapping.preInitialize(session);
  }
}
Program: 63688
Project: 63688
Buggy source:
/** 
 * PUBLIC: Allows the user to indicate that this mapping should also allow for mixed content in addition to  any of the elements in the choice. 
 * @since EclipseLink 2.3.1
 */
public void setMixedContent(boolean mixed){
  if (!mixed) {
    this.mixedContentMapping=null;
  }
 else {
    setMixedContent("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * PUBLIC: Allows the user to indicate that this mapping should also allow for mixed content in addition to  any of the elements in the choice. 
 * @since EclipseLink 2.3.1
 */
public void setMixedContent(boolean mixed){
  if (!mixed) {
    this.mixedContentMapping=null;
  }
 else {
    setMixedContent("String_Node_Str");
  }
  isMixedContent=mixed;
}
Program: 63691
Project: 63691
Buggy source:
protected AbstractRecord buildCompositeRow(Object attributeValue,AbstractSession session,XMLDescriptor referenceDescriptor,AbstractRecord parentRow,DatabaseField field,Object originalObject,boolean wasXMLRoot){
  if ((field == null) && (referenceDescriptor != null) && (referenceDescriptor.getDefaultRootElement() != null)) {
    field=referenceDescriptor.buildField(referenceDescriptor.getDefaultRootElement());
  }
  if ((field != null) && (referenceDescriptor != null)) {
    ((XMLRecord)parentRow).setLeafElementType(referenceDescriptor.getDefaultRootElementType());
    XMLObjectBuilder objectBuilder=(XMLObjectBuilder)referenceDescriptor.getObjectBuilder();
    XMLRecord child=(XMLRecord)objectBuilder.createRecordFor(attributeValue,(XMLField)field,(XMLRecord)parentRow,this);
    child.setNamespaceResolver(((XMLRecord)parentRow).getNamespaceResolver());
    objectBuilder.buildIntoNestedRow(child,originalObject,attributeValue,session,referenceDescriptor,(XMLField)field,wasXMLRoot);
    return child;
  }
  return null;
}

Fixed version (ground truth):
protected AbstractRecord buildCompositeRow(Object attributeValue,AbstractSession session,XMLDescriptor referenceDescriptor,AbstractRecord parentRow,DatabaseField field,Object originalObject,boolean wasXMLRoot){
  String defaultRootElementString=null;
  if (referenceDescriptor != null) {
    defaultRootElementString=referenceDescriptor.getDefaultRootElement();
    if (!wasXMLRoot && defaultRootElementString == null) {
      throw XMLMarshalException.defaultRootElementNotSpecified((XMLDescriptor)descriptor);
    }
  }
  if ((field == null) && (referenceDescriptor != null) && (defaultRootElementString != null)) {
    field=referenceDescriptor.buildField(defaultRootElementString);
  }
  if ((field != null) && (referenceDescriptor != null)) {
    ((XMLRecord)parentRow).setLeafElementType(referenceDescriptor.getDefaultRootElementType());
    XMLObjectBuilder objectBuilder=(XMLObjectBuilder)referenceDescriptor.getObjectBuilder();
    XMLRecord child=(XMLRecord)objectBuilder.createRecordFor(attributeValue,(XMLField)field,(XMLRecord)parentRow,this);
    child.setNamespaceResolver(((XMLRecord)parentRow).getNamespaceResolver());
    objectBuilder.buildIntoNestedRow(child,originalObject,attributeValue,session,referenceDescriptor,(XMLField)field,wasXMLRoot);
    return child;
  }
  return null;
}
Program: 63692
Project: 63692
Buggy source:
protected AbstractRecord buildCompositeRow(Object attributeValue,AbstractSession session,XMLDescriptor referenceDescriptor,AbstractRecord parentRow,DatabaseField field,Object originalObject,boolean wasXMLRoot){
  if ((field == null) && (referenceDescriptor != null) && (referenceDescriptor.getDefaultRootElement() != null)) {
    field=referenceDescriptor.buildField(referenceDescriptor.getDefaultRootElement());
  }
  if ((field != null) && (referenceDescriptor != null)) {
    ((XMLRecord)parentRow).setLeafElementType(referenceDescriptor.getDefaultRootElementType());
    XMLObjectBuilder objectBuilder=(XMLObjectBuilder)referenceDescriptor.getObjectBuilder();
    XMLRecord child=(XMLRecord)objectBuilder.createRecordFor(attributeValue,(XMLField)field,(XMLRecord)parentRow,this);
    child.setNamespaceResolver(((XMLRecord)parentRow).getNamespaceResolver());
    objectBuilder.buildIntoNestedRow(child,originalObject,attributeValue,session,referenceDescriptor,(XMLField)field,wasXMLRoot);
    return child;
  }
  return null;
}

Fixed version (ground truth):
protected AbstractRecord buildCompositeRow(Object attributeValue,AbstractSession session,XMLDescriptor referenceDescriptor,AbstractRecord parentRow,DatabaseField field,Object originalObject,boolean wasXMLRoot){
  String defaultRootElementString=null;
  if (referenceDescriptor != null) {
    defaultRootElementString=referenceDescriptor.getDefaultRootElement();
    if (!wasXMLRoot && defaultRootElementString == null) {
      throw XMLMarshalException.defaultRootElementNotSpecified((XMLDescriptor)descriptor);
    }
  }
  if ((field == null) && (referenceDescriptor != null) && (defaultRootElementString != null)) {
    field=referenceDescriptor.buildField(defaultRootElementString);
  }
  if ((field != null) && (referenceDescriptor != null)) {
    ((XMLRecord)parentRow).setLeafElementType(referenceDescriptor.getDefaultRootElementType());
    XMLObjectBuilder objectBuilder=(XMLObjectBuilder)referenceDescriptor.getObjectBuilder();
    XMLRecord child=(XMLRecord)objectBuilder.createRecordFor(attributeValue,(XMLField)field,(XMLRecord)parentRow,this);
    child.setNamespaceResolver(((XMLRecord)parentRow).getNamespaceResolver());
    objectBuilder.buildIntoNestedRow(child,originalObject,attributeValue,session,referenceDescriptor,(XMLField)field,wasXMLRoot);
    return child;
  }
  return null;
}
Program: 63693
Project: 63693
Buggy source:
public void testObjectToXMLEventWriter() throws Exception {
  if (XML_OUTPUT_FACTORY != null) {
    StringWriter writer=new StringWriter();
    XMLOutputFactory factory=XMLOutputFactory.newInstance();
    factory.setProperty(factory.IS_REPAIRING_NAMESPACES,new Boolean(false));
    XMLEventWriter eventWriter=factory.createXMLEventWriter(writer);
    Object objectToWrite=getWriteControlObject();
    XMLDescriptor desc=null;
    if (objectToWrite instanceof XMLRoot) {
      desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(((XMLRoot)objectToWrite).getObject().getClass());
    }
 else {
      desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(objectToWrite.getClass());
    }
    jaxbMarshaller.setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
    int sizeBefore=getNamespaceResolverSize(desc);
    try {
      jaxbMarshaller.marshal(objectToWrite,eventWriter);
    }
 catch (    Exception e) {
      assertMarshalException(e);
      return;
    }
    eventWriter.flush();
    int sizeAfter=getNamespaceResolverSize(desc);
    assertEquals(sizeBefore,sizeAfter);
    Document testDocument=getTestDocument(writer.toString());
    writer.close();
    objectToXMLDocumentTest(testDocument);
  }
}

Fixed version (ground truth):
public void testObjectToXMLEventWriter() throws Exception {
  if (XML_OUTPUT_FACTORY != null) {
    StringWriter writer=new StringWriter();
    XMLOutputFactory factory=XMLOutputFactory.newInstance();
    factory.setProperty(factory.IS_REPAIRING_NAMESPACES,new Boolean(false));
    XMLEventWriter eventWriter=factory.createXMLEventWriter(writer);
    Object objectToWrite=getWriteControlObject();
    XMLDescriptor desc=null;
    if (objectToWrite instanceof XMLRoot) {
      desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(((XMLRoot)objectToWrite).getObject().getClass());
    }
 else {
      desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(objectToWrite.getClass());
    }
    jaxbMarshaller.setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
    int sizeBefore=getNamespaceResolverSize(desc);
    try {
      jaxbMarshaller.marshal(objectToWrite,eventWriter);
    }
 catch (    Exception e) {
      assertMarshalException(e);
      return;
    }
    if (expectsMarshalException) {
      fail("String_Node_Str");
      return;
    }
    eventWriter.flush();
    int sizeAfter=getNamespaceResolverSize(desc);
    assertEquals(sizeBefore,sizeAfter);
    Document testDocument=getTestDocument(writer.toString());
    writer.close();
    objectToXMLDocumentTest(testDocument);
  }
}
Program: 63694
Project: 63694
Buggy source:
public void objectToXMLStringWriter(Object objectToWrite) throws Exception {
  StringWriter writer=new StringWriter();
  XMLDescriptor desc=null;
  if (objectToWrite instanceof XMLRoot) {
    desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(((XMLRoot)objectToWrite).getObject().getClass());
  }
 else {
    desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(objectToWrite.getClass());
  }
  int sizeBefore=getNamespaceResolverSize(desc);
  jaxbMarshaller.setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  try {
    jaxbMarshaller.marshal(objectToWrite,writer);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  int sizeAfter=getNamespaceResolverSize(desc);
  assertEquals(sizeBefore,sizeAfter);
  Document testDocument=getTestDocument(writer.toString());
  writer.close();
  objectToXMLDocumentTest(testDocument);
}

Fixed version (ground truth):
public void objectToXMLStringWriter(Object objectToWrite) throws Exception {
  StringWriter writer=new StringWriter();
  XMLDescriptor desc=null;
  if (objectToWrite instanceof XMLRoot) {
    desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(((XMLRoot)objectToWrite).getObject().getClass());
  }
 else {
    desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(objectToWrite.getClass());
  }
  int sizeBefore=getNamespaceResolverSize(desc);
  jaxbMarshaller.setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  try {
    jaxbMarshaller.marshal(objectToWrite,writer);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  if (expectsMarshalException) {
    fail("String_Node_Str");
    return;
  }
  int sizeAfter=getNamespaceResolverSize(desc);
  assertEquals(sizeBefore,sizeAfter);
  Document testDocument=getTestDocument(writer.toString());
  writer.close();
  objectToXMLDocumentTest(testDocument);
}
Program: 63695
Project: 63695
Buggy source:
public void testObjectToXMLStreamWriter() throws Exception {
  if (XML_OUTPUT_FACTORY != null) {
    StringWriter writer=new StringWriter();
    XMLOutputFactory factory=XMLOutputFactory.newInstance();
    factory.setProperty(factory.IS_REPAIRING_NAMESPACES,new Boolean(false));
    XMLStreamWriter streamWriter=factory.createXMLStreamWriter(writer);
    Object objectToWrite=getWriteControlObject();
    XMLDescriptor desc=null;
    if (objectToWrite instanceof XMLRoot) {
      desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(((XMLRoot)objectToWrite).getObject().getClass());
    }
 else {
      desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(objectToWrite.getClass());
    }
    jaxbMarshaller.setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
    int sizeBefore=getNamespaceResolverSize(desc);
    try {
      jaxbMarshaller.marshal(objectToWrite,streamWriter);
    }
 catch (    Exception e) {
      assertMarshalException(e);
      return;
    }
    streamWriter.flush();
    int sizeAfter=getNamespaceResolverSize(desc);
    assertEquals(sizeBefore,sizeAfter);
    Document testDocument=getTestDocument(writer.toString());
    writer.close();
    objectToXMLDocumentTest(testDocument);
  }
}

Fixed version (ground truth):
public void testObjectToXMLStreamWriter() throws Exception {
  if (XML_OUTPUT_FACTORY != null) {
    StringWriter writer=new StringWriter();
    XMLOutputFactory factory=XMLOutputFactory.newInstance();
    factory.setProperty(factory.IS_REPAIRING_NAMESPACES,new Boolean(false));
    XMLStreamWriter streamWriter=factory.createXMLStreamWriter(writer);
    Object objectToWrite=getWriteControlObject();
    XMLDescriptor desc=null;
    if (objectToWrite instanceof XMLRoot) {
      desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(((XMLRoot)objectToWrite).getObject().getClass());
    }
 else {
      desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(objectToWrite.getClass());
    }
    jaxbMarshaller.setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
    int sizeBefore=getNamespaceResolverSize(desc);
    try {
      jaxbMarshaller.marshal(objectToWrite,streamWriter);
    }
 catch (    Exception e) {
      assertMarshalException(e);
      return;
    }
    if (expectsMarshalException) {
      fail("String_Node_Str");
      return;
    }
    streamWriter.flush();
    int sizeAfter=getNamespaceResolverSize(desc);
    assertEquals(sizeBefore,sizeAfter);
    Document testDocument=getTestDocument(writer.toString());
    writer.close();
    objectToXMLDocumentTest(testDocument);
  }
}
Program: 63696
Project: 63696
Buggy source:
public void testObjectToContentHandler() throws Exception {
  SAXDocumentBuilder builder=new SAXDocumentBuilder();
  Object objectToWrite=getWriteControlObject();
  XMLDescriptor desc=null;
  if (objectToWrite instanceof XMLRoot) {
    desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(((XMLRoot)objectToWrite).getObject().getClass());
  }
 else {
    desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(objectToWrite.getClass());
  }
  int sizeBefore=getNamespaceResolverSize(desc);
  jaxbMarshaller.setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  try {
    jaxbMarshaller.marshal(objectToWrite,builder);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  int sizeAfter=getNamespaceResolverSize(desc);
  assertEquals(sizeBefore,sizeAfter);
  Document controlDocument=getWriteControlDocument();
  Document testDocument=builder.getDocument();
  log("String_Node_Str");
  log("String_Node_Str");
  log(controlDocument);
  log("String_Node_Str");
  log(testDocument);
  assertXMLIdentical(controlDocument,testDocument);
}

Fixed version (ground truth):
public void testObjectToContentHandler() throws Exception {
  SAXDocumentBuilder builder=new SAXDocumentBuilder();
  Object objectToWrite=getWriteControlObject();
  XMLDescriptor desc=null;
  if (objectToWrite instanceof XMLRoot) {
    desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(((XMLRoot)objectToWrite).getObject().getClass());
  }
 else {
    desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(objectToWrite.getClass());
  }
  int sizeBefore=getNamespaceResolverSize(desc);
  jaxbMarshaller.setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  try {
    jaxbMarshaller.marshal(objectToWrite,builder);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  if (expectsMarshalException) {
    fail("String_Node_Str");
    return;
  }
  int sizeAfter=getNamespaceResolverSize(desc);
  assertEquals(sizeBefore,sizeAfter);
  Document controlDocument=getWriteControlDocument();
  Document testDocument=builder.getDocument();
  log("String_Node_Str");
  log("String_Node_Str");
  log(controlDocument);
  log("String_Node_Str");
  log(testDocument);
  assertXMLIdentical(controlDocument,testDocument);
}
Program: 63697
Project: 63697
Buggy source:
public void testObjectToXMLStreamWriterRecord() throws Exception {
  if (XML_OUTPUT_FACTORY != null) {
    StringWriter writer=new StringWriter();
    XMLOutputFactory factory=XMLOutputFactory.newInstance();
    factory.setProperty(factory.IS_REPAIRING_NAMESPACES,new Boolean(false));
    XMLStreamWriter streamWriter=factory.createXMLStreamWriter(writer);
    Object objectToWrite=getWriteControlObject();
    XMLDescriptor desc=null;
    if (objectToWrite instanceof XMLRoot) {
      desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(((XMLRoot)objectToWrite).getObject().getClass());
    }
 else {
      desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(objectToWrite.getClass());
    }
    jaxbMarshaller.setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
    int sizeBefore=getNamespaceResolverSize(desc);
    XMLStreamWriterRecord record=new XMLStreamWriterRecord(streamWriter);
    try {
      ((org.eclipse.persistence.jaxb.JAXBMarshaller)jaxbMarshaller).marshal(objectToWrite,record);
    }
 catch (    Exception e) {
      assertMarshalException(e);
      return;
    }
    streamWriter.flush();
    int sizeAfter=getNamespaceResolverSize(desc);
    assertEquals(sizeBefore,sizeAfter);
    Document testDocument=getTestDocument(writer.toString());
    writer.close();
    objectToXMLDocumentTest(testDocument);
  }
}

Fixed version (ground truth):
public void testObjectToXMLStreamWriterRecord() throws Exception {
  if (XML_OUTPUT_FACTORY != null) {
    StringWriter writer=new StringWriter();
    XMLOutputFactory factory=XMLOutputFactory.newInstance();
    factory.setProperty(factory.IS_REPAIRING_NAMESPACES,new Boolean(false));
    XMLStreamWriter streamWriter=factory.createXMLStreamWriter(writer);
    Object objectToWrite=getWriteControlObject();
    XMLDescriptor desc=null;
    if (objectToWrite instanceof XMLRoot) {
      desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(((XMLRoot)objectToWrite).getObject().getClass());
    }
 else {
      desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(objectToWrite.getClass());
    }
    jaxbMarshaller.setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
    int sizeBefore=getNamespaceResolverSize(desc);
    XMLStreamWriterRecord record=new XMLStreamWriterRecord(streamWriter);
    try {
      ((org.eclipse.persistence.jaxb.JAXBMarshaller)jaxbMarshaller).marshal(objectToWrite,record);
    }
 catch (    Exception e) {
      assertMarshalException(e);
      return;
    }
    if (expectsMarshalException) {
      fail("String_Node_Str");
      return;
    }
    streamWriter.flush();
    int sizeAfter=getNamespaceResolverSize(desc);
    assertEquals(sizeBefore,sizeAfter);
    Document testDocument=getTestDocument(writer.toString());
    writer.close();
    objectToXMLDocumentTest(testDocument);
  }
}
Program: 63698
Project: 63698
Buggy source:
public void testObjectToOutputStreamASCIIEncoding() throws Exception {
  Object objectToWrite=getWriteControlObject();
  ByteArrayOutputStream stream=new ByteArrayOutputStream();
  XMLDescriptor desc=null;
  if (objectToWrite instanceof XMLRoot) {
    desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(((XMLRoot)objectToWrite).getObject().getClass());
  }
 else {
    desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(objectToWrite.getClass());
  }
  jaxbMarshaller.setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  int sizeBefore=getNamespaceResolverSize(desc);
  String originalEncoding=(String)jaxbMarshaller.getProperty(Marshaller.JAXB_ENCODING);
  jaxbMarshaller.setProperty(Marshaller.JAXB_ENCODING,"String_Node_Str");
  try {
    jaxbMarshaller.marshal(objectToWrite,stream);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  jaxbMarshaller.setProperty(Marshaller.JAXB_ENCODING,originalEncoding);
  int sizeAfter=getNamespaceResolverSize(desc);
  assertEquals(sizeBefore,sizeAfter);
  InputStream is=new ByteArrayInputStream(stream.toByteArray());
  Document testDocument=getTestDocument(is);
  stream.close();
  is.close();
  objectToXMLDocumentTest(testDocument);
}

Fixed version (ground truth):
public void testObjectToOutputStreamASCIIEncoding() throws Exception {
  Object objectToWrite=getWriteControlObject();
  ByteArrayOutputStream stream=new ByteArrayOutputStream();
  XMLDescriptor desc=null;
  if (objectToWrite instanceof XMLRoot) {
    desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(((XMLRoot)objectToWrite).getObject().getClass());
  }
 else {
    desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(objectToWrite.getClass());
  }
  jaxbMarshaller.setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  int sizeBefore=getNamespaceResolverSize(desc);
  String originalEncoding=(String)jaxbMarshaller.getProperty(Marshaller.JAXB_ENCODING);
  jaxbMarshaller.setProperty(Marshaller.JAXB_ENCODING,"String_Node_Str");
  try {
    jaxbMarshaller.marshal(objectToWrite,stream);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  if (expectsMarshalException) {
    fail("String_Node_Str");
    return;
  }
  jaxbMarshaller.setProperty(Marshaller.JAXB_ENCODING,originalEncoding);
  int sizeAfter=getNamespaceResolverSize(desc);
  assertEquals(sizeBefore,sizeAfter);
  InputStream is=new ByteArrayInputStream(stream.toByteArray());
  Document testDocument=getTestDocument(is);
  stream.close();
  is.close();
  objectToXMLDocumentTest(testDocument);
}
Program: 63699
Project: 63699
Buggy source:
public void testObjectToXMLDocument() throws Exception {
  Object objectToWrite=getWriteControlObject();
  XMLDescriptor desc=null;
  if (objectToWrite instanceof XMLRoot) {
    desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(((XMLRoot)objectToWrite).getObject().getClass());
  }
 else {
    desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(objectToWrite.getClass());
  }
  jaxbMarshaller.setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  int sizeBefore=getNamespaceResolverSize(desc);
  Document testDocument=XMLPlatformFactory.getInstance().getXMLPlatform().createDocument();
  try {
    jaxbMarshaller.marshal(objectToWrite,testDocument);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  int sizeAfter=getNamespaceResolverSize(desc);
  assertEquals(sizeBefore,sizeAfter);
  objectToXMLDocumentTest(testDocument);
}

Fixed version (ground truth):
public void testObjectToXMLDocument() throws Exception {
  Object objectToWrite=getWriteControlObject();
  XMLDescriptor desc=null;
  if (objectToWrite instanceof XMLRoot) {
    desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(((XMLRoot)objectToWrite).getObject().getClass());
  }
 else {
    desc=(XMLDescriptor)xmlContext.getSession(0).getProject().getDescriptor(objectToWrite.getClass());
  }
  jaxbMarshaller.setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  int sizeBefore=getNamespaceResolverSize(desc);
  Document testDocument=XMLPlatformFactory.getInstance().getXMLPlatform().createDocument();
  try {
    jaxbMarshaller.marshal(objectToWrite,testDocument);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  if (expectsMarshalException) {
    fail("String_Node_Str");
    return;
  }
  int sizeAfter=getNamespaceResolverSize(desc);
  assertEquals(sizeBefore,sizeAfter);
  objectToXMLDocumentTest(testDocument);
}
Program: 63701
Project: 63701
Buggy source:
public void testJSONMarshalToBuilderResult() throws Exception {
  getJSONMarshaller().setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  JsonObjectBuilder jsonObjectBuilder=Json.createObjectBuilder();
  JsonObjectBuilderResult result=new JsonObjectBuilderResult(jsonObjectBuilder);
  try {
    getJSONMarshaller().marshal(getWriteControlObject(),result);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  JsonObject jsonObject=jsonObjectBuilder.build();
  StringWriter sw=new StringWriter();
  JsonWriter writer=Json.createWriter(sw);
  writer.writeObject(jsonObject);
  writer.close();
  log(sw.toString());
  compareStringToControlFile("String_Node_Str",sw.toString());
}

Fixed version (ground truth):
public void testJSONMarshalToBuilderResult() throws Exception {
  getJSONMarshaller().setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  JsonObjectBuilder jsonObjectBuilder=Json.createObjectBuilder();
  JsonObjectBuilderResult result=new JsonObjectBuilderResult(jsonObjectBuilder);
  try {
    getJSONMarshaller().marshal(getWriteControlObject(),result);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  if (expectsMarshalException) {
    fail("String_Node_Str");
    return;
  }
  JsonObject jsonObject=jsonObjectBuilder.build();
  StringWriter sw=new StringWriter();
  JsonWriter writer=Json.createWriter(sw);
  writer.writeObject(jsonObject);
  writer.close();
  log(sw.toString());
  compareStringToControlFile("String_Node_Str",sw.toString());
}
Program: 63702
Project: 63702
Buggy source:
public void testJSONMarshalToOutputStream() throws Exception {
  getJSONMarshaller().setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  ByteArrayOutputStream os=new ByteArrayOutputStream();
  try {
    getJSONMarshaller().marshal(getWriteControlObject(),os);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  compareStringToControlFile("String_Node_Str",new String(os.toByteArray()));
  os.close();
}

Fixed version (ground truth):
public void testJSONMarshalToOutputStream() throws Exception {
  getJSONMarshaller().setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  ByteArrayOutputStream os=new ByteArrayOutputStream();
  try {
    getJSONMarshaller().marshal(getWriteControlObject(),os);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  if (expectsMarshalException) {
    fail("String_Node_Str");
    return;
  }
  compareStringToControlFile("String_Node_Str",new String(os.toByteArray()));
  os.close();
}