nus-yam/ex-repair huggingface dataset:
Program: 66036
Project: 66036
Buggy source:
/** 
 * Get the initializer class Here we will attempt to build an EquinoxInitializer.  It will only be available if the org.eclipse.persistence.jpa.equinox fragment is available.  Else, we will return a standard OSGi initializer.
 */
public JPAInitializer getInitializer(String emName,Map m){
  ClassLoader classLoader=getClassLoader(emName,m);
  JPAInitializer initializer;
  if (this.initializerClassName != null) {
    try {
      Class initializerClass=Class.forName(this.initializerClassName);
      Class[] argTypes=new Class[]{ClassLoader.class,Map.class};
      Object[] args=new Object[]{classLoader,m,this};
      initializer=(JPAInitializer)initializerClass.getConstructor(argTypes).newInstance(args);
      initializer.initialize(m);
      return initializer;
    }
 catch (    Exception exception) {
      AbstractSessionLog.getLog().log(SessionLog.WARNING,LoggingLocalization.buildMessage("String_Node_Str",new Object[]{this.initializerClassName,exception}));
      AbstractSessionLog.getLog().logThrowable(SessionLog.WARNING,exception);
    }
  }
  initializer=new OSGiInitializer(classLoader);
  initializer.initialize(m);
  return initializer;
}

Fixed version (ground truth):
/** 
 * Get the initializer class Here we will attempt to build an EquinoxInitializer.  It will only be available if the org.eclipse.persistence.jpa.equinox fragment is available.  Else, we will return a standard OSGi initializer.
 */
public JPAInitializer getInitializer(String emName,Map m){
  ClassLoader classLoader=getClassLoader(emName,m);
  JPAInitializer initializer;
  if (this.initializerClassName != null) {
    try {
      Class initializerClass=Class.forName(this.initializerClassName);
      Class[] argTypes=new Class[]{ClassLoader.class,Map.class};
      Object[] args=new Object[]{classLoader,m};
      initializer=(JPAInitializer)initializerClass.getConstructor(argTypes).newInstance(args);
      initializer.initialize(m);
      return initializer;
    }
 catch (    Exception exception) {
      AbstractSessionLog.getLog().log(SessionLog.WARNING,LoggingLocalization.buildMessage("String_Node_Str",new Object[]{this.initializerClassName,exception}));
      AbstractSessionLog.getLog().logThrowable(SessionLog.WARNING,exception);
    }
  }
  initializer=new OSGiInitializer(classLoader);
  initializer.initialize(m);
  return initializer;
}
Program: 66037
Project: 66037
Buggy source:
public void testFailOnSecondErrorXMLStreamWriter() throws Exception {
  CustomErrorValidationEventHandler eventHandler=new CustomErrorValidationEventHandler();
  marshaller.setEventHandler(eventHandler);
  try {
    if (null == XML_OUTPUT_FACTORY) {
      return;
    }
    XMLStreamWriter xmlStreamWriter=XML_OUTPUT_FACTORY.createXMLStreamWriter(new ByteArrayOutputStream());
    marshaller.marshal(employee,xmlStreamWriter);
  }
 catch (  MarshalException ex) {
    assertEquals(2,eventHandler.getErrorCount());
    return;
  }
catch (  XMLStreamException e) {
    return;
  }
catch (  Exception e) {
    throw e;
  }
  fail("String_Node_Str");
}

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

Fixed version (ground truth):
public void testFailOnSecondErrorContentHandler() throws Exception {
  CustomErrorValidationEventHandler eventHandler=new CustomErrorValidationEventHandler();
  marshaller.setEventHandler(eventHandler);
  try {
    marshaller.marshal(employee,new DefaultHandler());
  }
 catch (  JAXBException ex) {
    assertEquals(2,eventHandler.getErrorCount());
    return;
  }
catch (  Exception e) {
    throw e;
  }
  fail("String_Node_Str");
}
Program: 66039
Project: 66039
Buggy source:
public void testFailOnSecondErrorOutputStream() throws Exception {
  CustomErrorValidationEventHandler eventHandler=new CustomErrorValidationEventHandler();
  marshaller.setEventHandler(eventHandler);
  try {
    marshaller.marshal(employee,new ByteArrayOutputStream());
  }
 catch (  MarshalException ex) {
    assertEquals(2,eventHandler.getErrorCount());
    return;
  }
catch (  Exception e) {
    throw e;
  }
  fail("String_Node_Str");
}

Fixed version (ground truth):
public void testFailOnSecondErrorOutputStream() throws Exception {
  CustomErrorValidationEventHandler eventHandler=new CustomErrorValidationEventHandler();
  marshaller.setEventHandler(eventHandler);
  try {
    marshaller.marshal(employee,new ByteArrayOutputStream());
  }
 catch (  JAXBException ex) {
    assertEquals(2,eventHandler.getErrorCount());
    return;
  }
catch (  Exception e) {
    throw e;
  }
  fail("String_Node_Str");
}
Program: 66040
Project: 66040
Buggy source:
public void testFailOnSecondErrorResult() throws Exception {
  CustomErrorValidationEventHandler eventHandler=new CustomErrorValidationEventHandler();
  marshaller.setEventHandler(eventHandler);
  try {
    marshaller.marshal(employee,new StreamResult(new ByteArrayOutputStream()));
  }
 catch (  MarshalException ex) {
    assertEquals(2,eventHandler.getErrorCount());
    return;
  }
catch (  Exception e) {
    throw e;
  }
  fail("String_Node_Str");
}

Fixed version (ground truth):
public void testFailOnSecondErrorResult() throws Exception {
  CustomErrorValidationEventHandler eventHandler=new CustomErrorValidationEventHandler();
  marshaller.setEventHandler(eventHandler);
  try {
    marshaller.marshal(employee,new StreamResult(new ByteArrayOutputStream()));
  }
 catch (  JAXBException ex) {
    assertEquals(2,eventHandler.getErrorCount());
    return;
  }
catch (  Exception e) {
    throw e;
  }
  fail("String_Node_Str");
}
Program: 66041
Project: 66041
Buggy source:
public void testFailOnSecondErrorWriter() throws Exception {
  CustomErrorValidationEventHandler eventHandler=new CustomErrorValidationEventHandler();
  marshaller.setEventHandler(eventHandler);
  try {
    marshaller.marshal(employee,new StringWriter());
  }
 catch (  MarshalException ex) {
    assertEquals(2,eventHandler.getErrorCount());
    return;
  }
catch (  Exception e) {
    throw e;
  }
  fail("String_Node_Str");
}

Fixed version (ground truth):
public void testFailOnSecondErrorWriter() throws Exception {
  CustomErrorValidationEventHandler eventHandler=new CustomErrorValidationEventHandler();
  marshaller.setEventHandler(eventHandler);
  try {
    marshaller.marshal(employee,new StringWriter());
  }
 catch (  JAXBException ex) {
    assertEquals(2,eventHandler.getErrorCount());
    return;
  }
catch (  Exception e) {
    throw e;
  }
  fail("String_Node_Str");
}
Program: 66042
Project: 66042
Buggy source:
public void testFailOnSecondErrorNode() throws Exception {
  CustomErrorValidationEventHandler eventHandler=new CustomErrorValidationEventHandler();
  marshaller.setEventHandler(eventHandler);
  try {
    DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
    DocumentBuilder db=dbf.newDocumentBuilder();
    Document document=db.newDocument();
    marshaller.marshal(employee,document);
  }
 catch (  MarshalException ex) {
    assertEquals(2,eventHandler.getErrorCount());
    return;
  }
catch (  Exception e) {
    throw e;
  }
  fail("String_Node_Str");
}

Fixed version (ground truth):
public void testFailOnSecondErrorNode() throws Exception {
  CustomErrorValidationEventHandler eventHandler=new CustomErrorValidationEventHandler();
  marshaller.setEventHandler(eventHandler);
  try {
    DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
    DocumentBuilder db=dbf.newDocumentBuilder();
    Document document=db.newDocument();
    marshaller.marshal(employee,document);
  }
 catch (  JAXBException ex) {
    assertEquals(2,eventHandler.getErrorCount());
    return;
  }
catch (  Exception e) {
    throw e;
  }
  fail("String_Node_Str");
}
Program: 66043
Project: 66043
Buggy source:
public void testFailOnSecondErrorXMLEventWriter() throws Exception {
  CustomErrorValidationEventHandler eventHandler=new CustomErrorValidationEventHandler();
  marshaller.setEventHandler(eventHandler);
  try {
    if (null == XML_OUTPUT_FACTORY) {
      return;
    }
    XMLEventWriter xmlEventWriter=XML_OUTPUT_FACTORY.createXMLEventWriter(new ByteArrayOutputStream());
    marshaller.marshal(employee,xmlEventWriter);
  }
 catch (  MarshalException ex) {
    assertEquals(2,eventHandler.getErrorCount());
    return;
  }
catch (  XMLStreamException e) {
    return;
  }
catch (  Exception e) {
    throw e;
  }
  fail("String_Node_Str");
}

Fixed version (ground truth):
public void testFailOnSecondErrorXMLEventWriter() throws Exception {
  CustomErrorValidationEventHandler eventHandler=new CustomErrorValidationEventHandler();
  marshaller.setEventHandler(eventHandler);
  try {
    if (null == XML_OUTPUT_FACTORY) {
      return;
    }
    XMLEventWriter xmlEventWriter=XML_OUTPUT_FACTORY.createXMLEventWriter(new ByteArrayOutputStream());
    marshaller.marshal(employee,xmlEventWriter);
  }
 catch (  JAXBException ex) {
    assertEquals(2,eventHandler.getErrorCount());
    return;
  }
catch (  XMLStreamException e) {
    return;
  }
catch (  Exception e) {
    throw e;
  }
  fail("String_Node_Str");
}
Program: 66044
Project: 66044
Buggy source:
public void testInvalidEncoding() throws Exception {
  marshaller.setProperty(Marshaller.JAXB_ENCODING,encoding);
  ByteArrayOutputStream byteOutStream=new ByteArrayOutputStream();
  try {
    marshaller.marshal(controlObject,byteOutStream);
  }
 catch (  MarshalException e) {
    assertTrue(true);
    return;
  }
catch (  Exception e) {
    fail("String_Node_Str");
    return;
  }
  fail("String_Node_Str");
}

Fixed version (ground truth):
public void testInvalidEncoding() throws Exception {
  marshaller.setProperty(Marshaller.JAXB_ENCODING,encoding);
  ByteArrayOutputStream byteOutStream=new ByteArrayOutputStream();
  try {
    marshaller.marshal(controlObject,byteOutStream);
  }
 catch (  JAXBException e) {
    assertTrue(true);
    return;
  }
catch (  Exception e) {
    fail("String_Node_Str");
    return;
  }
  fail("String_Node_Str");
}
Program: 66045
Project: 66045
Buggy source:
public void testMarshalToInvalidOutputStream(){
  try {
    FileDescriptor fd=new FileDescriptor();
    FileOutputStream filestream=new FileOutputStream(fd);
    marshaller.marshal(getControlObject(),filestream);
  }
 catch (  MarshalException e) {
    assertTrue(true);
    return;
  }
catch (  Exception e) {
    e.printStackTrace();
    fail("String_Node_Str");
    return;
  }
  fail("String_Node_Str");
}

Fixed version (ground truth):
public void testMarshalToInvalidOutputStream(){
  try {
    FileDescriptor fd=new FileDescriptor();
    FileOutputStream filestream=new FileOutputStream(fd);
    marshaller.marshal(getControlObject(),filestream);
  }
 catch (  JAXBException e) {
    assertTrue(true);
    return;
  }
catch (  Exception e) {
    e.printStackTrace();
    fail("String_Node_Str");
    return;
  }
  fail("String_Node_Str");
}
Program: 66046
Project: 66046
Buggy source:
public void testMarshalToInvalidNode() throws Exception {
  boolean caughtException=false;
  Document document=parser.newDocument();
  try {
    marshaller.marshal(getControlObject(),document.createAttribute("String_Node_Str"));
  }
 catch (  IllegalArgumentException e) {
    caughtException=false;
  }
catch (  MarshalException e) {
    caughtException=true;
  }
  assertTrue("String_Node_Str",caughtException);
}

Fixed version (ground truth):
public void testMarshalToInvalidNode() throws Exception {
  boolean caughtException=false;
  Document document=parser.newDocument();
  try {
    marshaller.marshal(getControlObject(),document.createAttribute("String_Node_Str"));
  }
 catch (  IllegalArgumentException e) {
    caughtException=false;
  }
catch (  JAXBException e) {
    caughtException=true;
  }
  assertTrue("String_Node_Str",caughtException);
}
Program: 66047
Project: 66047
Buggy source:
public void testMarshalToInvalidResult() throws Exception {
  boolean caughtException=false;
  Document document=parser.newDocument();
  DOMResult result=new DOMResult(document.createAttribute("String_Node_Str"));
  try {
    marshaller.marshal(getControlObject(),result);
  }
 catch (  IllegalArgumentException e) {
    caughtException=false;
  }
catch (  MarshalException e) {
    caughtException=true;
  }
  assertTrue("String_Node_Str",caughtException);
}

Fixed version (ground truth):
public void testMarshalToInvalidResult() throws Exception {
  boolean caughtException=false;
  Document document=parser.newDocument();
  DOMResult result=new DOMResult(document.createAttribute("String_Node_Str"));
  try {
    marshaller.marshal(getControlObject(),result);
  }
 catch (  IllegalArgumentException e) {
    caughtException=false;
  }
catch (  JAXBException e) {
    caughtException=true;
  }
  assertTrue("String_Node_Str",caughtException);
}
Program: 66048
Project: 66048
Buggy source:
/** 
 * We should throw an exception if users try to marshal an object which is not of a type that is mapped in the project. The class Car is not mapped in the project being used so an exception should be thrown
 */
public void testMarshalInvalidObject(){
  StringWriter writer=new StringWriter();
  try {
    marshaller.marshal(new Car(),writer);
  }
 catch (  MarshalException marshalException) {
    Throwable linkedException=marshalException.getLinkedException();
    assertTrue("String_Node_Str",linkedException instanceof XMLMarshalException);
    assertTrue("String_Node_Str",((XMLMarshalException)linkedException).getErrorCode() == XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT);
    return;
  }
catch (  Exception e) {
    log(e.getMessage());
    assertTrue("String_Node_Str",false);
  }
  assertTrue("String_Node_Str",false);
}

Fixed version (ground truth):
/** 
 * We should throw an exception if users try to marshal an object which is not of a type that is mapped in the project. The class Car is not mapped in the project being used so an exception should be thrown
 */
public void testMarshalInvalidObject(){
  StringWriter writer=new StringWriter();
  try {
    marshaller.marshal(new Car(),writer);
  }
 catch (  JAXBException jaxbex) {
    Throwable internalException=jaxbex.getInternalException();
    assertTrue("String_Node_Str",internalException instanceof XMLMarshalException);
    assertTrue("String_Node_Str",((XMLMarshalException)internalException).getErrorCode() == XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT);
    return;
  }
catch (  Exception e) {
    log(e.getMessage());
    assertTrue("String_Node_Str",false);
  }
  assertTrue("String_Node_Str",false);
}
Program: 66050
Project: 66050
Buggy source:
public void marshal(Object object,Writer writer) throws JAXBException {
  if (object == null || writer == null) {
    throw new IllegalArgumentException();
  }
  if (object instanceof JAXBElement) {
    object=createXMLRootFromJAXBElement((JAXBElement)object);
  }
  try {
    xmlMarshaller.marshal(object,writer);
  }
 catch (  Exception e) {
    throw new MarshalException(e);
  }
}

Fixed version (ground truth):
public void marshal(Object object,Writer writer) throws JAXBException {
  if (object == null || writer == null) {
    throw new IllegalArgumentException();
  }
  if (object instanceof JAXBElement) {
    object=createXMLRootFromJAXBElement((JAXBElement)object);
  }
  try {
    xmlMarshaller.marshal(object,writer);
  }
 catch (  Exception e) {
    throw org.eclipse.persistence.exceptions.JAXBException.marshalFailure(e);
  }
}
Program: 66051
Project: 66051
Buggy source:
private void reset(){
  xPathNode=null;
  childRecord=null;
  transformationRecord=null;
  if (null != selfRecords) {
    selfRecords.clear();
  }
  if (null != indexMap) {
    indexMap.clear();
  }
  nullCapableValues=null;
  if (null != containersMap) {
    containersMap.clear();
  }
  isBufferCDATA=false;
  attributes=null;
  typeQName=null;
  isSelfRecord=false;
  unmarshalContext=null;
  isXsiNil=false;
  this.childRecordPool.add(this);
}

Fixed version (ground truth):
private void reset(){
  xPathNode=null;
  childRecord=null;
  transformationRecord=null;
  if (null != selfRecords) {
    selfRecords.clear();
  }
  if (null != indexMap) {
    indexMap.clear();
  }
  nullCapableValues=null;
  if (null != containersMap) {
    containersMap.clear();
  }
  isBufferCDATA=false;
  attributes=null;
  typeQName=null;
  isSelfRecord=false;
  unmarshalContext=null;
  isXsiNil=false;
  this.childRecordPool.add(this);
  unmappedLevel=-1;
}
Program: 66052
Project: 66052
Buggy source:
public void characters(char[] ch,int start,int length) throws SAXException {
  try {
    if (null != selfRecords) {
      for (int x=0, selfRecordsSize=selfRecords.size(); x < selfRecordsSize; x++) {
        UnmarshalRecord selfRecord=selfRecords.get(x);
        if (selfRecord != null) {
          selfRecord.characters(ch,start,length);
        }
 else {
          getFragmentBuilder().characters(ch,start,length);
        }
      }
    }
    XPathNode textNode=xPathNode.getTextNode();
    if (null == textNode) {
      textNode=xPathNode.getAnyNode();
      if (textNode != null) {
        xpathNodeIsMixedContent=true;
        this.xPathFragment.setLocalName(null);
        this.xPathFragment.setNamespaceURI(null);
        if (0 == length) {
          return;
        }
        String tmpString=new String(ch,start,length);
        if (!textNode.isWhitespaceAware() && tmpString.trim().length() == 0) {
          return;
        }
      }
    }
    if (null != textNode) {
      xPathNode=textNode;
      unmarshalContext.characters(this);
    }
    if (null != xPathNode.getUnmarshalNodeValue()) {
      getStringBuffer().append(ch,start,length);
    }
  }
 catch (  EclipseLinkException e) {
    if (null == xmlReader.getErrorHandler()) {
      throw e;
    }
 else {
      SAXParseException saxParseException=new SAXParseException(null,null,null,0,0,e);
      xmlReader.getErrorHandler().error(saxParseException);
    }
  }
}

Fixed version (ground truth):
public void characters(char[] ch,int start,int length) throws SAXException {
  try {
    if (null != selfRecords) {
      for (int x=0, selfRecordsSize=selfRecords.size(); x < selfRecordsSize; x++) {
        UnmarshalRecord selfRecord=selfRecords.get(x);
        if (selfRecord != null) {
          selfRecord.characters(ch,start,length);
        }
 else {
          getFragmentBuilder().characters(ch,start,length);
        }
      }
    }
    if (-1 != unmappedLevel && unmappedLevel <= levelIndex) {
      return;
    }
    XPathNode textNode=xPathNode.getTextNode();
    if (null == textNode) {
      textNode=xPathNode.getAnyNode();
      if (textNode != null) {
        xpathNodeIsMixedContent=true;
        this.xPathFragment.setLocalName(null);
        this.xPathFragment.setNamespaceURI(null);
        if (0 == length) {
          return;
        }
        String tmpString=new String(ch,start,length);
        if (!textNode.isWhitespaceAware() && tmpString.trim().length() == 0) {
          return;
        }
      }
    }
    if (null != textNode) {
      xPathNode=textNode;
      unmarshalContext.characters(this);
    }
    if (null != xPathNode.getUnmarshalNodeValue()) {
      getStringBuffer().append(ch,start,length);
    }
  }
 catch (  EclipseLinkException e) {
    if (null == xmlReader.getErrorHandler()) {
      throw e;
    }
 else {
      SAXParseException saxParseException=new SAXParseException(null,null,null,0,0,e);
      xmlReader.getErrorHandler().error(saxParseException);
    }
  }
}
Program: 66054
Project: 66054
Buggy source:
public void startUnmappedElement(String namespaceURI,String localName,String qName,Attributes atts) throws SAXException {
  if ((null != selfRecords) || (null == xmlReader) || isSelfRecord()) {
    return;
  }
  Class unmappedContentHandlerClass=getUnmarshaller().getUnmappedContentHandlerClass();
  UnmappedContentHandler unmappedContentHandler;
  if (null == unmappedContentHandlerClass) {
    unmappedContentHandler=DEFAULT_UNMAPPED_CONTENT_HANDLER;
  }
 else {
    try {
      PrivilegedNewInstanceFromClass privilegedNewInstanceFromClass=new PrivilegedNewInstanceFromClass(unmappedContentHandlerClass);
      unmappedContentHandler=(UnmappedContentHandler)privilegedNewInstanceFromClass.run();
    }
 catch (    ClassCastException e) {
      throw XMLMarshalException.unmappedContentHandlerDoesntImplement(e,unmappedContentHandlerClass.getName());
    }
catch (    IllegalAccessException e) {
      throw XMLMarshalException.errorInstantiatingUnmappedContentHandler(e,unmappedContentHandlerClass.getName());
    }
catch (    InstantiationException e) {
      throw XMLMarshalException.errorInstantiatingUnmappedContentHandler(e,unmappedContentHandlerClass.getName());
    }
  }
  UnmappedContentHandlerWrapper unmappedContentHandlerWrapper=new UnmappedContentHandlerWrapper(this,unmappedContentHandler);
  unmappedContentHandlerWrapper.startElement(namespaceURI,localName,qName,atts);
  xmlReader.setContentHandler(unmappedContentHandlerWrapper);
  xmlReader.setLexicalHandler(unmappedContentHandlerWrapper);
}

Fixed version (ground truth):
public void startUnmappedElement(String namespaceURI,String localName,String qName,Attributes atts) throws SAXException {
  if ((null != selfRecords) || (null == xmlReader) || isSelfRecord()) {
    if (-1 == unmappedLevel) {
      this.unmappedLevel=this.levelIndex;
    }
    return;
  }
  Class unmappedContentHandlerClass=getUnmarshaller().getUnmappedContentHandlerClass();
  UnmappedContentHandler unmappedContentHandler;
  if (null == unmappedContentHandlerClass) {
    unmappedContentHandler=DEFAULT_UNMAPPED_CONTENT_HANDLER;
  }
 else {
    try {
      PrivilegedNewInstanceFromClass privilegedNewInstanceFromClass=new PrivilegedNewInstanceFromClass(unmappedContentHandlerClass);
      unmappedContentHandler=(UnmappedContentHandler)privilegedNewInstanceFromClass.run();
    }
 catch (    ClassCastException e) {
      throw XMLMarshalException.unmappedContentHandlerDoesntImplement(e,unmappedContentHandlerClass.getName());
    }
catch (    IllegalAccessException e) {
      throw XMLMarshalException.errorInstantiatingUnmappedContentHandler(e,unmappedContentHandlerClass.getName());
    }
catch (    InstantiationException e) {
      throw XMLMarshalException.errorInstantiatingUnmappedContentHandler(e,unmappedContentHandlerClass.getName());
    }
  }
  UnmappedContentHandlerWrapper unmappedContentHandlerWrapper=new UnmappedContentHandlerWrapper(this,unmappedContentHandler);
  unmappedContentHandlerWrapper.startElement(namespaceURI,localName,qName,atts);
  xmlReader.setContentHandler(unmappedContentHandlerWrapper);
  xmlReader.setLexicalHandler(unmappedContentHandlerWrapper);
}
Program: 66058
Project: 66058
Buggy source:
public Metadata(DynamicClassLoader dynamicClassLoader,Map<String,Object> properties){
  this.dynamicClassLoader=dynamicClassLoader;
  this.bindings=JAXBContextFactory.getXmlBindingsFromProperties(properties,dynamicClassLoader);
}

Fixed version (ground truth):
public Metadata(DynamicClassLoader dynamicClassLoader,Map<String,?> properties){
  this.dynamicClassLoader=dynamicClassLoader;
  this.bindings=JAXBContextFactory.getXmlBindingsFromProperties(properties,dynamicClassLoader);
}
Program: 66059
Project: 66059
Buggy source:
public OXMMetadata(DynamicClassLoader classLoader,Map<String,Object> properties){
  super(classLoader,properties);
}

Fixed version (ground truth):
public OXMMetadata(DynamicClassLoader classLoader,Map<String,?> properties){
  super(classLoader,properties);
}
Program: 66061
Project: 66061
Buggy source:
/** 
 * Returns the namespace URI associated with a specified namespace prefix
 * @param prefix The prefix to lookup a namespace URI for
 * @return The namespace URI associated with the specified prefix
 */
public String resolveNamespacePrefix(String prefix){
  if (null == prefix) {
    return defaultNamespaceURI;
  }
  String uri=prefixesToNamespaces.get(prefix);
  if (null != uri) {
    return uri;
  }
 else   if (XMLConstants.XML_NAMESPACE_PREFIX.equals(prefix)) {
    return XMLConstants.XML_NAMESPACE_URL;
  }
 else   if (XMLConstants.XMLNS.equals(prefix)) {
    return XMLConstants.XMLNS_URL;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the namespace URI associated with a specified namespace prefix
 * @param prefix The prefix to lookup a namespace URI for
 * @return The namespace URI associated with the specified prefix
 */
public String resolveNamespacePrefix(String prefix){
  if (null == prefix || prefix.length() == 0) {
    return defaultNamespaceURI;
  }
  String uri=prefixesToNamespaces.get(prefix);
  if (null != uri) {
    return uri;
  }
 else   if (XMLConstants.XML_NAMESPACE_PREFIX.equals(prefix)) {
    return XMLConstants.XML_NAMESPACE_URL;
  }
 else   if (XMLConstants.XMLNS.equals(prefix)) {
    return XMLConstants.XMLNS_URL;
  }
  return null;
}
Program: 66062
Project: 66062
Buggy source:
public AttachmentMarshaller getAttachmentMarshaller(){
  return ((AttachmentMarshallerAdapter)xmlMarshaller.getAttachmentMarshaller()).getAttachmentMarshaller();
}

Fixed version (ground truth):
public AttachmentMarshaller getAttachmentMarshaller(){
  if (xmlMarshaller.getAttachmentMarshaller() == null) {
    return null;
  }
  return ((AttachmentMarshallerAdapter)xmlMarshaller.getAttachmentMarshaller()).getAttachmentMarshaller();
}
Program: 66063
Project: 66063
Buggy source:
public void setAttachmentMarshaller(AttachmentMarshaller attachmentMarshaller){
  xmlMarshaller.setAttachmentMarshaller(new AttachmentMarshallerAdapter(attachmentMarshaller));
}

Fixed version (ground truth):
public void setAttachmentMarshaller(AttachmentMarshaller attachmentMarshaller){
  if (attachmentMarshaller == null) {
    xmlMarshaller.setAttachmentMarshaller(null);
  }
 else {
    xmlMarshaller.setAttachmentMarshaller(new AttachmentMarshallerAdapter(attachmentMarshaller));
  }
}
Program: 66064
Project: 66064
Buggy source:
public void setAttachmentUnmarshaller(AttachmentUnmarshaller unmarshaller){
  xmlUnmarshaller.setAttachmentUnmarshaller(new AttachmentUnmarshallerAdapter(unmarshaller));
}

Fixed version (ground truth):
public void setAttachmentUnmarshaller(AttachmentUnmarshaller unmarshaller){
  if (unmarshaller == null) {
    xmlUnmarshaller.setAttachmentUnmarshaller(null);
  }
 else {
    xmlUnmarshaller.setAttachmentUnmarshaller(new AttachmentUnmarshallerAdapter(unmarshaller));
  }
}
Program: 66065
Project: 66065
Buggy source:
public AttachmentUnmarshaller getAttachmentUnmarshaller(){
  return ((AttachmentUnmarshallerAdapter)xmlUnmarshaller.getAttachmentUnmarshaller()).getAttachmentUnmarshaller();
}

Fixed version (ground truth):
public AttachmentUnmarshaller getAttachmentUnmarshaller(){
  if (xmlUnmarshaller.getAttachmentUnmarshaller() == null) {
    return null;
  }
  return ((AttachmentUnmarshallerAdapter)xmlUnmarshaller.getAttachmentUnmarshaller()).getAttachmentUnmarshaller();
}
Program: 66066
Project: 66066
Buggy source:
/** 
 * Returns the enum constant if the specified type denotes an enum type and the specified constant denotes a constant of the enum type. 
 */
public Object resolveEnumConstant(Object type,String constant){
  Class clazz=getJavaClass(type);
  Object[] constants=clazz.getEnumConstants();
  if (constants != null) {
    for (int i=0; i < constants.length; i++) {
      if (constant.equals(constants[i].toString())) {
        return constants[i];
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the enum constant if the specified type denotes an enum type and the specified constant denotes a constant of the enum type. 
 */
public Object resolveEnumConstant(Object type,String constant){
  Class clazz=getJavaClass(type);
  Object[] constants=clazz.getEnumConstants();
  if (constants != null) {
    for (int i=0; i < constants.length; i++) {
      Enum<?> enumConstant=(Enum<?>)constants[i];
      if (enumConstant.name().equals(constant)) {
        return enumConstant;
      }
    }
  }
  return null;
}
Program: 66069
Project: 66069
Buggy source:
/** 
 * Handle prefixed attribute - may need to declare the namespace  URI locally.
 */
protected void handlePrefixedAttribute(Element elem) throws SAXException {
  String prefix=elem.getPrefix();
  String uri=resolveNamespacePrefix(prefix);
  if (uri == null || !uri.equals(elem.getNamespaceURI())) {
    NamespaceResolver tmpresolver=getTempResolver(elem);
    tmpresolver.put(prefix,elem.getNamespaceURI());
    if (!nsresolverList.contains(tmpresolver)) {
      nsresolverList.add(tmpresolver);
    }
    getContentHandler().startPrefixMapping(prefix,elem.getNamespaceURI());
  }
}

Fixed version (ground truth):
/** 
 * Handle prefixed attribute - may need to declare the namespace  URI locally.
 */
protected void handlePrefixedAttribute(Element elem) throws SAXException {
  String prefix=elem.getPrefix();
  String uri=resolveNamespacePrefix(prefix);
  if (prefix == null && uri == null) {
    return;
  }
  if (uri == null || !uri.equals(elem.getNamespaceURI())) {
    NamespaceResolver tmpresolver=getTempResolver(elem);
    tmpresolver.put(prefix,elem.getNamespaceURI());
    if (!nsresolverList.contains(tmpresolver)) {
      nsresolverList.add(tmpresolver);
    }
    getContentHandler().startPrefixMapping(prefix,elem.getNamespaceURI());
  }
}
Program: 66070
Project: 66070
Buggy source:
/** 
 * Convenience method that iterates over each namespace resolver  in the resolver list until it locates a uri for 'prefix' or the final resolver is reached w/o success.
 * @param prefix
 * @return true if a URI exists in one of the resolvers in the list, false otherwise
 */
protected String resolveNamespacePrefix(String prefix){
  String uri=null;
  if (prefix != null) {
    for (int i=nsresolverList.size() - 1; i >= 0; i--) {
      NamespaceResolver next=nsresolverList.get(i);
      uri=next.resolveNamespacePrefix(prefix);
      if ((uri != null) && uri.length() > 0) {
        break;
      }
    }
  }
  return uri;
}

Fixed version (ground truth):
/** 
 * Convenience method that iterates over each namespace resolver  in the resolver list until it locates a uri for 'prefix' or the final resolver is reached w/o success.
 * @param prefix
 * @return true if a URI exists in one of the resolvers in the list, false otherwise
 */
protected String resolveNamespacePrefix(String prefix){
  String uri=null;
  if (null == prefix) {
    for (int i=nsresolverList.size() - 1; i >= 0; i--) {
      NamespaceResolver next=nsresolverList.get(i);
      uri=next.getDefaultNamespaceURI();
      if ((uri != null) && uri.length() > 0) {
        break;
      }
    }
  }
 else {
    for (int i=nsresolverList.size() - 1; i >= 0; i--) {
      NamespaceResolver next=nsresolverList.get(i);
      uri=next.resolveNamespacePrefix(prefix);
      if ((uri != null) && uri.length() > 0) {
        break;
      }
    }
  }
  return uri;
}
Program: 66071
Project: 66071
Buggy source:
public XMLFragmentReader(NamespaceResolver namespaceResolver){
  nsresolverList=new ArrayList();
  nsresolverList.add(namespaceResolver);
  tmpresolverMap=new HashMap<Element,NamespaceResolver>();
}

Fixed version (ground truth):
public XMLFragmentReader(NamespaceResolver namespaceResolver){
  nsresolverList=new ArrayList();
  if (null != namespaceResolver) {
    nsresolverList.add(namespaceResolver);
  }
  tmpresolverMap=new HashMap<Element,NamespaceResolver>();
}
Program: 66072
Project: 66072
Buggy source:
/** 
 * Adds a namespace to the collection of namespaces on the NamespaceResolver
 * @param prefix  The prefix for a namespace
 * @param namespaceURI  The namespace URI associated with the specified prefix
 */
public void put(String prefix,String namespaceURI){
  prefixesToNamespaces.put(prefix,namespaceURI.intern());
}

Fixed version (ground truth):
/** 
 * Adds a namespace to the collection of namespaces on the NamespaceResolver
 * @param prefix  The prefix for a namespace
 * @param namespaceURI  The namespace URI associated with the specified prefix
 */
public void put(String prefix,String namespaceURI){
  if (null == prefix || 0 == prefix.length()) {
    defaultNamespaceURI=namespaceURI;
  }
 else {
    prefixesToNamespaces.put(prefix,namespaceURI.intern());
  }
}
Program: 66073
Project: 66073
Buggy source:
public void startElement(String namespaceURI,String localName,String qName,Attributes atts) throws SAXException {
  Element element;
  if (namespaceURI == null) {
    element=document.createElement(qName);
  }
 else {
    element=document.createElementNS(namespaceURI,qName);
  }
  node=node.appendChild(element);
  for (int i=0; i < atts.getLength(); i++) {
    marshalRecord.attribute(atts.getURI(i),atts.getLocalName(i),atts.getQName(i),atts.getValue(i));
  }
  if (!prefixMappings.isEmpty()) {
    for (Iterator<Map.Entry<String,String>> entries=prefixMappings.entrySet().iterator(); entries.hasNext(); ) {
      Map.Entry<String,String> entry=entries.next();
      element.setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS + XMLConstants.COLON + entry.getKey(),entry.getValue());
    }
    prefixMappings.clear();
  }
  marshalRecord.closeStartElement();
}

Fixed version (ground truth):
public void startElement(String namespaceURI,String localName,String qName,Attributes atts) throws SAXException {
  Element element;
  if (namespaceURI == null) {
    element=document.createElement(qName);
  }
 else {
    element=document.createElementNS(namespaceURI,qName);
  }
  node=node.appendChild(element);
  for (int i=0; i < atts.getLength(); i++) {
    marshalRecord.attribute(atts.getURI(i),atts.getLocalName(i),atts.getQName(i),atts.getValue(i));
  }
  if (!prefixMappings.isEmpty()) {
    for (Iterator<Map.Entry<String,String>> entries=prefixMappings.entrySet().iterator(); entries.hasNext(); ) {
      Map.Entry<String,String> entry=entries.next();
      String namespaceDeclarationPrefix=entry.getKey();
      if (null == namespaceDeclarationPrefix || 0 == namespaceDeclarationPrefix.length()) {
        String namespaceDeclarationURI=entry.getValue();
        if (null == namespaceDeclarationURI) {
          element.setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS,XMLConstants.EMPTY_STRING);
        }
 else {
          element.setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS,namespaceDeclarationURI);
        }
      }
 else {
        element.setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS + XMLConstants.COLON + entry.getKey(),entry.getValue());
      }
    }
    prefixMappings.clear();
  }
  marshalRecord.closeStartElement();
}
Program: 66074
Project: 66074
Buggy source:
protected void writePrefixMappings(){
  try {
    if (!prefixMappings.isEmpty()) {
      for (java.util.Iterator<String> keys=prefixMappings.keySet().iterator(); keys.hasNext(); ) {
        String prefix=keys.next();
        outputStreamWrite(SPACE);
        outputStreamWrite(XMLConstants.XMLNS.getBytes(XMLConstants.DEFAULT_XML_ENCODING));
        if (prefix.length() > 0) {
          outputStreamWrite((byte)XMLConstants.COLON);
          outputStreamWrite(prefix.getBytes(XMLConstants.DEFAULT_XML_ENCODING));
        }
        outputStreamWrite((byte)'=');
        outputStreamWrite((byte)'"');
        outputStreamWrite(prefixMappings.get(prefix).getBytes(XMLConstants.DEFAULT_XML_ENCODING));
        outputStreamWrite(CLOSE_ATTRIBUTE_VALUE);
      }
      prefixMappings.clear();
    }
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
protected void writePrefixMappings(){
  try {
    if (!prefixMappings.isEmpty()) {
      for (java.util.Iterator<String> keys=prefixMappings.keySet().iterator(); keys.hasNext(); ) {
        String prefix=keys.next();
        outputStreamWrite(SPACE);
        outputStreamWrite(XMLConstants.XMLNS.getBytes(XMLConstants.DEFAULT_XML_ENCODING));
        if (null != prefix && prefix.length() > 0) {
          outputStreamWrite((byte)XMLConstants.COLON);
          outputStreamWrite(prefix.getBytes(XMLConstants.DEFAULT_XML_ENCODING));
        }
        outputStreamWrite((byte)'=');
        outputStreamWrite((byte)'"');
        String uri=prefixMappings.get(prefix);
        if (null != uri) {
          outputStreamWrite(prefixMappings.get(prefix).getBytes(XMLConstants.DEFAULT_XML_ENCODING));
        }
        outputStreamWrite(CLOSE_ATTRIBUTE_VALUE);
      }
      prefixMappings.clear();
    }
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66075
Project: 66075
Buggy source:
protected void writePrefixMappings(){
  try {
    if (!prefixMappings.isEmpty()) {
      for (java.util.Iterator<String> keys=prefixMappings.keySet().iterator(); keys.hasNext(); ) {
        String prefix=keys.next();
        writer.write(' ');
        writer.write(XMLConstants.XMLNS);
        if (prefix.length() > 0) {
          writer.write(XMLConstants.COLON);
          writer.write(prefix);
        }
        writer.write('=');
        writer.write('"');
        writer.write(prefixMappings.get(prefix));
        writer.write('"');
      }
      prefixMappings.clear();
    }
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
protected void writePrefixMappings(){
  try {
    if (!prefixMappings.isEmpty()) {
      for (java.util.Iterator<String> keys=prefixMappings.keySet().iterator(); keys.hasNext(); ) {
        String prefix=keys.next();
        writer.write(' ');
        writer.write(XMLConstants.XMLNS);
        if (null != prefix && prefix.length() > 0) {
          writer.write(XMLConstants.COLON);
          writer.write(prefix);
        }
        writer.write('=');
        writer.write('"');
        String uri=prefixMappings.get(prefix);
        if (null != uri) {
          writer.write(prefixMappings.get(prefix));
        }
        writer.write('"');
      }
      prefixMappings.clear();
    }
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66076
Project: 66076
Buggy source:
public void startPrefixMapping(String prefix,String uri) throws SAXException {
  if (prefix.length() == 0 && uri.length() == 0) {
    return;
  }
  if (namespaceDeclarations == null) {
    namespaceDeclarations=new HashMap();
  }
  namespaceDeclarations.put(prefix,uri);
}

Fixed version (ground truth):
public void startPrefixMapping(String prefix,String uri) throws SAXException {
  if (null == prefix) {
    prefix=XMLConstants.EMPTY_STRING;
  }
  if (null == uri) {
    uri=XMLConstants.EMPTY_STRING;
  }
  if (namespaceDeclarations == null) {
    namespaceDeclarations=new HashMap();
  }
  namespaceDeclarations.put(prefix,uri);
}
Program: 66077
Project: 66077
Buggy source:
protected Object buildObjectNoReferenceDescriptor(DOMRecord record,AbstractSession session,Node next,Object container,ContainerPolicy cp){
  XMLConverter converter=((XMLAnyCollectionMapping)this).getConverter();
  XMLPlatformFactory.getInstance().getXMLPlatform().namespaceQualifyFragment((Element)next);
  Object objectValue=next;
  if (converter != null) {
    objectValue=converter.convertDataValueToObjectValue(objectValue,session,record.getUnmarshaller());
  }
  cp.addInto(objectValue,container,session);
  return objectValue;
}

Fixed version (ground truth):
/** 
 * Convenience method that takes a given Node and applies namespace  information, converts it if necessary, and adds the resulting  object to the given ContainerPolicy if non-null. 
 */
protected Object buildObjectNoReferenceDescriptor(DOMRecord record,XMLConverter converter,AbstractSession session,Node next,Object container,ContainerPolicy cp){
  XMLPlatformFactory.getInstance().getXMLPlatform().namespaceQualifyFragment((Element)next);
  Object objectValue=next;
  if (converter != null) {
    objectValue=converter.convertDataValueToObjectValue(objectValue,session,record.getUnmarshaller());
  }
  if (cp != null) {
    cp.addInto(objectValue,container,session);
  }
  return objectValue;
}
Program: 66078
Project: 66078
Buggy source:
protected Object buildObjectAndWrapInXMLRoot(ClassDescriptor referenceDescriptor,XMLConverter converter,ObjectBuildingQuery query,DOMRecord record,DOMRecord nestedRecord,JoinedAttributeManager joinManager,AbstractSession session,Node next,Object container,ContainerPolicy containerPolicy){
  Object objectValue=null;
  ObjectBuilder builder=referenceDescriptor.getObjectBuilder();
  objectValue=builder.buildObject(query,nestedRecord,joinManager);
  Object updated=((XMLDescriptor)referenceDescriptor).wrapObjectInXMLRoot(objectValue,next.getNamespaceURI(),next.getLocalName(),next.getPrefix(),false);
  if (converter != null) {
    updated=converter.convertDataValueToObjectValue(updated,session,record.getUnmarshaller());
  }
  if (containerPolicy != null) {
    containerPolicy.addInto(updated,container,session);
  }
  return updated;
}

Fixed version (ground truth):
/** 
 * Uses a given reference descriptor to build an object based on a given DOMRecord.   If a converter is provided it is applied to the newly built object.  The  reference descriptor will wrap the object in an XMLRoot if required, and the  object will be added to the given Container Policy if it is non-null.   
 */
protected Object buildObjectAndWrapInXMLRoot(ClassDescriptor referenceDescriptor,XMLConverter converter,ObjectBuildingQuery query,DOMRecord record,DOMRecord nestedRecord,JoinedAttributeManager joinManager,AbstractSession session,Node next,Object container,ContainerPolicy containerPolicy){
  ObjectBuilder builder=referenceDescriptor.getObjectBuilder();
  Object objectValue=builder.buildObject(query,nestedRecord,joinManager);
  if (converter != null) {
    objectValue=converter.convertDataValueToObjectValue(objectValue,session,record.getUnmarshaller());
  }
  Object updated=((XMLDescriptor)referenceDescriptor).wrapObjectInXMLRoot(objectValue,next.getNamespaceURI(),next.getLocalName(),next.getPrefix(),false);
  if (containerPolicy != null) {
    containerPolicy.addInto(updated,container,session);
  }
  return updated;
}
Program: 66084
Project: 66084
Buggy source:
/** 
 * INTERNAL:
 */
public void attribute(String namespaceURI,String localName,String qName,String value){
  if (namespaceURI == XMLConstants.XMLNS_URL) {
    this.startPrefixMapping(localName,value);
  }
  attributes.addAttribute(namespaceURI,localName,qName,XMLConstants.CDATA,value);
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void attribute(String namespaceURI,String localName,String qName,String value){
  if (namespaceURI == XMLConstants.XMLNS_URL) {
    if (localName == XMLConstants.XMLNS) {
      localName="String_Node_Str";
    }
    this.startPrefixMapping(localName,value);
  }
  attributes.addAttribute(namespaceURI,localName,qName,XMLConstants.CDATA,value);
}
Program: 66085
Project: 66085
Buggy source:
/** 
 * Marshal any 'self' mapped attributes.
 * @param xPathFragment
 * @param marshalRecord
 * @param object
 * @param session
 * @param namespaceResolver
 * @param marshaller
 * @return
 */
public boolean marshalSelfAttributes(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver,XMLMarshaller marshaller){
  Object objectValue=xmlCompositeObjectMapping.getAttributeValueFromObject(object);
  if (xmlCompositeObjectMapping.getConverter() != null) {
    Converter converter=xmlCompositeObjectMapping.getConverter();
    if (converter instanceof XMLConverter) {
      objectValue=((XMLConverter)converter).convertObjectValueToDataValue(objectValue,session,marshaller);
    }
 else {
      objectValue=converter.convertObjectValueToDataValue(objectValue,session);
    }
  }
  XMLDescriptor descriptor=(XMLDescriptor)session.getDescriptor(objectValue);
  if (descriptor != null) {
    TreeObjectBuilder objectBuilder=(TreeObjectBuilder)descriptor.getObjectBuilder();
    return objectBuilder.marshalAttributes(marshalRecord,objectValue,session);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Marshal any 'self' mapped attributes.
 * @param xPathFragment
 * @param marshalRecord
 * @param object
 * @param session
 * @param namespaceResolver
 * @param marshaller
 * @return
 */
public boolean marshalSelfAttributes(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,AbstractSession session,NamespaceResolver namespaceResolver,XMLMarshaller marshaller){
  Object objectValue=xmlCompositeObjectMapping.getAttributeValueFromObject(object);
  if (xmlCompositeObjectMapping.getConverter() != null) {
    Converter converter=xmlCompositeObjectMapping.getConverter();
    if (converter instanceof XMLConverter) {
      objectValue=((XMLConverter)converter).convertObjectValueToDataValue(objectValue,session,marshaller);
    }
 else {
      objectValue=converter.convertObjectValueToDataValue(objectValue,session);
    }
  }
  XMLDescriptor descriptor=(XMLDescriptor)session.getDescriptor(objectValue);
  if (descriptor != null) {
    TreeObjectBuilder objectBuilder=(TreeObjectBuilder)descriptor.getObjectBuilder();
    return objectBuilder.marshalAttributes(marshalRecord,objectValue,session);
  }
 else {
    if (this.getMapping().getKeepAsElementPolicy() == UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT || this.getMapping().getKeepAsElementPolicy() == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) {
      if (objectValue instanceof Node) {
        Node rootNode=(Node)objectValue;
        NamedNodeMap attributes=rootNode.getAttributes();
        for (int i=0; i < attributes.getLength(); i++) {
          Attr next=(Attr)attributes.item(i);
          if (!(XMLConstants.XMLNS_URL.equals(next.getNamespaceURI()))) {
            marshalRecord.node(next,namespaceResolver);
          }
        }
      }
    }
  }
  return false;
}
Program: 66086
Project: 66086
Buggy source:
protected IndexedAttributeList buildAttributeList(Element elem) throws SAXException {
  IndexedAttributeList attributes=new IndexedAttributeList();
  NamedNodeMap attrs=elem.getAttributes();
  for (int i=0, length=attrs.getLength(); i < length; i++) {
    Attr next=(Attr)attrs.item(i);
    String attrPrefix=next.getPrefix();
    if (attrPrefix != null && attrPrefix.equals(XMLConstants.XMLNS)) {
      contentHandler.startPrefixMapping(next.getLocalName(),next.getValue());
      handleXMLNSPrefixedAttribute(elem,next);
    }
 else     if (attrPrefix == null) {
      String name=next.getLocalName();
      if (name == null) {
        name=next.getNodeName();
      }
      if (name != null && name.equals(XMLConstants.XMLNS)) {
        contentHandler.startPrefixMapping(XMLConstants.EMPTY_STRING,next.getValue());
      }
    }
    attributes.addAttribute(next);
  }
  return attributes;
}

Fixed version (ground truth):
protected IndexedAttributeList buildAttributeList(Element elem) throws SAXException {
  IndexedAttributeList attributes=new IndexedAttributeList();
  NamedNodeMap attrs=elem.getAttributes();
  for (int i=0, length=attrs.getLength(); i < length; i++) {
    Attr next=(Attr)attrs.item(i);
    String attrPrefix=next.getPrefix();
    if (attrPrefix != null && attrPrefix.equals(XMLConstants.XMLNS)) {
      contentHandler.startPrefixMapping(next.getLocalName(),next.getValue());
      handleXMLNSPrefixedAttribute(elem,next);
    }
 else     if (attrPrefix == null) {
      String name=next.getLocalName();
      if (name == null) {
        name=next.getNodeName();
      }
      if (name != null && name.equals(XMLConstants.XMLNS)) {
        contentHandler.startPrefixMapping(XMLConstants.EMPTY_STRING,next.getValue());
      }
    }
    if (next.getNamespaceURI() != null && next.getNamespaceURI().equals(XMLConstants.SCHEMA_INSTANCE_URL) && next.getLocalName().equals("String_Node_Str")) {
      handleXsiTypeAttribute(next);
    }
    attributes.addAttribute(next);
  }
  return attributes;
}