nus-yam/ex-repair huggingface dataset:
Program: 65448
Project: 65448
Buggy source:
/** 
 * INTERNAL: Private function to process or create an entry in the NamespaceResolver for the xsi prefix.
 * @param namespaceResolver
 * @return xsi prefix
 */
protected String processNamespaceResolverForXSIPrefix(NamespaceResolver namespaceResolver,MarshalRecord marshalRecord){
  String xsiPrefix;
  if (null == namespaceResolver) {
    xsiPrefix=XMLConstants.SCHEMA_INSTANCE_PREFIX;
    namespaceResolver=new NamespaceResolver();
    namespaceResolver.put(xsiPrefix,XMLConstants.SCHEMA_INSTANCE_URL);
    marshalRecord.attribute(XMLConstants.XMLNS_URL,xsiPrefix,XMLConstants.XMLNS + XMLConstants.COLON + xsiPrefix,XMLConstants.SCHEMA_INSTANCE_URL);
  }
 else {
    xsiPrefix=namespaceResolver.resolveNamespaceURI(XMLConstants.SCHEMA_INSTANCE_URL);
    if (null == xsiPrefix) {
      xsiPrefix=namespaceResolver.generatePrefix(XMLConstants.SCHEMA_INSTANCE_PREFIX);
      marshalRecord.attribute(XMLConstants.XMLNS_URL,xsiPrefix,XMLConstants.XMLNS + XMLConstants.COLON + xsiPrefix,XMLConstants.SCHEMA_INSTANCE_URL);
    }
  }
  return xsiPrefix;
}

Fixed version (ground truth):
/** 
 * INTERNAL: Private function to process or create an entry in the NamespaceResolver for the xsi prefix.
 * @param namespaceResolver
 * @return xsi prefix
 */
protected String processNamespaceResolverForXSIPrefix(NamespaceResolver namespaceResolver,MarshalRecord marshalRecord){
  String xsiPrefix;
  if (null == namespaceResolver) {
    xsiPrefix=XMLConstants.SCHEMA_INSTANCE_PREFIX;
    namespaceResolver=new NamespaceResolver();
    namespaceResolver.put(xsiPrefix,XMLConstants.SCHEMA_INSTANCE_URL);
    marshalRecord.namespaceDeclaration(xsiPrefix,XMLConstants.SCHEMA_INSTANCE_URL);
  }
 else {
    xsiPrefix=namespaceResolver.resolveNamespaceURI(XMLConstants.SCHEMA_INSTANCE_URL);
    if (null == xsiPrefix) {
      xsiPrefix=namespaceResolver.generatePrefix(XMLConstants.SCHEMA_INSTANCE_PREFIX);
      marshalRecord.namespaceDeclaration(xsiPrefix,XMLConstants.SCHEMA_INSTANCE_URL);
    }
  }
  return xsiPrefix;
}
Program: 65449
Project: 65449
Buggy source:
/** 
 * INTERNAL: Add the namespace declarations to the XML document.
 * @param namespaceResolver The NamespaceResolver contains the namespaceprefix and URI pairings that need to be declared.
 */
public void namespaceDeclarations(NamespaceResolver namespaceResolver){
  if (namespaceResolver == null) {
    return;
  }
  String namespaceURI=namespaceResolver.getDefaultNamespaceURI();
  if (null != namespaceURI) {
    attribute(XMLConstants.XMLNS_URL,XMLConstants.XMLNS,XMLConstants.XMLNS,namespaceURI);
  }
  if (namespaceResolver.hasPrefixesToNamespaces()) {
    for (    Entry<String,String> entry : namespaceResolver.getPrefixesToNamespaces().entrySet()) {
      String namespacePrefix=entry.getKey();
      attribute(XMLConstants.XMLNS_URL,namespacePrefix,XMLConstants.XMLNS + XMLConstants.COLON + namespacePrefix,entry.getValue());
    }
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Add the namespace declarations to the XML document.
 * @param namespaceResolver The NamespaceResolver contains the namespaceprefix and URI pairings that need to be declared.
 */
public void namespaceDeclarations(NamespaceResolver namespaceResolver){
  if (namespaceResolver == null) {
    return;
  }
  String namespaceURI=namespaceResolver.getDefaultNamespaceURI();
  if (null != namespaceURI) {
    defaultNamespaceDeclaration(namespaceURI);
  }
  if (namespaceResolver.hasPrefixesToNamespaces()) {
    for (    Entry<String,String> entry : namespaceResolver.getPrefixesToNamespaces().entrySet()) {
      String namespacePrefix=entry.getKey();
      namespaceDeclaration(namespacePrefix,entry.getValue());
    }
  }
}
Program: 65450
Project: 65450
Buggy source:
/** 
 * Receive notification of a node.
 * @param node The Node to be added to the document
 * @param namespaceResolver The NamespaceResolver can be used to resolve thenamespace URI/prefix of the node
 */
public void node(Node node,NamespaceResolver namespaceResolver){
  if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
    Attr attr=(Attr)node;
    String resolverPfx=null;
    if (namespaceResolver != null) {
      resolverPfx=namespaceResolver.resolveNamespaceURI(attr.getNamespaceURI());
    }
    if (resolverPfx != null) {
      attribute(attr.getNamespaceURI(),XMLConstants.EMPTY_STRING,resolverPfx + XMLConstants.COLON + attr.getLocalName(),attr.getNodeValue());
    }
 else {
      attribute(attr.getNamespaceURI(),XMLConstants.EMPTY_STRING,attr.getName(),attr.getNodeValue());
      if (attr.getNamespaceURI() != null) {
        attribute(XMLConstants.XMLNS_URL,XMLConstants.EMPTY_STRING,XMLConstants.XMLNS + XMLConstants.COLON + attr.getPrefix(),attr.getNamespaceURI());
      }
    }
  }
 else   if (node.getNodeType() == Node.TEXT_NODE) {
    characters(node.getNodeValue());
  }
 else {
    try {
      FormattedOutputStreamRecordContentHandler handler=new FormattedOutputStreamRecordContentHandler();
      XMLFragmentReader xfragReader=new XMLFragmentReader(namespaceResolver);
      xfragReader.setContentHandler(handler);
      xfragReader.setProperty(XMLConstants.LEXICAL_HANDLER_PROPERTY,handler);
      xfragReader.parse(node);
    }
 catch (    SAXException sex) {
      throw XMLMarshalException.marshalException(sex);
    }
  }
}

Fixed version (ground truth):
/** 
 * Receive notification of a node.
 * @param node The Node to be added to the document
 * @param namespaceResolver The NamespaceResolver can be used to resolve thenamespace URI/prefix of the node
 */
public void node(Node node,NamespaceResolver namespaceResolver){
  if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
    Attr attr=(Attr)node;
    String resolverPfx=null;
    if (namespaceResolver != null) {
      resolverPfx=namespaceResolver.resolveNamespaceURI(attr.getNamespaceURI());
    }
    if (resolverPfx != null) {
      attribute(attr.getNamespaceURI(),XMLConstants.EMPTY_STRING,resolverPfx + XMLConstants.COLON + attr.getLocalName(),attr.getNodeValue());
    }
 else {
      attribute(attr.getNamespaceURI(),XMLConstants.EMPTY_STRING,attr.getName(),attr.getNodeValue());
      if (attr.getNamespaceURI() != null) {
        namespaceDeclaration(attr.getPrefix(),attr.getNamespaceURI());
      }
    }
  }
 else   if (node.getNodeType() == Node.TEXT_NODE) {
    characters(node.getNodeValue());
  }
 else {
    try {
      FormattedOutputStreamRecordContentHandler handler=new FormattedOutputStreamRecordContentHandler();
      XMLFragmentReader xfragReader=new XMLFragmentReader(namespaceResolver);
      xfragReader.setContentHandler(handler);
      xfragReader.setProperty(XMLConstants.LEXICAL_HANDLER_PROPERTY,handler);
      xfragReader.parse(node);
    }
 catch (    SAXException sex) {
      throw XMLMarshalException.marshalException(sex);
    }
  }
}
Program: 65453
Project: 65453
Buggy source:
/** 
 * INTERNAL:
 */
public void attribute(String namespaceURI,String localName,String qName,String value){
  try {
    outputStreamWrite(SPACE);
    outputStreamWrite(qName.getBytes(XMLConstants.DEFAULT_XML_ENCODING));
    outputStreamWrite((byte)'=');
    outputStreamWrite((byte)'"');
    writeValue(value,true);
    outputStreamWrite(CLOSE_ATTRIBUTE_VALUE);
  }
 catch (  UnsupportedEncodingException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void attribute(String namespaceURI,String localName,String qName,String value){
  try {
    outputStreamWrite(SPACE);
    outputStreamWrite(qName.getBytes(XMLConstants.DEFAULT_XML_ENCODING));
    outputStreamWrite((byte)'=');
    outputStreamWrite((byte)'"');
    writeValue(value,true,true);
    outputStreamWrite(CLOSE_ATTRIBUTE_VALUE);
  }
 catch (  UnsupportedEncodingException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 65455
Project: 65455
Buggy source:
/** 
 * INTERNAL:
 */
public void attribute(String namespaceURI,String localName,String qName,String value){
  try {
    writer.write(' ');
    writer.write(qName);
    writer.write('=');
    writer.write('\"');
    writeValue(value);
    writer.write('\"');
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void attribute(String namespaceURI,String localName,String qName,String value){
  try {
    writer.write(' ');
    writer.write(qName);
    writer.write('=');
    writer.write('\"');
    writeValue(value,true);
    writer.write('\"');
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 65456
Project: 65456
Buggy source:
/** 
 * INTERNAL:
 */
protected void writeValue(String value){
  try {
    if (value.indexOf('"') > -1 || value.indexOf('&') > -1 || value.indexOf('<') > -1) {
      char[] chars=value.toCharArray();
      for (int x=0, charsSize=chars.length; x < charsSize; x++) {
        char character=chars[x];
switch (character) {
case '&':
{
            writer.write("String_Node_Str");
            break;
          }
case '<':
{
          writer.write("String_Node_Str");
          break;
        }
case '"':
{
        writer.write("String_Node_Str");
        break;
      }
default :
    writer.write(character);
}
}
}
 else {
writer.write(value);
}
}
 catch (IOException e) {
throw XMLMarshalException.marshalException(e);
}
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
protected void writeValue(String value,boolean isAttribute){
  CharacterEscapeHandler escapeHandler=marshaller.getCharacterEscapeHandler();
  if (escapeHandler != null) {
    try {
      escapeHandler.escape(value.toCharArray(),0,value.length(),isAttribute,writer);
    }
 catch (    IOException e) {
      throw XMLMarshalException.marshalException(e);
    }
    return;
  }
  try {
    if (value.indexOf('"') > -1 || value.indexOf('&') > -1 || value.indexOf('<') > -1) {
      char[] chars=value.toCharArray();
      for (int x=0, charsSize=chars.length; x < charsSize; x++) {
        char character=chars[x];
switch (character) {
case '&':
{
            writer.write("String_Node_Str");
            break;
          }
case '<':
{
          writer.write("String_Node_Str");
          break;
        }
case '"':
{
        writer.write("String_Node_Str");
        break;
      }
default :
    writer.write(character);
}
}
}
 else {
writer.write(value);
}
}
 catch (IOException e) {
throw XMLMarshalException.marshalException(e);
}
}
Program: 65458
Project: 65458
Buggy source:
@Override public void startElement(String namespaceURI,String localName,String qName,Attributes atts) throws SAXException {
  if (XMLConstants.XOP_URL.equals(namespaceURI) && (INCLUDE_ELEMENT_NAME.equals(localName) || INCLUDE_ELEMENT_NAME.equals(qName))) {
    this.c_id=atts.getValue("String_Node_Str",HREF_ATTRIBUTE_NAME);
  }
 else {
    XMLReader xmlReader=record.getXMLReader();
    xmlReader.setContentHandler(record);
    xmlReader.setLexicalHandler(record);
    record.startElement(namespaceURI,localName,qName,atts);
  }
}

Fixed version (ground truth):
@Override public void startElement(String namespaceURI,String localName,String qName,Attributes atts) throws SAXException {
  if (XMLConstants.XOP_URL.equals(namespaceURI) && (INCLUDE_ELEMENT_NAME.equals(localName) || INCLUDE_ELEMENT_NAME.equals(qName))) {
    this.c_id=atts.getValue(XMLConstants.EMPTY_STRING,HREF_ATTRIBUTE_NAME);
  }
 else   if (c_id == null) {
    XMLReader xmlReader=record.getXMLReader();
    xmlReader.setContentHandler(record);
    xmlReader.setLexicalHandler(record);
    record.startElement(namespaceURI,localName,qName,atts);
  }
}
Program: 65460
Project: 65460
Buggy source:
public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlBinaryDataCollectionMapping.isReadOnly()) {
    return false;
  }
  Object collection=xmlBinaryDataCollectionMapping.getAttributeAccessor().getAttributeValueFromObject(object);
  if (null == collection) {
    AbstractNullPolicy wrapperNP=xmlBinaryDataCollectionMapping.getWrapperNullPolicy();
    if (wrapperNP != null && wrapperNP.getMarshalNullRepresentation().equals(XMLNullRepresentationType.XSI_NIL)) {
      marshalRecord.nilSimple(namespaceResolver);
      return true;
    }
 else {
      return false;
    }
  }
  String xopPrefix=null;
  if (namespaceResolver != null) {
    xopPrefix=namespaceResolver.resolveNamespaceURI(XMLConstants.XOP_URL);
  }
  if (xopPrefix == null || namespaceResolver == null) {
    xopPrefix=XMLConstants.XOP_PREFIX;
    marshalRecord.getNamespaceResolver().put(xopPrefix,XMLConstants.XOP_URL);
  }
  ContainerPolicy cp=getContainerPolicy();
  Object iterator=cp.iteratorFor(collection);
  if (!cp.hasNext(iterator)) {
    if (xmlBinaryDataCollectionMapping.getWrapperNullPolicy() != null) {
      XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
      marshalRecord.closeStartGroupingElements(groupingFragment);
    }
 else {
      return false;
    }
  }
  while (cp.hasNext(iterator)) {
    Object objectValue=cp.next(iterator,session);
    marshalSingleValue(xPathFragment,marshalRecord,object,objectValue,session,namespaceResolver,ObjectMarshalContext.getInstance());
  }
  marshalRecord.getNamespaceResolver().removeNamespace(XMLConstants.XOP_PREFIX);
  return true;
}

Fixed version (ground truth):
public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlBinaryDataCollectionMapping.isReadOnly()) {
    return false;
  }
  Object collection=xmlBinaryDataCollectionMapping.getAttributeAccessor().getAttributeValueFromObject(object);
  if (null == collection) {
    AbstractNullPolicy wrapperNP=xmlBinaryDataCollectionMapping.getWrapperNullPolicy();
    if (wrapperNP != null && wrapperNP.getMarshalNullRepresentation().equals(XMLNullRepresentationType.XSI_NIL)) {
      marshalRecord.nilSimple(namespaceResolver);
      return true;
    }
 else {
      return false;
    }
  }
  ContainerPolicy cp=getContainerPolicy();
  Object iterator=cp.iteratorFor(collection);
  if (!cp.hasNext(iterator)) {
    if (xmlBinaryDataCollectionMapping.getWrapperNullPolicy() != null) {
      XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
      marshalRecord.closeStartGroupingElements(groupingFragment);
    }
 else {
      return false;
    }
  }
  while (cp.hasNext(iterator)) {
    Object objectValue=cp.next(iterator,session);
    marshalSingleValue(xPathFragment,marshalRecord,object,objectValue,session,namespaceResolver,ObjectMarshalContext.getInstance());
  }
  return true;
}
Program: 65462
Project: 65462
Buggy source:
/** 
 * INTERNAL:
 */
protected void writeValue(String value,boolean isAttribute){
  CharacterEscapeHandler escapeHandler=marshaller.getCharacterEscapeHandler();
  if (escapeHandler != null) {
    try {
      escapeHandler.escape(value.toCharArray(),0,value.length(),isAttribute,writer);
    }
 catch (    IOException e) {
      throw XMLMarshalException.marshalException(e);
    }
    return;
  }
  try {
    if (value.indexOf('"') > -1 || value.indexOf('&') > -1 || value.indexOf('<') > -1) {
      char[] chars=value.toCharArray();
      for (int x=0, charsSize=chars.length; x < charsSize; x++) {
        char character=chars[x];
switch (character) {
case '&':
{
            writer.write("String_Node_Str");
            break;
          }
case '<':
{
          writer.write("String_Node_Str");
          break;
        }
case '"':
{
        writer.write("String_Node_Str");
        break;
      }
default :
    writer.write(character);
}
}
}
 else {
writer.write(value);
}
}
 catch (IOException e) {
throw XMLMarshalException.marshalException(e);
}
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
protected void writeValue(String value,boolean isAttribute){
  CharacterEscapeHandler escapeHandler=null;
  if (marshaller != null) {
    escapeHandler=marshaller.getCharacterEscapeHandler();
  }
  if (escapeHandler != null) {
    try {
      escapeHandler.escape(value.toCharArray(),0,value.length(),isAttribute,writer);
    }
 catch (    IOException e) {
      throw XMLMarshalException.marshalException(e);
    }
    return;
  }
  try {
    if (value.indexOf('"') > -1 || value.indexOf('&') > -1 || value.indexOf('<') > -1) {
      char[] chars=value.toCharArray();
      for (int x=0, charsSize=chars.length; x < charsSize; x++) {
        char character=chars[x];
switch (character) {
case '&':
{
            writer.write("String_Node_Str");
            break;
          }
case '<':
{
          writer.write("String_Node_Str");
          break;
        }
case '"':
{
        writer.write("String_Node_Str");
        break;
      }
default :
    writer.write(character);
}
}
}
 else {
writer.write(value);
}
}
 catch (IOException e) {
throw XMLMarshalException.marshalException(e);
}
}
Program: 65465
Project: 65465
Buggy source:
public void setNamespacePrefixMapper(NamespacePrefixMapper mapper){
  this.mapper=mapper;
}

Fixed version (ground truth):
/** 
 * NamespacePrefixMapper that can be used during marshal (instead of those set in the project meta data)
 * @since 2.3.3
 * @return
 */
public void setNamespacePrefixMapper(NamespacePrefixMapper mapper){
  this.mapper=mapper;
}
Program: 65466
Project: 65466
Buggy source:
public NamespacePrefixMapper getNamespacePrefixMapper(){
  return this.mapper;
}

Fixed version (ground truth):
/** 
 * NamespacePrefixMapper that can be used during marshal (instead of those set in the project meta data)
 * @since 2.3.3
 * @return
 */
public NamespacePrefixMapper getNamespacePrefixMapper(){
  return this.mapper;
}
Program: 65467
Project: 65467
Buggy source:
/** 
 * INTERNAL:
 */
public void setMarshaller(XMLMarshaller marshaller){
  this.marshaller=marshaller;
  if (marshaller != null) {
    MediaType mediaType=marshaller.getMediaType();
    if (marshaller.getNamespaceResolver() != null) {
      namespaceResolver=marshaller.getNamespaceResolver();
    }
    namespaceAware=(mediaType == MediaType.APPLICATION_XML || namespaceResolver.getPrefixesToNamespaces().size() > 0);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void setMarshaller(XMLMarshaller marshaller){
  this.marshaller=marshaller;
  if (marshaller != null) {
    MediaType mediaType=marshaller.getMediaType();
    if (marshaller.getNamespacePrefixMapper() != null) {
      namespaceAware=true;
    }
 else {
      namespaceAware=mediaType == MediaType.APPLICATION_XML;
    }
  }
}
Program: 65468
Project: 65468
Buggy source:
/** 
 * INTERNAL: Increase DMS Event sensor occurrence.(DMS)
 */
public void occurred(String operationName,DatabaseQuery query){
  Sensor event=getSensorByName(operationName);
  if (event != null) {
    ((Event)event).occurred(operationName);
    occurred(query.getMonitorName());
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Increase DMS Event sensor occurrence.(DMS)
 */
public void occurred(String operationName,DatabaseQuery query){
  Sensor event=getSensorByName(operationName);
  if (event != null) {
    ((Event)event).occurred();
    occurred(query.getMonitorName());
  }
}
Program: 65471
Project: 65471
Buggy source:
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  this.addPositionalNodes(xPathFragment,namespaceResolver);
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
  }
  if (!isLastEventText) {
    if (numberOfTabs > 0) {
      outputStreamWrite(CR);
    }
    outputStreamWriteTab();
  }
  isStartElementOpen=true;
  outputStreamWrite(OPEN_START_ELEMENT);
  outputStreamWrite(xPathFragment.getShortNameBytes());
  numberOfTabs++;
  isLastEventText=false;
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  this.addPositionalNodes(xPathFragment,namespaceResolver);
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
  }
  if (!isLastEventText) {
    if (numberOfTabs > 0) {
      outputStreamWrite(CR);
    }
    outputStreamWriteTab();
  }
  isStartElementOpen=true;
  outputStreamWrite(OPEN_START_ELEMENT);
  outputStreamWrite(getNameForFragmentBytes(xPathFragment));
  numberOfTabs++;
  isLastEventText=false;
}
Program: 65472
Project: 65472
Buggy source:
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  this.addPositionalNodes(xPathFragment,namespaceResolver);
  try {
    if (isStartElementOpen) {
      writer.write('>');
    }
    if (!isLastEventText) {
      if (numberOfTabs > 0) {
        writer.write(Helper.cr());
      }
      for (int x=0; x < numberOfTabs; x++) {
        writer.write(TAB);
      }
    }
    isStartElementOpen=true;
    writer.write('<');
    writer.write(xPathFragment.getShortName());
    numberOfTabs++;
    isLastEventText=false;
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  this.addPositionalNodes(xPathFragment,namespaceResolver);
  try {
    if (isStartElementOpen) {
      writer.write('>');
    }
    if (!isLastEventText) {
      if (numberOfTabs > 0) {
        writer.write(Helper.cr());
      }
      for (int x=0; x < numberOfTabs; x++) {
        writer.write(TAB);
      }
    }
    isStartElementOpen=true;
    writer.write('<');
    writer.write(getNameForFragment(xPathFragment));
    numberOfTabs++;
    isLastEventText=false;
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 65473
Project: 65473
Buggy source:
protected String getNameForFragment(XPathFragment xPathFragment){
  if (!this.hasCustomNamespaceMapper()) {
    return xPathFragment.getShortName();
  }
  if (xPathFragment.getNamespaceURI() != null && xPathFragment.getNamespaceURI().length() > 0) {
    String prefix=this.getNamespaceResolver().resolveNamespaceURI(xPathFragment.getNamespaceURI());
    return prefix + "String_Node_Str" + xPathFragment.getLocalName();
  }
  return xPathFragment.getLocalName();
}

Fixed version (ground truth):
protected String getNameForFragment(XPathFragment xPathFragment){
  if (!this.hasCustomNamespaceMapper()) {
    return xPathFragment.getShortName();
  }
  if (xPathFragment.getNamespaceURI() != null && xPathFragment.getNamespaceURI().length() > 0) {
    String prefix=this.getPrefixForFragment(xPathFragment);
    if (prefix != null && prefix.length() > 0) {
      return prefix + "String_Node_Str" + xPathFragment.getLocalName();
    }
  }
  return xPathFragment.getLocalName();
}
Program: 65474
Project: 65474
Buggy source:
protected String getPrefixForFragment(XPathFragment xPathFragment){
  if (!this.hasCustomNamespaceMapper()) {
    return xPathFragment.getPrefix();
  }
  String uri=xPathFragment.getNamespaceURI();
  if (uri == null || uri.length() == 0) {
    return "String_Node_Str";
  }
  String prefix=this.getNamespaceResolver().resolveNamespaceURI(uri);
  if (prefix != null) {
    return prefix;
  }
  return xPathFragment.getPrefix();
}

Fixed version (ground truth):
protected String getPrefixForFragment(XPathFragment xPathFragment){
  if (!this.hasCustomNamespaceMapper()) {
    return xPathFragment.getPrefix();
  }
  String uri=xPathFragment.getNamespaceURI();
  if (uri == null || uri.length() == 0) {
    return XMLConstants.EMPTY_STRING;
  }
  String defaultNamespace=getNamespaceResolver().getDefaultNamespaceURI();
  if (defaultNamespace != null && defaultNamespace.equals(uri)) {
    return XMLConstants.EMPTY_STRING;
  }
  String prefix=this.getNamespaceResolver().resolveNamespaceURI(uri);
  if (prefix != null) {
    return prefix;
  }
  for (  Object next : getNamespaceResolver().getNamespaces()) {
    Namespace ns=(Namespace)next;
    uri=ns.getNamespaceURI();
    prefix=ns.getPrefix();
  }
  return xPathFragment.getPrefix();
}
Program: 65475
Project: 65475
Buggy source:
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
  }
  isStartElementOpen=true;
  outputStreamWrite(OPEN_START_ELEMENT);
  try {
    outputStreamWrite(getNameForFragment(xPathFragment).getBytes(XMLConstants.DEFAULT_XML_ENCODING));
  }
 catch (  UnsupportedEncodingException e) {
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
  }
  isStartElementOpen=true;
  outputStreamWrite(OPEN_START_ELEMENT);
  outputStreamWrite(getNameForFragmentBytes(xPathFragment));
}
Program: 65476
Project: 65476
Buggy source:
/** 
 * INTERNAL:
 */
public void element(XPathFragment frag){
  try {
    if (isStartElementOpen) {
      writer.write('>');
      isStartElementOpen=false;
    }
    writer.write('<');
    writer.write(frag.getShortName());
    writer.write('/');
    writer.write('>');
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void element(XPathFragment frag){
  try {
    if (isStartElementOpen) {
      writer.write('>');
      isStartElementOpen=false;
    }
    writer.write('<');
    writer.write(getNameForFragment(frag));
    writer.write('/');
    writer.write('>');
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 65483
Project: 65483
Buggy source:
public AbstractRecord buildIntoNestedRow(AbstractRecord row,Object originalObject,Object object,AbstractSession session,XMLDescriptor refDesc,XMLField xmlField,boolean wasXMLRoot){
  XMLRecord record=(XMLRecord)row;
  record.setSession(session);
  XMLMarshaller marshaller=record.getMarshaller();
  if ((marshaller != null) && (marshaller.getMarshalListener() != null)) {
    marshaller.getMarshalListener().beforeMarshal(object);
  }
  List extraNamespaces=null;
  if (isXmlDescriptor()) {
    XMLDescriptor xmlDescriptor=(XMLDescriptor)getDescriptor();
    extraNamespaces=addExtraNamespacesToNamespaceResolver(xmlDescriptor,record,session,false);
    writeExtraNamespaces(extraNamespaces,record);
    addXsiTypeAndClassIndicatorIfRequired(record,xmlDescriptor,refDesc,xmlField,originalObject,object,wasXMLRoot,false);
  }
  writeOutMappings(record,object,session);
  if (isXmlDescriptor()) {
    XMLDescriptor xmlDescriptor=(XMLDescriptor)getDescriptor();
    removeExtraNamespacesFromNamespaceResolver(record,extraNamespaces,session);
  }
  if (!getDescriptor().isAggregateDescriptor()) {
    addPrimaryKeyForNonDefaultTable(row);
  }
  if ((marshaller != null) && (marshaller.getMarshalListener() != null)) {
    marshaller.getMarshalListener().afterMarshal(object);
  }
  return row;
}

Fixed version (ground truth):
public AbstractRecord buildIntoNestedRow(AbstractRecord row,Object originalObject,Object object,AbstractSession session,XMLDescriptor refDesc,XMLField xmlField,boolean wasXMLRoot){
  XMLRecord record=(XMLRecord)row;
  record.setSession(session);
  XMLMarshaller marshaller=record.getMarshaller();
  if ((marshaller != null) && (marshaller.getMarshalListener() != null)) {
    marshaller.getMarshalListener().beforeMarshal(object);
  }
  List extraNamespaces=null;
  if (isXmlDescriptor()) {
    XMLDescriptor xmlDescriptor=(XMLDescriptor)getDescriptor();
    extraNamespaces=addExtraNamespacesToNamespaceResolver(xmlDescriptor,record,session,false,false);
    writeExtraNamespaces(extraNamespaces,record);
    addXsiTypeAndClassIndicatorIfRequired(record,xmlDescriptor,refDesc,xmlField,originalObject,object,wasXMLRoot,false);
  }
  writeOutMappings(record,object,session);
  if (isXmlDescriptor()) {
    XMLDescriptor xmlDescriptor=(XMLDescriptor)getDescriptor();
    removeExtraNamespacesFromNamespaceResolver(record,extraNamespaces,session);
  }
  if (!getDescriptor().isAggregateDescriptor()) {
    addPrimaryKeyForNonDefaultTable(row);
  }
  if ((marshaller != null) && (marshaller.getMarshalListener() != null)) {
    marshaller.getMarshalListener().afterMarshal(object);
  }
  return row;
}
Program: 65484
Project: 65484
Buggy source:
protected void writeExtraNamespaces(List extraNamespaces,XMLRecord xmlRecord,AbstractSession session){
  if (extraNamespaces == null) {
    return;
  }
  for (int i=0, extraNamespacesSize=extraNamespaces.size(); i < extraNamespacesSize; i++) {
    Namespace next=(Namespace)extraNamespaces.get(i);
    ((MarshalRecord)xmlRecord).attribute(XMLConstants.XMLNS_URL,next.getPrefix(),XMLConstants.XMLNS + XMLConstants.COLON + next.getPrefix(),next.getNamespaceURI());
  }
}

Fixed version (ground truth):
protected void writeExtraNamespaces(List extraNamespaces,XMLRecord xmlRecord,AbstractSession session){
  if (extraNamespaces == null) {
    return;
  }
  for (int i=0, extraNamespacesSize=extraNamespaces.size(); i < extraNamespacesSize; i++) {
    Namespace next=(Namespace)extraNamespaces.get(i);
    String prefix=next.getPrefix();
    if (((MarshalRecord)xmlRecord).hasCustomNamespaceMapper()) {
      prefix=((MarshalRecord)xmlRecord).getNamespaceResolver().resolveNamespaceURI(next.getNamespaceURI());
    }
    ((MarshalRecord)xmlRecord).attribute(XMLConstants.XMLNS_URL,prefix,XMLConstants.XMLNS + XMLConstants.COLON + prefix,next.getNamespaceURI());
  }
}
Program: 65485
Project: 65485
Buggy source:
@Override public String resolveNamespaceURI(String uri){
  String prefix=null;
  if (contextualNamespaces != null) {
    prefix=contextualNamespaces.resolveNamespaceURI(uri);
  }
  if (prefix == null) {
    prefix=super.resolveNamespaceURI(uri);
  }
  if (prefix == null) {
    prefix=prefixMapper.getPreferredPrefix(uri,prefix,true);
  }
  return prefix;
}

Fixed version (ground truth):
@Override public String resolveNamespaceURI(String uri){
  String prefix=null;
  if (contextualNamespaces != null) {
    prefix=contextualNamespaces.resolveNamespaceURI(uri);
  }
  if (prefix == null) {
    prefix=super.resolveNamespaceURI(uri);
  }
  return prefix;
}
Program: 65486
Project: 65486
Buggy source:
@Override public void put(String a,String b){
  super.put(a,b);
}

Fixed version (ground truth):
@Override public void put(String prefix,String uri){
  String newPrefix=prefixMapper.getPreferredPrefix(uri,prefix,true);
  if (newPrefix == null || newPrefix.length() == 0) {
    super.put(prefix,uri);
  }
 else {
    super.put(newPrefix,uri);
  }
}
Program: 65487
Project: 65487
Buggy source:
@AfterClass public static void tearDown(){
  if (ddlDrop) {
    runDdl(conn,DROP_COMPLEXPKG2_PACKAGE_BODY,ddlDebug);
    runDdl(conn,DROP_COMPLEXPKG2_PACKAGE,ddlDebug);
    runDdl(conn,DROP_COMPLEXPKG2_SIMPLERECORD_TYPE,ddlDebug);
    runDdl(conn,DROP_COMPLEXPKG2_COMPLEXRECORD_TYPE,ddlDebug);
    runDdl(conn,DROP_A_CUSTOMER2_TYPE,ddlDebug);
    runDdl(conn,DROP_A_CONTACT2_TYPE,ddlDebug);
    runDdl(conn,DROP_A_PHONE2_TYPE_TABLE,ddlDebug);
    runDdl(conn,DROP_A_PHONE2_TYPE,ddlDebug);
    runDdl(conn,DROP_COMPLEXPKG2_TAB1_TYPE,ddlDebug);
    runDdl(conn,DROP_VARCHAR2ARRAY_TYPE,ddlDebug);
  }
}

Fixed version (ground truth):
@AfterClass public static void tearDown(){
  if (ddlDrop) {
    runDdl(conn,DROP_COMPLEXPKG2_PACKAGE_BODY,ddlDebug);
    runDdl(conn,DROP_COMPLEXPKG2_PACKAGE,ddlDebug);
    runDdl(conn,DROP_COMPLEXPKG2_SIMPLERECORD_TYPE,ddlDebug);
    runDdl(conn,DROP_COMPLEXPKG2_COMPLEXRECORD_TYPE,ddlDebug);
    runDdl(conn,DROP_COMPLEXPKG2_MORECOMPLEXRECORD_TYPE,ddlDebug);
    runDdl(conn,DROP_A_CUSTOMER2_TYPE,ddlDebug);
    runDdl(conn,DROP_A_CONTACT2_TYPE,ddlDebug);
    runDdl(conn,DROP_A_PHONE2_TYPE_VARRAY,ddlDebug);
    runDdl(conn,DROP_A_PHONE2_TYPE_TABLE,ddlDebug);
    runDdl(conn,DROP_A_PHONE2_TYPE,ddlDebug);
    runDdl(conn,DROP_COMPLEXPKG2_TAB1_TYPE,ddlDebug);
    runDdl(conn,DROP_VARCHAR2ARRAY_TYPE,ddlDebug);
  }
}
Program: 65490
Project: 65490
Buggy source:
public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlAnyCollectionMapping.isReadOnly()) {
    return false;
  }
  ContainerPolicy cp=xmlAnyCollectionMapping.getContainerPolicy();
  Object collection=xmlAnyCollectionMapping.getAttributeAccessor().getAttributeValueFromObject(object);
  if (null == collection) {
    return false;
  }
  Object iterator=cp.iteratorFor(collection);
  if (null != iterator && cp.hasNext(iterator)) {
    XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
    marshalRecord.closeStartGroupingElements(groupingFragment);
  }
 else {
    return false;
  }
  Object objectValue;
  while (cp.hasNext(iterator)) {
    objectValue=cp.next(iterator,session);
    if (xmlAnyCollectionMapping.getConverter() != null) {
      objectValue=xmlAnyCollectionMapping.getConverter().convertObjectValueToDataValue(objectValue,session,marshalRecord.getMarshaller());
    }
    marshalSingleValue(xPathFragment,marshalRecord,object,objectValue,session,namespaceResolver,ObjectMarshalContext.getInstance());
  }
  return true;
}

Fixed version (ground truth):
public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlAnyCollectionMapping.isReadOnly()) {
    return false;
  }
  ContainerPolicy cp=xmlAnyCollectionMapping.getContainerPolicy();
  Object collection=xmlAnyCollectionMapping.getAttributeAccessor().getAttributeValueFromObject(object);
  if (null == collection) {
    AbstractNullPolicy wrapperNP=xmlAnyCollectionMapping.getWrapperNullPolicy();
    if (wrapperNP != null && wrapperNP.getMarshalNullRepresentation().equals(XMLNullRepresentationType.XSI_NIL)) {
      marshalRecord.nilSimple(namespaceResolver);
      return true;
    }
 else {
      return false;
    }
  }
  Object iterator=cp.iteratorFor(collection);
  if (null != iterator && cp.hasNext(iterator)) {
    XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
    marshalRecord.closeStartGroupingElements(groupingFragment);
  }
 else {
    if (xmlAnyCollectionMapping.getWrapperNullPolicy() != null) {
      XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
      marshalRecord.closeStartGroupingElements(groupingFragment);
    }
 else {
      return false;
    }
  }
  Object objectValue;
  while (cp.hasNext(iterator)) {
    objectValue=cp.next(iterator,session);
    if (xmlAnyCollectionMapping.getConverter() != null) {
      objectValue=xmlAnyCollectionMapping.getConverter().convertObjectValueToDataValue(objectValue,session,marshalRecord.getMarshaller());
    }
    marshalSingleValue(xPathFragment,marshalRecord,object,objectValue,session,namespaceResolver,ObjectMarshalContext.getInstance());
  }
  return true;
}
Program: 65491
Project: 65491
Buggy source:
public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlBinaryDataCollectionMapping.isReadOnly()) {
    return false;
  }
  Object collection=xmlBinaryDataCollectionMapping.getAttributeAccessor().getAttributeValueFromObject(object);
  if (null == collection) {
    return false;
  }
  String xopPrefix=null;
  if (namespaceResolver != null) {
    xopPrefix=namespaceResolver.resolveNamespaceURI(XMLConstants.XOP_URL);
  }
  if (xopPrefix == null || namespaceResolver == null) {
    xopPrefix=XMLConstants.XOP_PREFIX;
    marshalRecord.getNamespaceResolver().put(xopPrefix,XMLConstants.XOP_URL);
  }
  ContainerPolicy cp=getContainerPolicy();
  Object iterator=cp.iteratorFor(collection);
  while (cp.hasNext(iterator)) {
    Object objectValue=cp.next(iterator,session);
    marshalSingleValue(xPathFragment,marshalRecord,object,objectValue,session,namespaceResolver,ObjectMarshalContext.getInstance());
  }
  marshalRecord.getNamespaceResolver().removeNamespace(XMLConstants.XOP_PREFIX);
  return true;
}

Fixed version (ground truth):
public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlBinaryDataCollectionMapping.isReadOnly()) {
    return false;
  }
  Object collection=xmlBinaryDataCollectionMapping.getAttributeAccessor().getAttributeValueFromObject(object);
  if (null == collection) {
    AbstractNullPolicy wrapperNP=xmlBinaryDataCollectionMapping.getWrapperNullPolicy();
    if (wrapperNP != null && wrapperNP.getMarshalNullRepresentation().equals(XMLNullRepresentationType.XSI_NIL)) {
      marshalRecord.nilSimple(namespaceResolver);
      return true;
    }
 else {
      return false;
    }
  }
  String xopPrefix=null;
  if (namespaceResolver != null) {
    xopPrefix=namespaceResolver.resolveNamespaceURI(XMLConstants.XOP_URL);
  }
  if (xopPrefix == null || namespaceResolver == null) {
    xopPrefix=XMLConstants.XOP_PREFIX;
    marshalRecord.getNamespaceResolver().put(xopPrefix,XMLConstants.XOP_URL);
  }
  ContainerPolicy cp=getContainerPolicy();
  Object iterator=cp.iteratorFor(collection);
  if (!cp.hasNext(iterator)) {
    if (xmlBinaryDataCollectionMapping.getWrapperNullPolicy() != null) {
      XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
      marshalRecord.closeStartGroupingElements(groupingFragment);
    }
 else {
      return false;
    }
  }
  while (cp.hasNext(iterator)) {
    Object objectValue=cp.next(iterator,session);
    marshalSingleValue(xPathFragment,marshalRecord,object,objectValue,session,namespaceResolver,ObjectMarshalContext.getInstance());
  }
  marshalRecord.getNamespaceResolver().removeNamespace(XMLConstants.XOP_PREFIX);
  return true;
}
Program: 65492
Project: 65492
Buggy source:
public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlChoiceCollectionMapping.isReadOnly()) {
    return false;
  }
  Object value=xmlChoiceCollectionMapping.getAttributeValueFromObject(object);
  if (value == null) {
    return false;
  }
  ContainerPolicy cp=getContainerPolicy();
  Object iterator=cp.iteratorFor(value);
  if (null != iterator && cp.hasNext(iterator)) {
    if (xPathFragment != null) {
      XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
      marshalRecord.closeStartGroupingElements(groupingFragment);
    }
  }
 else {
    return false;
  }
  while (cp.hasNext(iterator)) {
    Object nextValue=cp.next(iterator,session);
    marshalSingleValue(xPathFragment,marshalRecord,object,nextValue,session,namespaceResolver,ObjectMarshalContext.getInstance());
  }
  return true;
}

Fixed version (ground truth):
public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlChoiceCollectionMapping.isReadOnly()) {
    return false;
  }
  Object value=xmlChoiceCollectionMapping.getAttributeValueFromObject(object);
  if (value == null) {
    AbstractNullPolicy wrapperNP=xmlChoiceCollectionMapping.getWrapperNullPolicy();
    if (wrapperNP != null && wrapperNP.getMarshalNullRepresentation().equals(XMLNullRepresentationType.XSI_NIL)) {
      marshalRecord.nilSimple(namespaceResolver);
      return true;
    }
 else {
      return false;
    }
  }
  ContainerPolicy cp=getContainerPolicy();
  Object iterator=cp.iteratorFor(value);
  if (null != iterator && cp.hasNext(iterator)) {
    if (xPathFragment != null) {
      XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
      marshalRecord.closeStartGroupingElements(groupingFragment);
    }
  }
 else {
    if (xmlChoiceCollectionMapping.getWrapperNullPolicy() != null) {
      XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
      marshalRecord.closeStartGroupingElements(groupingFragment);
    }
 else {
      return false;
    }
  }
  while (cp.hasNext(iterator)) {
    Object nextValue=cp.next(iterator,session);
    marshalSingleValue(xPathFragment,marshalRecord,object,nextValue,session,namespaceResolver,ObjectMarshalContext.getInstance());
  }
  return true;
}
Program: 65493
Project: 65493
Buggy source:
public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlCompositeCollectionMapping.isReadOnly()) {
    return false;
  }
  ContainerPolicy cp=getContainerPolicy();
  Object collection=xmlCompositeCollectionMapping.getAttributeAccessor().getAttributeValueFromObject(object);
  if (null == collection) {
    return false;
  }
  Object iterator=cp.iteratorFor(collection);
  if (null != iterator && cp.hasNext(iterator)) {
    XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
    marshalRecord.closeStartGroupingElements(groupingFragment);
  }
 else {
    return false;
  }
  marshalRecord.startCollection();
  while (cp.hasNext(iterator)) {
    Object objectValue=cp.next(iterator,session);
    marshalSingleValue(xPathFragment,marshalRecord,object,objectValue,session,namespaceResolver,ObjectMarshalContext.getInstance());
  }
  marshalRecord.endCollection();
  return true;
}

Fixed version (ground truth):
public boolean marshal(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver){
  if (xmlCompositeCollectionMapping.isReadOnly()) {
    return false;
  }
  ContainerPolicy cp=getContainerPolicy();
  Object collection=xmlCompositeCollectionMapping.getAttributeAccessor().getAttributeValueFromObject(object);
  if (null == collection) {
    AbstractNullPolicy wrapperNP=xmlCompositeCollectionMapping.getWrapperNullPolicy();
    if (wrapperNP != null && wrapperNP.getMarshalNullRepresentation().equals(XMLNullRepresentationType.XSI_NIL)) {
      marshalRecord.nilSimple(namespaceResolver);
      return true;
    }
 else {
      return false;
    }
  }
  Object iterator=cp.iteratorFor(collection);
  if (null != iterator && cp.hasNext(iterator)) {
    XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
    marshalRecord.closeStartGroupingElements(groupingFragment);
  }
 else {
    if (xmlCompositeCollectionMapping.getWrapperNullPolicy() != null) {
      XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
      marshalRecord.closeStartGroupingElements(groupingFragment);
    }
 else {
      return false;
    }
  }
  marshalRecord.startCollection();
  while (cp.hasNext(iterator)) {
    Object objectValue=cp.next(iterator,session);
    marshalSingleValue(xPathFragment,marshalRecord,object,objectValue,session,namespaceResolver,ObjectMarshalContext.getInstance());
  }
  marshalRecord.endCollection();
  return true;
}
Program: 65496
Project: 65496
Buggy source:
public Object getContainerInstance(ContainerValue c,boolean createContainerIfNecessary){
  Object containerInstance=containerInstances[c.getIndex()];
  if (containerInstance == null) {
    if (c.getReuseContainer() && !(c.getMapping().getAttributeAccessor().isReadOnly())) {
      containerInstance=c.getMapping().getAttributeAccessor().getAttributeValueFromObject(getCurrentObject());
    }
    if (null == containerInstance && createContainerIfNecessary) {
      containerInstance=c.getContainerInstance();
    }
    containerInstances[c.getIndex()]=containerInstance;
    if (c.getMapping() instanceof XMLChoiceCollectionMapping) {
      XMLChoiceCollectionMappingUnmarshalNodeValue nodeValue=(XMLChoiceCollectionMappingUnmarshalNodeValue)c;
      for (      NodeValue next : nodeValue.getAllNodeValues()) {
        NodeValue nestedNodeValue=((XMLChoiceCollectionMappingUnmarshalNodeValue)next).getChoiceElementNodeValue();
        containerInstances[((ContainerValue)nestedNodeValue).getIndex()]=containerInstance;
      }
    }
  }
  return containerInstance;
}

Fixed version (ground truth):
public Object getContainerInstance(ContainerValue c,boolean createContainerIfNecessary){
  Object containerInstance=containerInstances[c.getIndex()];
  if (containerInstance == null) {
    if (c.getReuseContainer() && !(c.getMapping().getAttributeAccessor().isReadOnly())) {
      containerInstance=c.getMapping().getAttributeAccessor().getAttributeValueFromObject(getCurrentObject());
    }
    if (null == containerInstance && createContainerIfNecessary) {
      containerInstance=c.getContainerInstance();
    }
    containerInstances[c.getIndex()]=containerInstance;
  }
  return containerInstance;
}
Program: 65498
Project: 65498
Buggy source:
private SAXParserFactory getSAXParserFactory() throws XMLMarshalException {
  if (null == saxParserFactory) {
    try {
      saxParserFactory=SAXParserFactory.newInstance();
      saxParserFactory.setNamespaceAware(true);
      Schema schema=getSchema();
      if (null != schema) {
        saxParserFactory.setSchema(schema);
      }
      saxParserFactory.setFeature(XMLReader.NAMESPACE_PREFIXES_FEATURE,true);
      try {
        saxParserFactory.setFeature(XMLReader.REPORT_IGNORED_ELEMENT_CONTENT_WHITESPACE_FEATURE,true);
      }
 catch (      org.xml.sax.SAXNotRecognizedException ex) {
      }
catch (      org.xml.sax.SAXNotSupportedException ex) {
      }
      if (null != parserFeatures) {
        for (        Map.Entry<String,Boolean> parserFeature : parserFeatures.entrySet()) {
          try {
            saxParserFactory.setFeature(parserFeature.getKey(),parserFeature.getValue());
          }
 catch (          org.xml.sax.SAXNotRecognizedException ex) {
          }
catch (          org.xml.sax.SAXNotSupportedException ex) {
          }
        }
      }
      return saxParserFactory;
    }
 catch (    Exception e) {
      throw XMLMarshalException.errorInstantiatingSchemaPlatform(e);
    }
  }
  return saxParserFactory;
}

Fixed version (ground truth):
private SAXParserFactory getSAXParserFactory() throws XMLMarshalException {
  if (null == saxParserFactory) {
    try {
      saxParserFactory=SAXParserFactory.newInstance();
      saxParserFactory.setNamespaceAware(true);
      saxParserFactory.setFeature(XMLReader.NAMESPACE_PREFIXES_FEATURE,true);
      try {
        saxParserFactory.setFeature(XMLReader.REPORT_IGNORED_ELEMENT_CONTENT_WHITESPACE_FEATURE,true);
      }
 catch (      org.xml.sax.SAXNotRecognizedException ex) {
      }
catch (      org.xml.sax.SAXNotSupportedException ex) {
      }
      if (null != parserFeatures) {
        for (        Map.Entry<String,Boolean> parserFeature : parserFeatures.entrySet()) {
          try {
            saxParserFactory.setFeature(parserFeature.getKey(),parserFeature.getValue());
          }
 catch (          org.xml.sax.SAXNotRecognizedException ex) {
          }
catch (          org.xml.sax.SAXNotSupportedException ex) {
          }
        }
      }
      return saxParserFactory;
    }
 catch (    Exception e) {
      throw XMLMarshalException.errorInstantiatingSchemaPlatform(e);
    }
  }
  return saxParserFactory;
}
Program: 65499
Project: 65499
Buggy source:
public void setSchema(Schema schema){
  this.schema=schema;
  if (null != saxParserFactory) {
    saxParserFactory.setSchema(schema);
    saxParser=null;
    xmlReader=null;
  }
  if (null != xmlParser) {
    xmlParser.setXMLSchema(schema);
  }
}

Fixed version (ground truth):
public void setSchema(Schema schema){
  this.schema=schema;
  if (null != xmlParser) {
    xmlParser.setXMLSchema(schema);
  }
}
Program: 65501
Project: 65501
Buggy source:
public void setContentHandler(ContentHandler handler){
  if (validatorHandler != null) {
    validatorHandler.setContentHandler(handler);
  }
 else {
    reader.setContentHandler(handler);
  }
}

Fixed version (ground truth):
public void setContentHandler(ContentHandler contentHandler){
  this.contentHandler=contentHandler;
}
Program: 65502
Project: 65502
Buggy source:
public void setValidatorHandler(ValidatorHandler validatorHandler){
  if (reader != null) {
    reader.setContentHandler(validatorHandler);
  }
  this.validatorHandler=validatorHandler;
  if (validatorHandler != null) {
    validatorHandler.setErrorHandler(getErrorHandler());
  }
}

Fixed version (ground truth):
public void setValidatorHandler(ValidatorHandler validatorHandler){
  this.validatorHandler=validatorHandler;
}
Program: 65503
Project: 65503
Buggy source:
public ContentHandler getContentHandler(){
  return reader.getContentHandler();
}

Fixed version (ground truth):
public ContentHandler getContentHandler(){
  return contentHandler;
}