nus-yam/ex-repair huggingface dataset:
Program: 67436
Project: 67436
Buggy source:
protected void endElementProcessText(UnmarshalRecord unmarshalRecord,Converter converter,XPathFragment xPathFragment,Object collection){
  Object value=unmarshalRecord.getStringBuffer().toString().trim();
  if (converter != null) {
    if (converter instanceof XMLConverter) {
      value=((XMLConverter)converter).convertDataValueToObjectValue(value,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
    }
 else {
      value=converter.convertDataValueToObjectValue(value,unmarshalRecord.getSession());
    }
  }
  unmarshalRecord.resetStringBuffer();
  if (!EMPTY_STRING.equals(value)) {
    QName qname=unmarshalRecord.getTypeQName();
    if (qname != null) {
      Class theClass=(Class)XMLConversionManager.getDefaultXMLTypes().get(qname);
      if (theClass != null) {
        value=((XMLConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager()).convertObject(value,theClass,qname);
      }
    }
    setOrAddAttributeValue(unmarshalRecord,value,xPathFragment,collection);
  }
}

Fixed version (ground truth):
protected void endElementProcessText(UnmarshalRecord unmarshalRecord,Converter converter,XPathFragment xPathFragment,Object collection){
  Object value=unmarshalRecord.getStringBuffer().toString();
  if (converter != null) {
    if (converter instanceof XMLConverter) {
      value=((XMLConverter)converter).convertDataValueToObjectValue(value,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
    }
 else {
      value=converter.convertDataValueToObjectValue(value,unmarshalRecord.getSession());
    }
  }
  unmarshalRecord.resetStringBuffer();
  if (!EMPTY_STRING.equals(value)) {
    QName qname=unmarshalRecord.getTypeQName();
    if (qname != null) {
      Class theClass=(Class)XMLConversionManager.getDefaultXMLTypes().get(qname);
      if (theClass != null) {
        value=((XMLConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager()).convertObject(value,theClass,qname);
      }
    }
    setOrAddAttributeValue(unmarshalRecord,value,xPathFragment,collection);
  }
}
Program: 67437
Project: 67437
Buggy source:
public void characters(char[] ch,int start,int length) throws SAXException {
  try {
    if (null != selfRecords) {
      int selfRecordsSize=selfRecords.size();
      for (int x=0; x < selfRecordsSize; x++) {
        UnmarshalRecord selfRecord=((UnmarshalRecord)selfRecords.get(x));
        if (selfRecord != null) {
          selfRecord.characters(ch,start,length);
        }
      }
    }
    XPathNode textNode=null;
    if (null != xPathNode.getNonAttributeChildrenMap()) {
      textNode=(XPathNode)xPathNode.getNonAttributeChildrenMap().get(XPathFragment.TEXT_FRAGMENT);
      if (null == textNode) {
        textNode=(XPathNode)xPathNode.getNonAttributeChildrenMap().get(XPathFragment.ANY_FRAGMENT);
        if (textNode != null) {
          if (0 == length) {
            return;
          }
          String tmpString=new String(ch,start,length);
          if (EMPTY_STRING.equals(tmpString.trim())) {
            return;
          }
        }
      }
    }
    if (null != textNode) {
      xPathNode=textNode;
      unmarshalContext.characters(this);
    }
    if (null != xPathNode.getUnmarshalNodeValue()) {
      stringBuffer.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) {
      int selfRecordsSize=selfRecords.size();
      for (int x=0; x < selfRecordsSize; x++) {
        UnmarshalRecord selfRecord=((UnmarshalRecord)selfRecords.get(x));
        if (selfRecord != null) {
          selfRecord.characters(ch,start,length);
        }
      }
    }
    XPathNode textNode=null;
    if (null != xPathNode.getNonAttributeChildrenMap()) {
      textNode=(XPathNode)xPathNode.getNonAttributeChildrenMap().get(XPathFragment.TEXT_FRAGMENT);
      if (null == textNode) {
        textNode=(XPathNode)xPathNode.getNonAttributeChildrenMap().get(XPathFragment.ANY_FRAGMENT);
        if (textNode != null) {
          if (0 == length) {
            return;
          }
          String tmpString=new String(ch,start,length);
          if (EMPTY_STRING.equals(tmpString.trim()) && !textNode.isWhitespaceAware()) {
            return;
          }
        }
      }
    }
    if (null != textNode) {
      xPathNode=textNode;
      unmarshalContext.characters(this);
    }
    if (null != xPathNode.getUnmarshalNodeValue()) {
      stringBuffer.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: 67442
Project: 67442
Buggy source:
public XMLAnyCollectionMapping generateAnyCollectionMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  AnyProperty prop=(AnyProperty)property;
  XMLAnyCollectionMapping mapping=new XMLAnyCollectionMapping();
  mapping.setAttributeName(property.getPropertyName());
  if (property.isMethodProperty()) {
    mapping.setSetMethodName(property.getSetMethodName());
    mapping.setGetMethodName(property.getGetMethodName());
    if (property.getGetMethodName() == null) {
      mapping.setIsReadOnly(true);
    }
 else     if (property.getSetMethodName() == null) {
      mapping.setIsWriteOnly(true);
    }
  }
  mapping.setUseXMLRoot(true);
  mapping.setAttributeAccessor(new JAXBElementAttributeAccessor(mapping.getAttributeAccessor(),mapping.getContainerPolicy()));
  if (prop.isLax()) {
    mapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT);
  }
 else {
    mapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT);
  }
  if (prop.getDomHandlerClass() != null) {
    DomHandlerConverter converter=new DomHandlerConverter(prop.getDomHandlerClass());
    mapping.setConverter(converter);
  }
  descriptor.addMapping(mapping);
  return mapping;
}

Fixed version (ground truth):
public XMLAnyCollectionMapping generateAnyCollectionMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo,boolean isMixed){
  boolean isLax=false;
  Class domHandlerClass=null;
  if (property instanceof AnyProperty) {
    AnyProperty prop=(AnyProperty)property;
    isLax=prop.isLax();
    domHandlerClass=prop.getDomHandlerClass();
  }
  XMLAnyCollectionMapping mapping=new XMLAnyCollectionMapping();
  mapping.setAttributeName(property.getPropertyName());
  if (property.isMethodProperty()) {
    mapping.setSetMethodName(property.getSetMethodName());
    mapping.setGetMethodName(property.getGetMethodName());
    if (property.getGetMethodName() == null) {
      mapping.setIsReadOnly(true);
    }
 else     if (property.getSetMethodName() == null) {
      mapping.setIsWriteOnly(true);
    }
  }
  if (!isMixed) {
    mapping.setUseXMLRoot(true);
  }
  mapping.setAttributeAccessor(new JAXBElementAttributeAccessor(mapping.getAttributeAccessor(),mapping.getContainerPolicy()));
  if (isLax) {
    mapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT);
  }
 else {
    mapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT);
  }
  if (domHandlerClass != null) {
    DomHandlerConverter converter=new DomHandlerConverter(domHandlerClass);
    mapping.setConverter(converter);
  }
  descriptor.addMapping(mapping);
  mapping.setMixedContent(isMixed);
  if (isMixed) {
    mapping.setPreserveWhitespaceForMixedContent(true);
  }
  return mapping;
}
Program: 67443
Project: 67443
Buggy source:
public void generateAnyObjectMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  XMLAnyObjectMapping mapping=new XMLAnyObjectMapping();
  mapping.setAttributeName(property.getPropertyName());
  if (property.isMethodProperty()) {
    mapping.setSetMethodName(property.getSetMethodName());
    mapping.setGetMethodName(property.getGetMethodName());
    if (property.getGetMethodName() == null) {
      mapping.setIsReadOnly(true);
    }
 else     if (property.getSetMethodName() == null) {
      mapping.setIsWriteOnly(true);
    }
  }
  if (property.getType().getQualifiedName().equals("String_Node_Str")) {
    mapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT);
  }
 else {
    mapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT);
  }
  mapping.setUseXMLRoot(true);
  mapping.setAttributeAccessor(new JAXBElementAttributeAccessor(mapping.getAttributeAccessor()));
  descriptor.addMapping(mapping);
}

Fixed version (ground truth):
public void generateAnyObjectMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  XMLAnyObjectMapping mapping=new XMLAnyObjectMapping();
  mapping.setAttributeName(property.getPropertyName());
  mapping.setMixedContent(false);
  if (property.isMethodProperty()) {
    mapping.setSetMethodName(property.getSetMethodName());
    mapping.setGetMethodName(property.getGetMethodName());
    if (property.getGetMethodName() == null) {
      mapping.setIsReadOnly(true);
    }
 else     if (property.getSetMethodName() == null) {
      mapping.setIsWriteOnly(true);
    }
  }
  if (property.getType().getQualifiedName().equals("String_Node_Str")) {
    mapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT);
  }
 else {
    mapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT);
  }
  mapping.setUseXMLRoot(true);
  mapping.setAttributeAccessor(new JAXBElementAttributeAccessor(mapping.getAttributeAccessor()));
  descriptor.addMapping(mapping);
}
Program: 67444
Project: 67444
Buggy source:
public XMLCompositeDirectCollectionMapping generateDirectCollectionMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  XMLCompositeDirectCollectionMapping mapping=new XMLCompositeDirectCollectionMapping();
  mapping.setAttributeName(property.getPropertyName());
  if (property.isMethodProperty()) {
    mapping.setSetMethodName(property.getSetMethodName());
    mapping.setGetMethodName(property.getGetMethodName());
    if (property.getGetMethodName() == null) {
      mapping.setIsReadOnly(true);
    }
 else     if (property.getSetMethodName() == null) {
      mapping.setIsWriteOnly(true);
    }
  }
  JavaClass collectionType=property.getType();
  if (areEquals(collectionType,Collection.class) || areEquals(collectionType,List.class)) {
    collectionType=jotArrayList;
  }
 else   if (areEquals(collectionType,Set.class)) {
    collectionType=jotHashSet;
  }
  mapping.useCollectionClassName(collectionType.getRawName());
  XMLField xmlField=getXPathForField(property,namespaceInfo,true);
  mapping.setField(xmlField);
  if (XMLConstants.QNAME_QNAME.equals(property.getSchemaType())) {
    ((XMLField)mapping.getField()).setSchemaType(XMLConstants.QNAME_QNAME);
  }
  if (xmlField.getXPathFragment().isAttribute()) {
    mapping.setUsesSingleNode(true);
  }
  if (helper.isAnnotationPresent(property.getElement(),XmlList.class)) {
    mapping.setUsesSingleNode(true);
  }
  descriptor.addMapping(mapping);
  return mapping;
}

Fixed version (ground truth):
public XMLCompositeDirectCollectionMapping generateDirectCollectionMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  XMLCompositeDirectCollectionMapping mapping=new XMLCompositeDirectCollectionMapping();
  mapping.setAttributeName(property.getPropertyName());
  if (property.isMethodProperty()) {
    mapping.setSetMethodName(property.getSetMethodName());
    mapping.setGetMethodName(property.getGetMethodName());
    if (property.getGetMethodName() == null) {
      mapping.setIsReadOnly(true);
    }
 else     if (property.getSetMethodName() == null) {
      mapping.setIsWriteOnly(true);
    }
  }
  JavaClass collectionType=property.getType();
  if (areEquals(collectionType,Collection.class) || areEquals(collectionType,List.class)) {
    collectionType=jotArrayList;
  }
 else   if (areEquals(collectionType,Set.class)) {
    collectionType=jotHashSet;
  }
  mapping.useCollectionClassName(collectionType.getRawName());
  XMLField xmlField=getXPathForField(property,namespaceInfo,true);
  mapping.setField(xmlField);
  if (helper.isAnnotationPresent(property.getElement(),XmlMixed.class)) {
    xmlField.setXPath("String_Node_Str");
  }
  if (XMLConstants.QNAME_QNAME.equals(property.getSchemaType())) {
    ((XMLField)mapping.getField()).setSchemaType(XMLConstants.QNAME_QNAME);
  }
  if (xmlField.getXPathFragment().isAttribute()) {
    mapping.setUsesSingleNode(true);
  }
  if (helper.isAnnotationPresent(property.getElement(),XmlList.class)) {
    mapping.setUsesSingleNode(true);
  }
  descriptor.addMapping(mapping);
  return mapping;
}
Program: 67445
Project: 67445
Buggy source:
/** 
 * Updates the object associated with the provided node to reflect any changed made to that node. If this Binder has no object associated with the given node, then no operation is performed.
 * @param node
 */
public void updateObject(org.w3c.dom.Node node){
  Object cachedObject=documentPreservationPolicy.getObjectForNode(node);
  if (cachedObject != null) {
    unmarshal(node);
  }
}

Fixed version (ground truth):
/** 
 * Updates the object associated with the provided node to reflect any changed made to that node. If this Binder has no object associated with the given node, then no operation is performed.
 * @param node
 */
public void updateObject(org.w3c.dom.Node node){
  if (node.getNodeType() == Node.DOCUMENT_NODE) {
    node=((Document)node).getDocumentElement();
  }
  Object cachedObject=documentPreservationPolicy.getObjectForNode(node);
  if (cachedObject != null) {
    unmarshal(node);
  }
 else {
    throw XMLMarshalException.objectNotFoundInCache(node.getNodeName());
  }
}
Program: 67446
Project: 67446
Buggy source:
public void updateXML(Object obj,Node associatedNode){
  if (obj instanceof XMLRoot) {
    obj=((XMLRoot)obj).getObject();
  }
  AbstractSession session=context.getSession(obj);
  DOMRecord root=new DOMRecord((Element)associatedNode);
  root.setDocPresPolicy(this.documentPreservationPolicy);
  XMLDescriptor rootDescriptor=(XMLDescriptor)session.getDescriptor(obj);
  ((XMLObjectBuilder)rootDescriptor.getObjectBuilder()).buildIntoNestedRow(root,obj,session);
}

Fixed version (ground truth):
public void updateXML(Object obj,Node associatedNode){
  if (obj instanceof XMLRoot) {
    obj=((XMLRoot)obj).getObject();
  }
  Node objNode=this.getXMLNode(obj);
  AbstractSession session=context.getSession(obj);
  if (objNode == associatedNode) {
    DOMRecord root=new DOMRecord((Element)associatedNode);
    root.setDocPresPolicy(this.documentPreservationPolicy);
    XMLDescriptor rootDescriptor=(XMLDescriptor)session.getDescriptor(obj);
    ((XMLObjectBuilder)rootDescriptor.getObjectBuilder()).buildIntoNestedRow(root,obj,session);
  }
}
Program: 67448
Project: 67448
Buggy source:
public JAXBElement getJAXBNode(Object obj){
  if (null == obj) {
    throw new IllegalArgumentException();
  }
  Element elem=(Element)xmlBinder.getXMLNode(obj);
  if (null == elem) {
    return null;
  }
  return new JAXBElement(new QName(elem.getNamespaceURI(),elem.getLocalName()),obj.getClass(),obj);
}

Fixed version (ground truth):
public Object getJAXBNode(Object obj){
  if (null == obj) {
    throw new IllegalArgumentException();
  }
  return xmlBinder.getObject((Node)obj);
}
Program: 67449
Project: 67449
Buggy source:
public Object getXMLNode(Object obj){
  return xmlBinder.getXMLNode(obj);
}

Fixed version (ground truth):
public Object getXMLNode(Object obj){
  if (null == obj) {
    throw new IllegalArgumentException();
  }
  return xmlBinder.getXMLNode(obj);
}
Program: 67450
Project: 67450
Buggy source:
public JAXBElement unmarshal(Object obj,Class javaClass) throws JAXBException {
  if (null == obj || null == javaClass) {
    throw new IllegalArgumentException();
  }
  if (!(obj instanceof Node)) {
    return null;
  }
  try {
    XMLRoot xmlRoot=(XMLRoot)xmlBinder.unmarshal((Node)obj,javaClass);
    return new JAXBElement(new QName(xmlRoot.getNamespaceURI(),xmlRoot.getLocalName()),javaClass,xmlRoot.getObject());
  }
 catch (  Exception e) {
    throw new UnmarshalException(e);
  }
}

Fixed version (ground truth):
public JAXBElement unmarshal(Object obj,Class javaClass) throws JAXBException {
  if (null == obj || null == javaClass) {
    throw new IllegalArgumentException();
  }
  try {
    XMLRoot xmlRoot=(XMLRoot)xmlBinder.unmarshal((Node)obj,javaClass);
    return new JAXBElement(new QName(xmlRoot.getNamespaceURI(),xmlRoot.getLocalName()),javaClass,xmlRoot.getObject());
  }
 catch (  Exception e) {
    throw new UnmarshalException(e);
  }
}
Program: 67451
Project: 67451
Buggy source:
public void marshal(Object obj,Object xmlNode) throws MarshalException {
  if (null == obj || null == xmlNode) {
    throw new IllegalArgumentException();
  }
  if (!(xmlNode instanceof Node)) {
    return;
  }
  try {
    if (obj instanceof JAXBElement) {
      JAXBElement jaxbElem=(JAXBElement)obj;
      XMLRoot xmlRoot=new XMLRoot();
      xmlRoot.setObject(jaxbElem.getValue());
      xmlRoot.setLocalName(jaxbElem.getName().getLocalPart());
      xmlRoot.setNamespaceURI(jaxbElem.getName().getNamespaceURI());
      xmlBinder.marshal(xmlRoot,(Node)xmlNode);
    }
 else {
      xmlBinder.marshal(obj,(Node)xmlNode);
    }
  }
 catch (  Exception e) {
    throw new MarshalException(e);
  }
}

Fixed version (ground truth):
public void marshal(Object obj,Object xmlNode) throws MarshalException {
  if (null == obj || null == xmlNode) {
    throw new IllegalArgumentException();
  }
  try {
    if (obj instanceof JAXBElement) {
      JAXBElement jaxbElem=(JAXBElement)obj;
      XMLRoot xmlRoot=new XMLRoot();
      xmlRoot.setObject(jaxbElem.getValue());
      xmlRoot.setLocalName(jaxbElem.getName().getLocalPart());
      xmlRoot.setNamespaceURI(jaxbElem.getName().getNamespaceURI());
      xmlBinder.marshal(xmlRoot,(Node)xmlNode);
    }
 else {
      xmlBinder.marshal(obj,(Node)xmlNode);
    }
  }
 catch (  Exception e) {
    throw new MarshalException(e);
  }
}
Program: 67452
Project: 67452
Buggy source:
public Object updateJAXB(Object obj){
  if (null == obj) {
    throw new IllegalArgumentException();
  }
  if (!(obj instanceof Node)) {
    return null;
  }
  xmlBinder.updateObject((Node)obj);
  return xmlBinder.getObject((Node)obj);
}

Fixed version (ground truth):
public Object updateJAXB(Object obj) throws JAXBException {
  if (null == obj) {
    throw new IllegalArgumentException();
  }
  try {
    xmlBinder.updateObject((Node)obj);
    Object updatedObj=xmlBinder.getObject((Node)obj);
    boolean shouldWrapInJAXBElement=true;
    XMLDescriptor desc=(XMLDescriptor)xmlBinder.getMarshaller().getXMLContext().getSession(0).getClassDescriptor(updatedObj);
    if (desc == null) {
      return updatedObj;
    }
    String objRootElem=desc.getDefaultRootElement();
    if (!desc.isResultAlwaysXMLRoot()) {
      if (objRootElem != null) {
        String rootElemNS=objRootElem.substring(0,objRootElem.lastIndexOf("String_Node_Str"));
        String rootElemName=objRootElem.substring(objRootElem.lastIndexOf("String_Node_Str") + 1);
        String resolvedNS=desc.getNamespaceResolver().resolveNamespacePrefix(rootElemNS);
        String nodeName=((Node)obj).getLocalName();
        String nodeNS=((Node)obj).getNamespaceURI();
        if (rootElemName.equals(nodeName) && resolvedNS.equals(nodeNS)) {
          shouldWrapInJAXBElement=false;
        }
      }
    }
    if (!shouldWrapInJAXBElement) {
      return updatedObj;
    }
 else {
      QName qname=new QName(((Node)obj).getNamespaceURI(),((Node)obj).getLocalName());
      return new JAXBElement(qname,updatedObj.getClass(),updatedObj);
    }
  }
 catch (  Exception e) {
    throw new JAXBException(e);
  }
}
Program: 67453
Project: 67453
Buggy source:
public Object updateXML(Object obj,Object xmlNode){
  if (!(xmlNode instanceof Node)) {
    return null;
  }
 else {
    xmlBinder.updateXML(obj,((Element)xmlNode));
    return xmlNode;
  }
}

Fixed version (ground truth):
public Object updateXML(Object obj,Object xmlNode){
  if (null == obj || null == xmlNode) {
    throw new IllegalArgumentException();
  }
  if (obj instanceof JAXBElement) {
    obj=((JAXBElement)obj).getValue();
  }
  xmlBinder.updateXML(obj,((Element)xmlNode));
  return xmlNode;
}
Program: 67454
Project: 67454
Buggy source:
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTestSuite(SchemaGenEmployeeTestCases.class);
  suite.addTestSuite(SchemaGenXMLTypeTestCases.class);
  suite.addTestSuite(SchemaGenXMLRootElementTestCases.class);
  suite.addTestSuite(DeploymentXMLSchemaGenTestCases.class);
  suite.addTestSuite(SchemaGenXmlElementWrapperTestCases.class);
  suite.addTestSuite(SchemaGenXmlElementRefTestCases.class);
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTestSuite(SchemaGenEmployeeTestCases.class);
  suite.addTestSuite(SchemaGenXMLTypeTestCases.class);
  suite.addTestSuite(SchemaGenXMLRootElementTestCases.class);
  suite.addTestSuite(DeploymentXMLSchemaGenTestCases.class);
  suite.addTestSuite(SchemaGenXmlElementWrapperTestCases.class);
  suite.addTestSuite(SchemaGenXmlElementRefTestCases.class);
  suite.addTestSuite(SchemaGenXmlListTestCases.class);
  suite.addTestSuite(SchemaGenXmlIDTestCases.class);
  return suite;
}
Program: 67458
Project: 67458
Buggy source:
public int compile(String classpath,Object[] javaFiles){
  String[] args=new String[javaFiles.length + 3];
  args[0]="String_Node_Str";
  args[1]="String_Node_Str";
  args[2]=classpath;
  System.arraycopy(javaFiles,0,args,3,javaFiles.length);
  int exitVal=-1;
  try {
    Process proc=Runtime.getRuntime().exec(args);
    InputStream stderr=proc.getErrorStream();
    InputStreamReader isr=new InputStreamReader(stderr);
    BufferedReader br=new BufferedReader(isr);
    String line=null;
    System.out.println("String_Node_Str");
    while ((line=br.readLine()) != null)     System.out.println(line);
    System.out.println("String_Node_Str");
    exitVal=proc.waitFor();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return exitVal;
}

Fixed version (ground truth):
public int compile(String classpath,Object[] javaFiles){
  String[] args=new String[javaFiles.length + 3];
  args[0]="String_Node_Str";
  args[1]="String_Node_Str";
  args[2]=classpath;
  System.arraycopy(javaFiles,0,args,3,javaFiles.length);
  int exitVal=-1;
  try {
    Process proc=Runtime.getRuntime().exec(args);
    InputStream stderr=proc.getErrorStream();
    InputStreamReader isr=new InputStreamReader(stderr);
    BufferedReader br=new BufferedReader(isr);
    String line=br.readLine();
    if (line != null) {
      System.out.println("String_Node_Str");
      while (line != null) {
        System.out.println(line);
        if ((line=br.readLine()) == null) {
          System.out.println("String_Node_Str");
        }
      }
    }
    exitVal=proc.waitFor();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return exitVal;
}
Program: 67460
Project: 67460
Buggy source:
private boolean addImportIfRequired(Schema sourceSchema,Schema importSchema,String importNamespace){
  if (importSchema != sourceSchema) {
    String schemaName=null;
    if (importSchema != null) {
      schemaName=importSchema.getName();
    }
 else     if (importNamespace != null) {
      NamespaceInfo nInfo=getNamespaceInfoForNamespace(importNamespace);
      schemaName=nInfo.getLocation();
    }
    if (schemaName != null && !importExists(sourceSchema,schemaName)) {
      Import schemaImport=new Import();
      schemaImport.setSchemaLocation(schemaName);
      schemaImport.setNamespace(importNamespace);
      sourceSchema.getImports().add(schemaImport);
      if (schemaImport.getNamespace() != null) {
        String prefix=sourceSchema.getNamespaceResolver().resolveNamespaceURI(importNamespace);
        if (prefix == null && !importNamespace.equals("String_Node_Str")) {
          sourceSchema.getNamespaceResolver().put(sourceSchema.getNamespaceResolver().generatePrefix(),importNamespace);
        }
      }
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean addImportIfRequired(Schema sourceSchema,Schema importSchema,String importNamespace){
  if (importSchema != sourceSchema) {
    String schemaName=null;
    if (importSchema != null) {
      schemaName=importSchema.getName();
    }
 else     if (importNamespace != null) {
      NamespaceInfo nInfo=getNamespaceInfoForNamespace(importNamespace);
      schemaName=nInfo.getLocation();
    }
    if (schemaName != null && !importExists(sourceSchema,schemaName)) {
      Import schemaImport=new Import();
      schemaImport.setSchemaLocation(schemaName);
      if (importNamespace != null && !importNamespace.equals("String_Node_Str")) {
        schemaImport.setNamespace(importNamespace);
      }
      sourceSchema.getImports().add(schemaImport);
      if (schemaImport.getNamespace() != null) {
        String prefix=sourceSchema.getNamespaceResolver().resolveNamespaceURI(importNamespace);
        if (prefix == null && !importNamespace.equals("String_Node_Str")) {
          sourceSchema.getNamespaceResolver().put(sourceSchema.getNamespaceResolver().generatePrefix(),importNamespace);
        }
      }
      return true;
    }
  }
  return false;
}
Program: 67461
Project: 67461
Buggy source:
/** 
 * Process a given XMLCompositeDirectCollectionMapping.
 * @param mapping
 * @param seq
 * @param ct
 * @param workingSchema
 */
protected void processXMLCompositeDirectCollectionMapping(XMLCompositeDirectCollectionMapping mapping,Sequence seq,ComplexType ct,HashMap<String,Schema> schemaForNamespace,Schema workingSchema,SchemaModelGeneratorProperties properties){
  XMLField field=((XMLField)(mapping).getField());
  XPathFragment frag=field.getXPathFragment();
  seq=buildSchemaComponentsForXPath(frag,seq,schemaForNamespace,workingSchema,properties);
  frag=getTargetXPathFragment(frag);
  String schemaTypeString=getSchemaTypeForElement(field,mapping.getAttributeElementClass(),workingSchema);
  Element element;
  if (field.usesSingleNode()) {
    SimpleType st=new SimpleType();
    org.eclipse.persistence.internal.oxm.schema.model.List list=new org.eclipse.persistence.internal.oxm.schema.model.List();
    if (schemaTypeString == null) {
      schemaTypeString=getSchemaTypeString(XMLConstants.ANY_SIMPLE_TYPE_QNAME,workingSchema);
    }
    list.setItemType(schemaTypeString);
    st.setList(list);
    element=buildElement(field.getXPathFragment(),null,Occurs.ZERO,null);
    element.setSimpleType(st);
  }
 else {
    element=buildElement(field.getXPathFragment(),schemaTypeString,Occurs.ZERO,null);
    element.setMaxOccurs(Occurs.UNBOUNDED);
  }
  seq.addElement(element);
}

Fixed version (ground truth):
/** 
 * Process a given XMLCompositeDirectCollectionMapping.
 * @param mapping
 * @param seq
 * @param ct
 * @param workingSchema
 */
protected void processXMLCompositeDirectCollectionMapping(XMLCompositeDirectCollectionMapping mapping,Sequence seq,ComplexType ct,HashMap<String,Schema> schemaForNamespace,Schema workingSchema,SchemaModelGeneratorProperties properties){
  XMLField field=((XMLField)(mapping).getField());
  XPathFragment frag=field.getXPathFragment();
  seq=buildSchemaComponentsForXPath(frag,seq,schemaForNamespace,workingSchema,properties);
  frag=getTargetXPathFragment(frag);
  String schemaTypeString=getSchemaTypeForElement(field,mapping.getAttributeElementClass(),workingSchema);
  Element element=null;
  if (field.usesSingleNode()) {
    SimpleType st=new SimpleType();
    org.eclipse.persistence.internal.oxm.schema.model.List list=new org.eclipse.persistence.internal.oxm.schema.model.List();
    if (schemaTypeString == null) {
      schemaTypeString=getSchemaTypeString(XMLConstants.ANY_SIMPLE_TYPE_QNAME,workingSchema);
    }
    list.setItemType(schemaTypeString);
    st.setList(list);
    element=buildElement(field.getXPathFragment(),null,Occurs.ZERO,null);
    element.setSimpleType(st);
  }
 else {
    if (frag.getNamespaceURI() != null) {
      element=handleFragNamespace(frag,schemaForNamespace,workingSchema,properties,element,schemaTypeString);
      element.setMaxOccurs(Occurs.UNBOUNDED);
    }
 else {
      element=buildElement(frag,schemaTypeString,Occurs.ZERO,Occurs.UNBOUNDED);
    }
  }
  seq.addElement(element);
}
Program: 67463
Project: 67463
Buggy source:
public void setSchema(Schema aSchema){
  this.unmarshaller.setSchema(aSchema);
}

Fixed version (ground truth):
public void setSchema(Schema aSchema){
  this.unmarshaller.setSchema(aSchema);
  this.saxUnmarshaller.setSchema(aSchema);
}
Program: 67464
Project: 67464
Buggy source:
public XMLRoot unmarshal(org.w3c.dom.Node node,Class javaClass){
  XMLRoot root=null;
  reader.setDocPresPolicy(documentPreservationPolicy);
  root=(XMLRoot)saxUnmarshaller.unmarshal(reader,node,javaClass);
  return root;
}

Fixed version (ground truth):
public XMLRoot unmarshal(org.w3c.dom.Node node,Class javaClass){
  if (getSchema() != null) {
    Validator validator=getSchema().newValidator();
    validator.setErrorHandler(getErrorHandler());
    try {
      validator.validate(new DOMSource(node));
    }
 catch (    Exception e) {
      throw XMLMarshalException.validateException(e);
    }
  }
  XMLRoot root=null;
  reader.setDocPresPolicy(documentPreservationPolicy);
  root=(XMLRoot)saxUnmarshaller.unmarshal(reader,node,javaClass);
  return root;
}
Program: 67466
Project: 67466
Buggy source:
public void generateSchema(SchemaOutputResolver outputResolver){
  if (generator == null) {
    List<XMLDescriptor> descriptorsToProcess=new ArrayList<XMLDescriptor>();
    List<Session> sessions=xmlContext.getSessions();
    for (    Session session : sessions) {
      Vector<XMLDescriptor> descriptors=session.getProject().getOrderedDescriptors();
      for (      XMLDescriptor xDesc : descriptors) {
        descriptorsToProcess.add(xDesc);
      }
    }
    SchemaModelGenerator smGen=new SchemaModelGenerator();
    smGen.generateSchemas(descriptorsToProcess,null,outputResolver);
  }
 else {
    generator.generateSchemaFiles(outputResolver,null);
  }
}

Fixed version (ground truth):
public void generateSchema(SchemaOutputResolver outputResolver){
  if (generator == null) {
    List<XMLDescriptor> descriptorsToProcess=new ArrayList<XMLDescriptor>();
    List<Session> sessions=xmlContext.getSessions();
    for (    Session session : sessions) {
      Vector<XMLDescriptor> descriptors=session.getProject().getOrderedDescriptors();
      for (      XMLDescriptor xDesc : descriptors) {
        descriptorsToProcess.add(xDesc);
      }
    }
    SchemaModelGenerator smGen=new SchemaModelGenerator();
    smGen.generateSchemas(descriptorsToProcess,null,new JAXBSchemaOutputResolver(outputResolver));
  }
 else {
    generator.generateSchemaFiles(outputResolver,null);
  }
}
Program: 67469
Project: 67469
Buggy source:
public QName getSchemaTypeFor(JavaClass javaClass){
  if (javaClass == null) {
    return null;
  }
  QName schemaType=(QName)userDefinedSchemaTypes.get(javaClass.getQualifiedName());
  if (schemaType == null) {
    schemaType=(QName)helper.getXMLToJavaTypeMap().get(javaClass.getRawName());
  }
  if (schemaType == null) {
    return XMLConstants.ANY_SIMPLE_TYPE_QNAME;
  }
  return schemaType;
}

Fixed version (ground truth):
public QName getSchemaTypeFor(JavaClass javaClass){
  QName schemaType=getSchemaTypeOrNullFor(javaClass);
  if (schemaType == null) {
    return XMLConstants.ANY_SIMPLE_TYPE_QNAME;
  }
  return schemaType;
}
Program: 67470
Project: 67470
Buggy source:
public void addEnumTypeInfo(JavaClass javaClass,EnumTypeInfo info){
  if (javaClass == null) {
    return;
  }
  info.setClassName(javaClass.getQualifiedName());
  Class restrictionClass=String.class;
  if (helper.isAnnotationPresent(javaClass,XmlEnum.class)) {
    XmlEnum xmlEnum=(XmlEnum)helper.getAnnotation(javaClass,XmlEnum.class);
    restrictionClass=xmlEnum.value();
  }
  QName restrictionBase=getSchemaTypeFor(helper.getJavaClass(restrictionClass));
  info.setRestrictionBase(restrictionBase);
  for (Iterator<JavaField> fieldIt=javaClass.getDeclaredFields().iterator(); fieldIt.hasNext(); ) {
    JavaField field=fieldIt.next();
    if (field.isEnumConstant()) {
      String fieldValue=field.getName();
      if (helper.isAnnotationPresent(field,XmlEnumValue.class)) {
        XmlEnumValue xmlEnumValue=(XmlEnumValue)helper.getAnnotation(field,XmlEnumValue.class);
        fieldValue=xmlEnumValue.value();
      }
      info.addObjectToFieldValuePair(field.getName(),fieldValue);
    }
  }
  typeInfoClasses.add(javaClass);
  typeInfo.put(javaClass.getQualifiedName(),info);
}

Fixed version (ground truth):
public void addEnumTypeInfo(JavaClass javaClass,EnumTypeInfo info){
  if (javaClass == null) {
    return;
  }
  info.setClassName(javaClass.getQualifiedName());
  Class restrictionClass=String.class;
  if (helper.isAnnotationPresent(javaClass,XmlEnum.class)) {
    XmlEnum xmlEnum=(XmlEnum)helper.getAnnotation(javaClass,XmlEnum.class);
    restrictionClass=xmlEnum.value();
  }
  QName restrictionBase=getSchemaTypeFor(helper.getJavaClass(restrictionClass));
  info.setRestrictionBase(restrictionBase);
  typeInfoClasses.add(javaClass);
  typeInfo.put(javaClass.getQualifiedName(),info);
  for (Iterator<JavaField> fieldIt=javaClass.getDeclaredFields().iterator(); fieldIt.hasNext(); ) {
    JavaField field=fieldIt.next();
    if (field.isEnumConstant()) {
      String fieldValue=field.getName();
      if (helper.isAnnotationPresent(field,XmlEnumValue.class)) {
        XmlEnumValue xmlEnumValue=(XmlEnumValue)helper.getAnnotation(field,XmlEnumValue.class);
        fieldValue=xmlEnumValue.value();
      }
      info.addObjectToFieldValuePair(field.getName(),fieldValue);
    }
  }
}
Program: 67471
Project: 67471
Buggy source:
/** 
 * Build the class metadata for the class name using ASM to read the class byte codes.
 */
public static void buildClassMetadata(String className){
  ClassMetadataVisitor visitor=new ClassMetadataVisitor();
  try {
    ClassReader reader=new ClassReader(loader.getResourceAsStream(className.replace('.','/') + "String_Node_Str"));
    Attribute[] attributes=new Attribute[]{new RuntimeVisibleAnnotations(),new RuntimeVisibleParameterAnnotations(),new SignatureAttribute()};
    reader.accept(visitor,attributes,false);
  }
 catch (  Exception exception) {
    System.out.println("String_Node_Str" + className);
    exception.printStackTrace();
    metadata.put(className,new MetadataClass(className));
  }
}

Fixed version (ground truth):
/** 
 * Build the class metadata for the class name using ASM to read the class byte codes.
 */
public static void buildClassMetadata(String className){
  ClassMetadataVisitor visitor=new ClassMetadataVisitor();
  try {
    ClassReader reader=new ClassReader(loader.getResourceAsStream(className.replace('.','/') + "String_Node_Str"));
    Attribute[] attributes=new Attribute[]{new RuntimeVisibleAnnotations(),new RuntimeVisibleParameterAnnotations(),new SignatureAttribute()};
    reader.accept(visitor,attributes,false);
  }
 catch (  Exception exception) {
    metadata.put(className,new MetadataClass(className));
  }
}
Program: 67472
Project: 67472
Buggy source:
/** 
 * INTERNAL: We clone/reload an entity class by writing it out to XML and reload it  through OX.
 */
public EntityAccessor reloadEntity(EntityAccessor accessor,MetadataDescriptor descriptor){
  XMLEntityMappings xmlEntityMappings=newXMLEntityMappingsObject();
  ArrayList list=new ArrayList();
  list.add(accessor);
  xmlEntityMappings.setEntities(list);
  xmlEntityMappings=reloadXMLEntityMappingsObject(xmlEntityMappings);
  EntityAccessor entity=xmlEntityMappings.getEntities().get(0);
  MetadataClass metadataClass=MetadataFactory.getClassMetadata(entity.getClassName());
  entity.initXMLClassAccessor(metadataClass,descriptor,m_project,this);
  return entity;
}

Fixed version (ground truth):
/** 
 * INTERNAL: We clone/reload an entity class by writing it out to XML and reload it  through OX.
 */
public EntityAccessor reloadEntity(EntityAccessor accessor,MetadataDescriptor descriptor){
  XMLEntityMappings xmlEntityMappings=newXMLEntityMappingsObject();
  ArrayList list=new ArrayList();
  list.add(accessor);
  xmlEntityMappings.setEntities(list);
  xmlEntityMappings=reloadXMLEntityMappingsObject(xmlEntityMappings);
  EntityAccessor entity=xmlEntityMappings.getEntities().get(0);
  MetadataClass metadataClass=MetadataFactory.getClassMetadata(getFullClassName(entity.getClassName()));
  entity.initXMLClassAccessor(metadataClass,descriptor,m_project,this);
  return entity;
}
Program: 67473
Project: 67473
Buggy source:
/** 
 * INTERNAL: We clone/reload a mapped-superclass by writing it out to XML and  reload it through OX.
 */
public MappedSuperclassAccessor reloadMappedSuperclass(MappedSuperclassAccessor accessor,MetadataDescriptor descriptor){
  XMLEntityMappings xmlEntityMappings=newXMLEntityMappingsObject();
  ArrayList list=new ArrayList();
  list.add(accessor);
  xmlEntityMappings.setMappedSuperclasses(list);
  xmlEntityMappings=reloadXMLEntityMappingsObject(xmlEntityMappings);
  MappedSuperclassAccessor mappedSuperclass=xmlEntityMappings.getMappedSuperclasses().get(0);
  MetadataClass metadataClass=MetadataFactory.getClassMetadata(mappedSuperclass.getClassName());
  mappedSuperclass.initXMLClassAccessor(metadataClass,descriptor,m_project,this);
  return mappedSuperclass;
}

Fixed version (ground truth):
/** 
 * INTERNAL: We clone/reload a mapped-superclass by writing it out to XML and  reload it through OX.
 */
public MappedSuperclassAccessor reloadMappedSuperclass(MappedSuperclassAccessor accessor,MetadataDescriptor descriptor){
  XMLEntityMappings xmlEntityMappings=newXMLEntityMappingsObject();
  ArrayList list=new ArrayList();
  list.add(accessor);
  xmlEntityMappings.setMappedSuperclasses(list);
  xmlEntityMappings=reloadXMLEntityMappingsObject(xmlEntityMappings);
  MappedSuperclassAccessor mappedSuperclass=xmlEntityMappings.getMappedSuperclasses().get(0);
  MetadataClass metadataClass=MetadataFactory.getClassMetadata(getFullClassName(mappedSuperclass.getClassName()));
  mappedSuperclass.initXMLClassAccessor(metadataClass,descriptor,m_project,this);
  return mappedSuperclass;
}
Program: 67474
Project: 67474
Buggy source:
public XMLRoot unmarshal(org.w3c.dom.Node node,Class javaClass){
  if (getSchema() != null) {
    Validator validator=getSchema().newValidator();
    validator.setErrorHandler(getErrorHandler());
    try {
      validator.validate(new DOMSource(node));
    }
 catch (    Exception e) {
      throw XMLMarshalException.validateException(e);
    }
  }
  XMLRoot root=null;
  reader.setDocPresPolicy(documentPreservationPolicy);
  root=(XMLRoot)saxUnmarshaller.unmarshal(reader,node,javaClass);
  return root;
}

Fixed version (ground truth):
public XMLRoot unmarshal(org.w3c.dom.Node node,Class javaClass){
  validateNode(node);
  XMLRoot root=null;
  reader.setDocPresPolicy(documentPreservationPolicy);
  root=(XMLRoot)saxUnmarshaller.unmarshal(reader,node,javaClass);
  return root;
}
Program: 67475
Project: 67475
Buggy source:
/** 
 * INTERNAL: Return the DocumentPreservationPolicy associated with this session
 * @param session
 * @return
 */
public DocumentPreservationPolicy getDocumentPreservationPolicy(AbstractSession session){
  XMLLogin login=(XMLLogin)session.getDatasourceLogin();
  return login.getDocumentPreservationPolicy();
}

Fixed version (ground truth):
/** 
 * INTERNAL: Return the DocumentPreservationPolicy associated with this session
 * @param session
 * @return
 */
public DocumentPreservationPolicy getDocumentPreservationPolicy(AbstractSession session){
  if (session == null) {
    return null;
  }
  XMLLogin login=(XMLLogin)session.getDatasourceLogin();
  return login.getDocumentPreservationPolicy();
}
Program: 67477
Project: 67477
Buggy source:
protected Node objectToXMLNode(Object object,Node rootNode,XMLDescriptor descriptor,boolean isXMLRoot) throws XMLMarshalException {
  AbstractSession session=xmlContext.getSession(descriptor);
  if ((session != null) && xmlContext.getDocumentPreservationPolicy(session).shouldPreserveDocument()) {
    XMLRecord xmlRow=null;
    if (!isXMLRoot) {
      xmlRow=(XMLRecord)((XMLObjectBuilder)descriptor.getObjectBuilder()).createRecordFor(object,xmlContext.getDocumentPreservationPolicy(session));
      xmlRow.setMarshaller(this);
      if (xmlRow.getDOM().getNodeType() == Node.ELEMENT_NODE) {
        addDescriptorNamespacesToXMLRecord(descriptor,xmlRow);
      }
    }
    Document doc=objectToXML(object,rootNode,descriptor,xmlRow,isXMLRoot);
    if ((xmlRow != null) && (xmlRow.getDOM().getNodeType() == Node.DOCUMENT_FRAGMENT_NODE)) {
      return xmlRow.getDOM();
    }
 else {
      return doc;
    }
  }
  MarshalRecord marshalRecord=new NodeRecord();
  marshalRecord.setMarshaller(this);
  marshalRecord.getNamespaceResolver().setDOM(rootNode);
  marshal(object,marshalRecord,descriptor,isXMLRoot);
  return marshalRecord.getDocument();
}

Fixed version (ground truth):
protected Node objectToXMLNode(Object object,Node rootNode,XMLDescriptor descriptor,boolean isXMLRoot) throws XMLMarshalException {
  AbstractSession session=xmlContext.getSession(descriptor);
  DocumentPreservationPolicy docPresPolicy=xmlContext.getDocumentPreservationPolicy(session);
  if (docPresPolicy != null && docPresPolicy.shouldPreserveDocument()) {
    XMLRecord xmlRow=null;
    if (!isXMLRoot) {
      xmlRow=(XMLRecord)((XMLObjectBuilder)descriptor.getObjectBuilder()).createRecordFor(object,xmlContext.getDocumentPreservationPolicy(session));
      xmlRow.setMarshaller(this);
      if (xmlRow.getDOM().getNodeType() == Node.ELEMENT_NODE) {
        addDescriptorNamespacesToXMLRecord(descriptor,xmlRow);
      }
    }
    Document doc=objectToXML(object,rootNode,descriptor,xmlRow,isXMLRoot,docPresPolicy);
    if ((xmlRow != null) && (xmlRow.getDOM().getNodeType() == Node.DOCUMENT_FRAGMENT_NODE)) {
      return xmlRow.getDOM();
    }
 else {
      return doc;
    }
  }
  MarshalRecord marshalRecord=new NodeRecord();
  marshalRecord.setMarshaller(this);
  marshalRecord.getNamespaceResolver().setDOM(rootNode);
  marshal(object,marshalRecord,descriptor,isXMLRoot);
  return marshalRecord.getDocument();
}
Program: 67478
Project: 67478
Buggy source:
public Object getXMLNode(Object obj){
  return null;
}

Fixed version (ground truth):
public Object getXMLNode(Object obj){
  return xmlBinder.getXMLNode(obj);
}
Program: 67479
Project: 67479
Buggy source:
public JAXBBinder(XMLContext xmlContext){
  this.xmlContext=xmlContext;
  this.xmlBinder=this.xmlContext.createBinder();
  this.xmlBinder.getDocumentPreservationPolicy().setNodeOrderingPolicy(new IgnoreNewElementsOrderingPolicy());
  this.xmlBinder.setErrorHandler(new JAXBErrorHandler(new DefaultValidationEventHandler()));
}

Fixed version (ground truth):
public JAXBBinder(XMLContext xmlContext){
  this.xmlContext=xmlContext;
  this.xmlBinder=this.xmlContext.createBinder();
  this.xmlBinder.getDocumentPreservationPolicy().setNodeOrderingPolicy(new RelativePositionOrderingPolicy());
  this.xmlBinder.setErrorHandler(new JAXBErrorHandler(new DefaultValidationEventHandler()));
}
Program: 67480
Project: 67480
Buggy source:
public void marshal(Object obj,Object xmlNode) throws JAXBException {
  if (null == obj || null == xmlNode) {
    throw new IllegalArgumentException();
  }
}

Fixed version (ground truth):
public void marshal(Object obj,Object xmlNode) throws MarshalException {
  if (null == obj || null == xmlNode) {
    throw new IllegalArgumentException();
  }
  if (!(xmlNode instanceof Node)) {
    return;
  }
  try {
    if (obj instanceof JAXBElement) {
      JAXBElement jaxbElem=(JAXBElement)obj;
      XMLRoot xmlRoot=new XMLRoot();
      xmlRoot.setObject(jaxbElem.getValue());
      xmlRoot.setLocalName(jaxbElem.getName().getLocalPart());
      xmlRoot.setNamespaceURI(jaxbElem.getName().getNamespaceURI());
      xmlBinder.marshal(xmlRoot,(Node)xmlNode);
    }
 else {
      xmlBinder.marshal(obj,(Node)xmlNode);
    }
  }
 catch (  Exception e) {
    throw new MarshalException(e);
  }
}
Program: 67481
Project: 67481
Buggy source:
public void testElementWrapper(){
  String msg="String_Node_Str";
  boolean exception=false;
  try {
    MySchemaOutputResolver outputResolver=new MySchemaOutputResolver();
    Class[] classes=new Class[]{MyClassThree.class};
    JAXBContext context=(org.eclipse.persistence.jaxb.JAXBContext)org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(classes,null);
    context.generateSchema(outputResolver);
    assertTrue("String_Node_Str",outputResolver.schemaFiles.size() > 0);
    assertTrue("String_Node_Str",outputResolver.schemaFiles.size() == 1);
    SchemaFactory sFact=SchemaFactory.newInstance(XMLConstants.SCHEMA_URL);
    Schema theSchema=sFact.newSchema(outputResolver.schemaFiles.get(0));
    Validator validator=theSchema.newValidator();
    String src="String_Node_Str";
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
    msg=ex.toString();
  }
  assertFalse("String_Node_Str" + msg,exception);
}

Fixed version (ground truth):
public void testElementWrapper(){
  MySchemaOutputResolver outputResolver=new MySchemaOutputResolver();
  try {
    Class[] classes=new Class[]{MyClassThree.class};
    JAXBContext context=(org.eclipse.persistence.jaxb.JAXBContext)org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(classes,null);
    context.generateSchema(outputResolver);
  }
 catch (  Exception ex) {
    fail("String_Node_Str" + ex.toString());
  }
  assertTrue("String_Node_Str",outputResolver.schemaFiles.size() > 0);
  assertTrue("String_Node_Str",outputResolver.schemaFiles.size() == 1);
  try {
    SchemaFactory sFact=SchemaFactory.newInstance(XMLConstants.SCHEMA_URL);
    Schema theSchema=sFact.newSchema(outputResolver.schemaFiles.get(0));
    Validator validator=theSchema.newValidator();
    String src="String_Node_Str";
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    fail("String_Node_Str" + ex.toString());
  }
}