Program: 66167
Project: 66167
Buggy source:
public void testSubstitutionGroupsMarshal() throws Exception {
  try {
    InputStream inputStream=ClassLoader.getSystemResourceAsStream(SUBSTITUTION);
    jaxbContext=DynamicJAXBContextFactory.createContextFromXSD(inputStream,null,null,null);
    QName personQName=new QName("String_Node_Str","String_Node_Str");
    DynamicEntity person=jaxbContext.newDynamicEntity(PACKAGE + "String_Node_Str" + PERSON);
    JAXBElement<DynamicEntity> personElement=new JAXBElement<DynamicEntity>(personQName,DynamicEntity.class,person);
    personElement.setValue(person);
    QName nameQName=new QName("String_Node_Str","String_Node_Str");
    JAXBElement<String> nameElement=new JAXBElement<String>(nameQName,String.class,"String_Node_Str");
    person.set("String_Node_Str",nameElement);
    Document marshalDoc=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
    jaxbContext.createMarshaller().marshal(personElement,marshalDoc);
    Node node1=marshalDoc.getDocumentElement();
    assertEquals("String_Node_Str","String_Node_Str",node1.getLocalName());
    Node node2=node1.getFirstChild();
    assertEquals("String_Node_Str","String_Node_Str",node2.getLocalName());
    QName personneQName=new QName("String_Node_Str","String_Node_Str");
    DynamicEntity personne=jaxbContext.newDynamicEntity(PACKAGE + "String_Node_Str" + PERSON);
    JAXBElement<DynamicEntity> personneElement=new JAXBElement<DynamicEntity>(personneQName,DynamicEntity.class,personne);
    personneElement.setValue(personne);
    QName nomQName=new QName("String_Node_Str","String_Node_Str");
    JAXBElement<String> nomElement=new JAXBElement<String>(nomQName,String.class,"String_Node_Str");
    personne.set("String_Node_Str",nomElement);
    Document marshalDoc2=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
    jaxbContext.createMarshaller().marshal(personneElement,marshalDoc2);
    Node node3=marshalDoc2.getDocumentElement();
    assertEquals("String_Node_Str","String_Node_Str",node3.getLocalName());
    Node node4=node3.getFirstChild();
    assertEquals("String_Node_Str","String_Node_Str",node4.getLocalName());
  }
 catch (  UndeclaredThrowableException e) {
    if (e.getUndeclaredThrowable() instanceof NoSuchMethodException) {
      assertTrue(true);
    }
  }
}

Fixed version (ground truth):
public void testSubstitutionGroupsMarshal() throws Exception {
  try {
    InputStream inputStream=ClassLoader.getSystemResourceAsStream(SUBSTITUTION);
    jaxbContext=DynamicJAXBContextFactory.createContextFromXSD(inputStream,null,null,null);
    QName personQName=new QName("String_Node_Str","String_Node_Str");
    DynamicEntity person=jaxbContext.newDynamicEntity(PACKAGE + "String_Node_Str" + PERSON);
    JAXBElement<DynamicEntity> personElement=new JAXBElement<DynamicEntity>(personQName,DynamicEntity.class,person);
    personElement.setValue(person);
    QName nameQName=new QName("String_Node_Str","String_Node_Str");
    JAXBElement<String> nameElement=new JAXBElement<String>(nameQName,String.class,"String_Node_Str");
    person.set("String_Node_Str",nameElement);
    Document marshalDoc=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
    jaxbContext.createMarshaller().marshal(personElement,marshalDoc);
    Node node1=marshalDoc.getDocumentElement();
    assertEquals("String_Node_Str","String_Node_Str",node1.getLocalName());
    Node node2=node1.getFirstChild();
    assertEquals("String_Node_Str","String_Node_Str",node2.getLocalName());
    QName personneQName=new QName("String_Node_Str","String_Node_Str");
    DynamicEntity personne=jaxbContext.newDynamicEntity(PACKAGE + "String_Node_Str" + PERSON);
    JAXBElement<DynamicEntity> personneElement=new JAXBElement<DynamicEntity>(personneQName,DynamicEntity.class,personne);
    personneElement.setValue(personne);
    QName nomQName=new QName("String_Node_Str","String_Node_Str");
    JAXBElement<String> nomElement=new JAXBElement<String>(nomQName,String.class,"String_Node_Str");
    personne.set("String_Node_Str",nomElement);
    Document marshalDoc2=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
    jaxbContext.createMarshaller().marshal(personneElement,marshalDoc2);
    Node node3=marshalDoc2.getDocumentElement();
    assertEquals("String_Node_Str","String_Node_Str",node3.getLocalName());
    Node node4=node3.getFirstChild();
    assertEquals("String_Node_Str","String_Node_Str",node4.getLocalName());
  }
 catch (  JAXBException e) {
    try {
      throw e.getLinkedException();
    }
 catch (    UndeclaredThrowableException e2) {
      if (e2.getUndeclaredThrowable() instanceof NoSuchMethodException) {
        assertTrue(true);
      }
    }
catch (    Throwable e2) {
      fail();
    }
  }
}