nus-yam/ex-repair huggingface dataset:
Program: 68592
Project: 68592
Buggy source:
public void test(){
  EntityManager manager=createEntityManager();
  ((JpaEntityManager)manager).getUnitOfWork().getParent().getIdentityMapAccessor().initializeAllIdentityMaps();
  Query query=manager.createQuery("String_Node_Str");
  query.setHint("String_Node_Str",true);
  addWeakReferences(query.getResultList());
  addWeakReference(query);
  query=manager.createQuery("String_Node_Str");
  addWeakReferences(query.getResultList());
  addWeakReference(query);
  addWeakReference(manager);
  addWeakReference(((JpaEntityManager)manager).getUnitOfWork());
  addWeakReference(((JpaEntityManager)manager).getSession());
  manager.close();
}

Fixed version (ground truth):
public void test(){
  EntityManager manager=createEntityManager();
  boolean usesBatchWriting=((JpaEntityManager)manager).getServerSession().getPlatform().usesBatchWriting();
  if (!usesBatchWriting) {
    ((JpaEntityManager)manager).getServerSession().getPlatform().setUsesBatchWriting(true);
  }
  boolean shouldBindAllParameters=((JpaEntityManager)manager).getServerSession().getPlatform().shouldBindAllParameters();
  if (!shouldBindAllParameters) {
    ((JpaEntityManager)manager).getServerSession().getPlatform().setShouldBindAllParameters(true);
  }
  manager.getTransaction().begin();
  for (int count=0; count < 5; count++) {
    Employee employee=new Employee();
    employee.setFirstName("String_Node_Str");
    employee.setLastName("String_Node_Str");
    manager.persist(employee);
    addWeakReference(employee);
  }
  addWeakReference(manager);
  addWeakReference(((JpaEntityManager)manager).getUnitOfWork());
  addWeakReference(((JpaEntityManager)manager).getUnitOfWork().getParent());
  manager.getTransaction().commit();
  if (!usesBatchWriting) {
    ((JpaEntityManager)manager).getServerSession().getPlatform().setUsesBatchWriting(false);
  }
  if (!shouldBindAllParameters) {
    ((JpaEntityManager)manager).getServerSession().getPlatform().setShouldBindAllParameters(false);
  }
  manager.close();
}
Program: 68593
Project: 68593
Buggy source:
/** 
 * Test that read allow the garbage collection of the objects.
 */
public TestCase buildReadTest(){
  MemoryLeakTestCase test=new MemoryLeakTestCase(){
    public void test(){
      EntityManager manager=createEntityManager();
      ((JpaEntityManager)manager).getUnitOfWork().getParent().getIdentityMapAccessor().initializeAllIdentityMaps();
      Query query=manager.createQuery("String_Node_Str");
      query.setHint("String_Node_Str",true);
      addWeakReferences(query.getResultList());
      addWeakReference(query);
      query=manager.createQuery("String_Node_Str");
      addWeakReferences(query.getResultList());
      addWeakReference(query);
      addWeakReference(manager);
      addWeakReference(((JpaEntityManager)manager).getUnitOfWork());
      addWeakReference(((JpaEntityManager)manager).getSession());
      manager.close();
    }
  }
;
  test.setName("String_Node_Str");
  test.setThreshold(100);
  return test;
}

Fixed version (ground truth):
/** 
 * Test that read allow the garbage collection of the objects.
 */
public TestCase buildReadTest(){
  MemoryLeakTestCase test=new MemoryLeakTestCase(){
    public void test(){
      EntityManager manager=createEntityManager();
      ((JpaEntityManager)manager).getUnitOfWork().getParent().getIdentityMapAccessor().initializeAllIdentityMaps();
      Query query=manager.createQuery("String_Node_Str");
      query.setHint("String_Node_Str",true);
      addWeakReferences(query.getResultList());
      addWeakReference(query);
      query=manager.createQuery("String_Node_Str");
      addWeakReferences(query.getResultList());
      addWeakReference(query);
      addWeakReference(manager);
      addWeakReference(((JpaEntityManager)manager).getUnitOfWork());
      addWeakReference(((JpaEntityManager)manager).getUnitOfWork().getParent());
      manager.close();
    }
  }
;
  test.setName("String_Node_Str");
  test.setThreshold(100);
  return test;
}
Program: 68594
Project: 68594
Buggy source:
public void addTests(){
  addTest(buildReadTest());
  addTest(buildInsertTest());
  addTest(buildUpdateTest());
}

Fixed version (ground truth):
public void addTests(){
  addTest(buildReadTest());
  addTest(buildInsertTest());
  addTest(buildUpdateTest());
  addTest(buildParameterizedBatchWriteTest());
}
Program: 68596
Project: 68596
Buggy source:
public void reset(){
  getSession().executeNonSelectingSQL("String_Node_Str");
  getSession().executeNonSelectingSQL("String_Node_Str");
  getSession().executeNonSelectingSQL("String_Node_Str");
}

Fixed version (ground truth):
public void reset(){
  getSession().executeNonSelectingSQL("String_Node_Str");
}
Program: 68597
Project: 68597
Buggy source:
public XMLContext(Project project,ClassLoader classLoader){
  if ((project.getDatasourceLogin() == null) || !(project.getDatasourceLogin().getDatasourcePlatform() instanceof XMLPlatform)) {
    XMLPlatform platform=new SAXPlatform();
    platform.getConversionManager().setLoader(classLoader);
    project.setLogin(new XMLLogin(platform));
  }
  sessions=new ArrayList(1);
  DatabaseSession session=project.createDatabaseSession();
  session.setLogLevel(SessionLog.OFF);
  setupDocumentPreservationPolicy(session);
  session.login();
  sessions.add(session);
  descriptorsByQName=new HashMap();
  descriptorsByGlobalType=new HashMap();
  storeXMLDescriptorsByQName(session);
}

Fixed version (ground truth):
public XMLContext(Collection projects,ClassLoader classLoader){
  Iterator iterator=projects.iterator();
  sessions=new ArrayList(projects.size());
  descriptorsByQName=new HashMap();
  descriptorsByGlobalType=new HashMap();
  while (iterator.hasNext()) {
    Project project=(Project)iterator.next();
    if ((project.getDatasourceLogin() == null) || !(project.getDatasourceLogin().getDatasourcePlatform() instanceof XMLPlatform)) {
      XMLPlatform platform=new SAXPlatform();
      platform.getConversionManager().setLoader(classLoader);
      project.setLogin(new XMLLogin(platform));
    }
    DatabaseSession session=project.createDatabaseSession();
    session.setLogLevel(SessionLog.OFF);
    setupDocumentPreservationPolicy(session);
    session.login();
    sessions.add(session);
    storeXMLDescriptorsByQName(session);
  }
}
Program: 68598
Project: 68598
Buggy source:
/** 
 * Asks this <code>AutomapVerifier</code> to verify the execution of the automap on the state objects.
 * @param project The root of the state object hierarchy
 */
public void verify(MWProject project){
  MWDescriptor descriptor;
  Hashtable descriptors=new Hashtable();
  descriptor=project.descriptorNamed("String_Node_Str");
  descriptors.put(descriptor,test_oracle_models_employee_Address());
  descriptor=project.descriptorNamed("String_Node_Str");
  descriptors.put(descriptor,test_oracle_models_employee_Employee());
  descriptor=project.descriptorNamed("String_Node_Str");
  descriptors.put(descriptor,test_oracle_models_employee_EmploymentPeriod());
  descriptor=project.descriptorNamed("String_Node_Str");
  descriptors.put(descriptor,test_oracle_models_employee_LargeProject());
  descriptor=project.descriptorNamed("String_Node_Str");
  descriptors.put(descriptor,test_oracle_models_employee_PhoneNumber());
  descriptor=project.descriptorNamed("String_Node_Str");
  descriptors.put(descriptor,test_oracle_models_employee_Project());
  descriptor=project.descriptorNamed("String_Node_Str");
  descriptors.put(descriptor,test_oracle_models_employee_SmallProject());
  testDescriptors(descriptors);
}

Fixed version (ground truth):
/** 
 * Asks this <code>AutomapVerifier</code> to verify the execution of the automap on the state objects.
 * @param project The root of the state object hierarchy
 */
public void verify(MWProject project){
  MWDescriptor descriptor;
  Hashtable descriptors=new Hashtable();
  descriptor=project.descriptorNamed("String_Node_Str");
  descriptors.put(descriptor,org_eclipse_persistence_tools_workbench_test_models_employee_Address());
  descriptor=project.descriptorNamed("String_Node_Str");
  descriptors.put(descriptor,org_eclipse_persistence_tools_workbench_test_models_employee_Employee());
  descriptor=project.descriptorNamed("String_Node_Str");
  descriptors.put(descriptor,org_eclipse_persistence_tools_workbench_test_models_employee_EmploymentPeriod());
  descriptor=project.descriptorNamed("String_Node_Str");
  descriptors.put(descriptor,org_eclipse_persistence_tools_workbench_test_models_employee_LargeProject());
  descriptor=project.descriptorNamed("String_Node_Str");
  descriptors.put(descriptor,org_eclipse_persistence_tools_workbench_test_models_employee_PhoneNumber());
  descriptor=project.descriptorNamed("String_Node_Str");
  descriptors.put(descriptor,org_eclipse_persistence_tools_workbench_test_models_employee_Project());
  testDescriptors(descriptors);
}
Program: 68599
Project: 68599
Buggy source:
/** 
 * match classes with tables using partial string matching on their short names, with any prevailing prefixes and/or suffixes stripped off
 */
protected void matchClassesAndMetaData(Collection automapDescriptors){
  super.matchClassesAndMetaData(automapDescriptors);
  DescriptorStringHolder[] descriptorHolders=this.buildMetaDataDescriptorStringHolders(automapDescriptors);
  TableStringHolder[] tableHolders=this.buildTableStringHolders();
  StringHolderPair[] pairs=CLASS_META_DATA_NAME_COMPARATOR_ENGINE.match(descriptorHolders,tableHolders);
  for (int i=pairs.length; i-- > 0; ) {
    StringHolderPair pair=pairs[i];
    DescriptorStringHolder descriptorHolder=(DescriptorStringHolder)pair.getStringHolder1();
    TableStringHolder tableHolder=(TableStringHolder)pair.getStringHolder2();
    if ((descriptorHolder == null) || (tableHolder == null)) {
      continue;
    }
    if (pair.getScore() > 0.50) {
      ((MWTableDescriptor)descriptorHolder.getDescriptor()).setPrimaryTable(tableHolder.getTable());
    }
  }
}

Fixed version (ground truth):
/** 
 * match classes with tables using partial string matching on their short names, with any prevailing prefixes and/or suffixes stripped off
 */
protected void matchClassesAndMetaData(Collection automapDescriptors){
  super.matchClassesAndMetaData(automapDescriptors);
  DescriptorStringHolder[] descriptorHolders=this.buildMetaDataDescriptorStringHolders(automapDescriptors);
  TableStringHolder[] tableHolders=this.buildTableStringHolders();
  StringHolderPair[] pairs=CLASS_META_DATA_NAME_COMPARATOR_ENGINE.match(descriptorHolders,tableHolders);
  for (int i=pairs.length; i-- > 0; ) {
    StringHolderPair pair=pairs[i];
    DescriptorStringHolder descriptorHolder=(DescriptorStringHolder)pair.getStringHolder1();
    TableStringHolder tableHolder=(TableStringHolder)pair.getStringHolder2();
    if ((descriptorHolder == null) || (tableHolder == null)) {
      continue;
    }
    if (pair.getScore() > 0.45) {
      ((MWTableDescriptor)descriptorHolder.getDescriptor()).setPrimaryTable(tableHolder.getTable());
    }
  }
}
Program: 68600
Project: 68600
Buggy source:
/** 
 * Build and return a database row that contains a foreign key for the specified reference object. This will be stored in the nested row(s).
 */
protected XMLRecord extractKeyRowFromReferenceObject(Object object,AbstractSession session,XMLRecord parentRecord){
  Element newNode=XPathEngine.getInstance().createUnownedElement(parentRecord.getDOM(),getForeignKeyGroupingElement());
  XMLRecord result=new DOMRecord(newNode);
  for (int i=0; i < this.getSourceForeignKeyFields().size(); i++) {
    DatabaseField fkField=(DatabaseField)getSourceForeignKeyFields().get(i);
    if (object == null) {
      result.add(fkField,null);
    }
 else {
      DatabaseField pkField=(DatabaseField)this.getSourceForeignKeysToTargetKeys().get(fkField);
      Object value=this.getReferenceDescriptor().getObjectBuilder().extractValueFromObjectForField(object,pkField,session);
      result.add(fkField,value);
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Build and return a database row that contains a foreign key for the specified reference  object.  This will be stored in the nested row(s).
 */
protected XMLRecord extractKeyRowFromReferenceObject(Object object,AbstractSession session,XMLRecord parentRecord){
  Element newNode=XPathEngine.getInstance().createUnownedElement(parentRecord.getDOM(),getForeignKeyGroupingElement());
  XMLRecord result=new DOMRecord(newNode);
  result.setSession(session);
  for (int i=0; i < this.getSourceForeignKeyFields().size(); i++) {
    DatabaseField fkField=(DatabaseField)getSourceForeignKeyFields().get(i);
    if (object == null) {
      result.add(fkField,null);
    }
 else {
      DatabaseField pkField=(DatabaseField)this.getSourceForeignKeysToTargetKeys().get(fkField);
      Object value=this.getReferenceDescriptor().getObjectBuilder().extractValueFromObjectForField(object,pkField,session);
      result.add(fkField,value);
    }
  }
  return result;
}
Program: 68602
Project: 68602
Buggy source:
/** 
 * INTERNAL:
 */
public Vector getForeignKeyRows(AbstractRecord row){
  Vector subRows=new Vector();
  if (getForeignKeyGroupingElement() == null) {
    if (this.getSourceForeignKeyFields().size() > 0) {
      Object values=row.getValues((DatabaseField)this.getSourceForeignKeyFields().get(0));
      if (values != null) {
        if (values instanceof Vector) {
          int valuesSize=((Vector)values).size();
          for (int j=0; j < valuesSize; j++) {
            XMLRecord newRecord=new DOMRecord("String_Node_Str");
            newRecord.put(this.getSourceForeignKeyFields().get(0),((Vector)values).get(j));
            subRows.add(newRecord);
          }
        }
 else {
          XMLRecord newRecord=new DOMRecord("String_Node_Str");
          newRecord.put(getSourceForeignKeyFields().get(0),values);
          subRows.add(newRecord);
        }
      }
    }
  }
 else {
    subRows=(Vector)row.getValues(getForeignKeyGroupingElement());
  }
  return subRows;
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public Vector getForeignKeyRows(AbstractRecord row){
  Vector subRows=new Vector();
  if (getForeignKeyGroupingElement() == null) {
    if (this.getSourceForeignKeyFields().size() > 0) {
      Object values=row.getValues((DatabaseField)this.getSourceForeignKeyFields().get(0));
      if (values != null) {
        if (values instanceof Vector) {
          int valuesSize=((Vector)values).size();
          for (int j=0; j < valuesSize; j++) {
            XMLRecord newRecord=new DOMRecord("String_Node_Str");
            newRecord.setSession(((XMLRecord)row).getSession());
            newRecord.put(this.getSourceForeignKeyFields().get(0),((Vector)values).get(j));
            subRows.add(newRecord);
          }
        }
 else {
          XMLRecord newRecord=new DOMRecord("String_Node_Str");
          newRecord.setSession(((XMLRecord)row).getSession());
          newRecord.put(getSourceForeignKeyFields().get(0),values);
          subRows.add(newRecord);
        }
      }
    }
  }
 else {
    subRows=(Vector)row.getValues(getForeignKeyGroupingElement());
  }
  return subRows;
}
Program: 68606
Project: 68606
Buggy source:
public static XMLMarshalException marshalException(Exception nestedException){
  Object[] args={};
  XMLMarshalException exception=new XMLMarshalException(ExceptionMessageGenerator.buildMessage(XMLMarshalException.class,MARSHAL_EXCEPTION,args),nestedException);
  exception.setErrorCode(MARSHAL_EXCEPTION);
  exception.setInternalException(nestedException);
  return exception;
}

Fixed version (ground truth):
public static XMLMarshalException marshalException(Exception nestedException){
  Object[] args={};
  XMLMarshalException exception=new XMLMarshalException(ExceptionMessageGenerator.buildMessage(XMLMarshalException.class,MARSHAL_EXCEPTION,args),nestedException);
  exception.setErrorCode(MARSHAL_EXCEPTION);
  return exception;
}
Program: 68608
Project: 68608
Buggy source:
private void generateClassDescriptorsForTables(RelationalProjectNode projectNode,Collection tables){
  generateDescriptorsForTables(projectNode,tables,false);
}

Fixed version (ground truth):
private void generateClassDescriptorsForTables(RelationalProjectNode projectNode,Collection tables){
  generateDescriptorsForTables(projectNode,tables);
}
Program: 68609
Project: 68609
Buggy source:
public DescriptorGenerationDialog(MWRelationalProject project,boolean generateEjbs,WorkbenchContext workbenchContext){
  super(workbenchContext);
  this.project=project;
  this.generateEjbs=generateEjbs;
  initializeDialog();
}

Fixed version (ground truth):
public DescriptorGenerationDialog(MWRelationalProject project,WorkbenchContext workbenchContext){
  super(workbenchContext);
  this.project=project;
  initializeDialog();
}
Program: 68610
Project: 68610
Buggy source:
public boolean getGenerateAccessors(){
  return this.generateEjbs ? true : this.generateAccessorsCheckBox.isSelected();
}

Fixed version (ground truth):
public boolean getGenerateAccessors(){
  return this.generateAccessorsCheckBox.isSelected();
}
Program: 68612
Project: 68612
Buggy source:
protected String helpTopicId(){
  return (this.generateEjbs) ? "String_Node_Str" : "String_Node_Str";
}

Fixed version (ground truth):
protected String helpTopicId(){
  return "String_Node_Str";
}
Program: 68613
Project: 68613
Buggy source:
/** 
 * INTERNAL: Allow the call to translate the XQuery arguments.
 */
public void translate(AbstractRecord translationRow,AbstractRecord modifyRow,AbstractSession session){
  setInputRow(modifyRow);
  translateQueryString(translationRow,modifyRow,session);
}

Fixed version (ground truth):
/** 
 * INTERNAL: Allow the call to translate the XQuery arguments.
 */
public void translate(AbstractRecord translationRow,AbstractRecord modifyRow,AbstractSession session){
  if (translationRow != EmptyRecord.getEmptyRecord() && getQuery() != null && getQuery().getDescriptor() != null) {
    ((XMLRecord)translationRow).setSession(session);
  }
  setInputRow(modifyRow);
  translateQueryString(translationRow,modifyRow,session);
}
Program: 68616
Project: 68616
Buggy source:
/** 
 * Return the row with primary keys and their values from the given expression.
 */
public Vector extractPrimaryKeyFromExpression(boolean requiresExactMatch,Expression expression,AbstractRecord translationRow,AbstractSession session){
  AbstractRecord primaryKeyRow=createRecord(getPrimaryKeyMappings().size());
  ((XMLRecord)primaryKeyRow).setSession(session);
  expression.getBuilder().setSession(session.getRootSession(null));
  boolean isValid=expression.extractPrimaryKeyValues(requiresExactMatch,getDescriptor(),primaryKeyRow,translationRow);
  if (requiresExactMatch && (!isValid)) {
    return null;
  }
  if (primaryKeyRow.size() != getDescriptor().getPrimaryKeyFields().size()) {
    return null;
  }
  return extractPrimaryKeyFromRow(primaryKeyRow,session);
}

Fixed version (ground truth):
/** 
 * Override method in superclass in order to set the session on the record. Return the row with primary keys and their values from the given expression.
 */
public Vector extractPrimaryKeyFromExpression(boolean requiresExactMatch,Expression expression,AbstractRecord translationRow,AbstractSession session){
  AbstractRecord primaryKeyRow=createRecord(getPrimaryKeyMappings().size());
  ((XMLRecord)primaryKeyRow).setSession(session);
  expression.getBuilder().setSession(session.getRootSession(null));
  boolean isValid=expression.extractPrimaryKeyValues(requiresExactMatch,getDescriptor(),primaryKeyRow,translationRow);
  if (requiresExactMatch && (!isValid)) {
    return null;
  }
  if (primaryKeyRow.size() != getDescriptor().getPrimaryKeyFields().size()) {
    return null;
  }
  return extractPrimaryKeyFromRow(primaryKeyRow,session);
}
Program: 68617
Project: 68617
Buggy source:
/** 
 * Return the row with primary keys and their values from the given expression.
 */
public AbstractRecord extractPrimaryKeyRowFromExpression(Expression expression,AbstractRecord translationRow,AbstractSession session){
  AbstractRecord primaryKeyRow=createRecord(getPrimaryKeyMappings().size());
  ((XMLRecord)primaryKeyRow).setSession(session);
  expression.getBuilder().setSession(session.getRootSession(null));
  boolean isValid=expression.extractPrimaryKeyValues(true,getDescriptor(),primaryKeyRow,translationRow);
  if (!isValid) {
    return null;
  }
  if (primaryKeyRow.size() != getDescriptor().getPrimaryKeyFields().size()) {
    return null;
  }
  return primaryKeyRow;
}

Fixed version (ground truth):
/** 
 * Override method in superclass in order to set the session on the record. Return the row with primary keys and their values from the given expression.
 */
public AbstractRecord extractPrimaryKeyRowFromExpression(Expression expression,AbstractRecord translationRow,AbstractSession session){
  AbstractRecord primaryKeyRow=createRecord(getPrimaryKeyMappings().size());
  ((XMLRecord)primaryKeyRow).setSession(session);
  expression.getBuilder().setSession(session.getRootSession(null));
  boolean isValid=expression.extractPrimaryKeyValues(true,getDescriptor(),primaryKeyRow,translationRow);
  if (!isValid) {
    return null;
  }
  if (primaryKeyRow.size() != getDescriptor().getPrimaryKeyFields().size()) {
    return null;
  }
  return primaryKeyRow;
}
Program: 68619
Project: 68619
Buggy source:
/** 
 * INTERNAL: Load a session.xml document. The error handler will capture all the errors and allow for a document to be returned.
 */
protected Document loadDocument(ClassLoader loader,boolean validate){
  URL inURL=loader.getResource(this.resourceName);
  File inFile=new File(this.resourceName);
  if (inURL == null) {
    if (this.resourceName.equals(DEFAULT_RESOURCE_NAME)) {
      inURL=loader.getResource(DEFAULT_RESOURCE_NAME_IN_META_INF);
    }
    if ((inURL == null) && (!inFile.exists())) {
      throw ValidationException.noSessionsXMLFound(this.resourceName);
    }
  }
  if (inURL == null) {
    this.resourcePath=inFile.getAbsolutePath();
  }
 else {
    this.resourcePath=inURL.getPath();
  }
  XMLPlatform xmlPlatform=XMLPlatformFactory.getInstance().getXMLPlatform();
  XMLDescriptor projectDescriptor=(XMLDescriptor)getProject().getDescriptors().get(SessionConfigs.class);
  XMLParser parser=xmlPlatform.newXMLParser();
  if (validate) {
    parser.setValidationMode(XMLParser.SCHEMA_VALIDATION);
  }
 else {
    parser.setValidationMode(XMLParser.NONVALIDATING);
  }
  parser.setWhitespacePreserving(false);
  parser.setXMLSchema(projectDescriptor.getSchemaReference().getURL());
  parser.setEntityResolver(this.entityResolver);
  parser.setErrorHandler(new XMLSessionConfigLoaderErrorHandler());
  if (inURL == null) {
    return parser.parse(inFile);
  }
 else {
    return parser.parse(inURL);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Load a session.xml document. The error handler will capture all the errors and allow for a document to be returned.
 */
protected Document loadDocument(ClassLoader loader,boolean validate){
  URL inURL=loader.getResource(this.resourceName);
  File inFile=new File(this.resourceName);
  if (inURL == null) {
    if (this.resourceName.equals(DEFAULT_RESOURCE_NAME)) {
      inURL=loader.getResource(DEFAULT_RESOURCE_NAME_IN_META_INF);
    }
    if ((inURL == null) && (!inFile.exists())) {
      throw ValidationException.noSessionsXMLFound(this.resourceName);
    }
  }
  if (inURL == null) {
    this.resourcePath=inFile.getAbsolutePath();
  }
 else {
    this.resourcePath=inURL.getPath();
  }
  XMLPlatform xmlPlatform=XMLPlatformFactory.getInstance().getXMLPlatform();
  XMLParser parser=xmlPlatform.newXMLParser();
  if (validate) {
    parser.setValidationMode(XMLParser.SCHEMA_VALIDATION);
  }
 else {
    parser.setValidationMode(XMLParser.NONVALIDATING);
  }
  parser.setWhitespacePreserving(false);
  parser.setXMLSchema(loader.getResource("String_Node_Str"));
  parser.setEntityResolver(this.entityResolver);
  parser.setErrorHandler(new XMLSessionConfigLoaderErrorHandler());
  if (inURL == null) {
    return parser.parse(inFile);
  }
 else {
    return parser.parse(inURL);
  }
}
Program: 68620
Project: 68620
Buggy source:
public ClassDescriptor buildSessionConfigsDescriptor(){
  XMLDescriptor descriptor=(XMLDescriptor)super.buildSessionConfigsDescriptor();
  descriptor.setSchemaReference(new XMLSchemaClassPathReference("String_Node_Str"));
  descriptor.setDefaultRootElement("String_Node_Str");
  return descriptor;
}

Fixed version (ground truth):
public ClassDescriptor buildSessionConfigsDescriptor(){
  XMLDescriptor descriptor=(XMLDescriptor)super.buildSessionConfigsDescriptor();
  descriptor.setDefaultRootElement("String_Node_Str");
  return descriptor;
}
Program: 68622
Project: 68622
Buggy source:
/** 
 * INTERNAL:
 */
public void addDefaultListener(EntityListenerMetadata defaultListener){
  m_defaultListeners.put(defaultListener.getClassName(),defaultListener);
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void addDefaultListener(EntityListenerMetadata defaultListener){
  m_defaultListeners.add(defaultListener);
}
Program: 68624
Project: 68624
Buggy source:
/** 
 * INTERNAL:
 */
public HashMap<String,EntityListenerMetadata> getDefaultListeners(){
  return m_defaultListeners;
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public Set<EntityListenerMetadata> getDefaultListeners(){
  return m_defaultListeners;
}
Program: 68625
Project: 68625
Buggy source:
/** 
 * INTERNAL: Process the default listeners defined in XML. This method will process  the class for additional lifecycle callback methods that are decorated  with annotations. NOTE: We add the default listeners regardless if the exclude default  listeners flag is set. This allows the user to change the exclude flag  at runtime and have the default listeners available to them.
 */
protected void processDefaultListeners(){
  for (  EntityListenerMetadata defaultListener : getProject().getDefaultListeners().values()) {
    EntityListenerMetadata listener=(EntityListenerMetadata)defaultListener.clone();
    listener.setEntityClass(getJavaClass());
    listener.initializeListenerClass(MetadataHelper.getClassForName(listener.getClassName(),getJavaClass().getClassLoader()));
    Method[] candidateMethods=MetadataHelper.getCandidateCallbackMethodsForEntityListener(listener);
    processCallbackMethodNames(candidateMethods,listener);
    processCallbackMethods(candidateMethods,listener);
    getDescriptor().addDefaultEventListener(listener);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Process the default listeners defined in XML. This method will process  the class for additional lifecycle callback methods that are decorated  with annotations. NOTE: We add the default listeners regardless if the exclude default  listeners flag is set. This allows the user to change the exclude flag  at runtime and have the default listeners available to them.
 */
protected void processDefaultListeners(){
  for (  EntityListenerMetadata defaultListener : getProject().getDefaultListeners()) {
    EntityListenerMetadata listener=(EntityListenerMetadata)defaultListener.clone();
    listener.setEntityClass(getJavaClass());
    listener.initializeListenerClass(MetadataHelper.getClassForName(listener.getClassName(),getJavaClass().getClassLoader()));
    Method[] candidateMethods=MetadataHelper.getCandidateCallbackMethodsForEntityListener(listener);
    processCallbackMethodNames(candidateMethods,listener);
    processCallbackMethods(candidateMethods,listener);
    getDescriptor().addDefaultEventListener(listener);
  }
}
Program: 68626
Project: 68626
Buggy source:
private void runMethod(String methodName) throws Throwable {
  assertNotNull(methodName);
  Method runMethod=null;
  try {
    runMethod=retrieveMethod(this.testCase.getClass(),methodName);
    runMethod.setAccessible(true);
  }
 catch (  NoSuchMethodException e) {
    fail("String_Node_Str" + methodName + "String_Node_Str");
  }
  try {
    runMethod.invoke(this.testCase,new Class[0]);
  }
 catch (  InvocationTargetException e) {
    e.fillInStackTrace();
    throw e.getTargetException();
  }
catch (  IllegalAccessException e) {
    e.fillInStackTrace();
    throw e;
  }
}

Fixed version (ground truth):
private void runMethod(String methodName) throws Throwable {
  assertNotNull(methodName);
  Method runMethod=null;
  try {
    runMethod=retrieveMethod(this.testCase.getClass(),methodName);
    runMethod.setAccessible(true);
  }
 catch (  NoSuchMethodException e) {
    fail("String_Node_Str" + methodName + "String_Node_Str");
  }
  try {
    runMethod.invoke(this.testCase,(Object[])new Class[0]);
  }
 catch (  InvocationTargetException e) {
    e.fillInStackTrace();
    throw e.getTargetException();
  }
catch (  IllegalAccessException e) {
    e.fillInStackTrace();
    throw e;
  }
}
Program: 68627
Project: 68627
Buggy source:
/** 
 * Runs all the methods contained in the given collection. If one fails, then the process is stopped.
 * @param methods The methods to be ran
 * @throws Throwable If any problem was encountered in an invoked method
 */
private void runMethods(Collection methods) throws Throwable {
  for (Iterator iter=methods.iterator(); iter.hasNext(); ) {
    try {
      updateWindowState();
      resetFocus();
      Method method=(Method)iter.next();
      method.setAccessible(true);
      method.invoke(this,null);
    }
 catch (    InvocationTargetException e) {
      throw e.getCause();
    }
  }
}

Fixed version (ground truth):
/** 
 * Runs all the methods contained in the given collection. If one fails, then the process is stopped.
 * @param methods The methods to be ran
 * @throws Throwable If any problem was encountered in an invoked method
 */
private void runMethods(Collection methods) throws Throwable {
  for (Iterator iter=methods.iterator(); iter.hasNext(); ) {
    try {
      updateWindowState();
      resetFocus();
      Method method=(Method)iter.next();
      method.setAccessible(true);
      method.invoke(this,(Object[])null);
    }
 catch (    InvocationTargetException e) {
      throw e.getCause();
    }
  }
}
Program: 68630
Project: 68630
Buggy source:
public XMLAnyCollectionMapping generateAnyCollectionMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  AnyProperty prop=(AnyProperty)property;
  XMLAnyCollectionMapping mapping=new XMLAnyCollectionMapping();
  mapping.setAttributeName(property.getPropertyName());
  if (prop.isLax()) {
    mapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT);
  }
 else {
    mapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT);
  }
  descriptor.addMapping(mapping);
  return mapping;
}

Fixed version (ground truth):
public XMLAnyCollectionMapping generateAnyCollectionMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  AnyProperty prop=(AnyProperty)property;
  XMLAnyCollectionMapping mapping=new XMLAnyCollectionMapping();
  mapping.setAttributeName(property.getPropertyName());
  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;
}
Program: 68632
Project: 68632
Buggy source:
public void setClasses(Class[] newClasses) throws Exception {
  this.classes=newClasses;
  generator=new Generator(new JavaModelInputImpl(classes,new JavaModelImpl()));
  Project proj=generator.generateProject();
  for (Iterator<ClassDescriptor> descriptorIt=proj.getOrderedDescriptors().iterator(); descriptorIt.hasNext(); ) {
    ClassDescriptor descriptor=descriptorIt.next();
    if (descriptor.getJavaClass() == null) {
      descriptor.setJavaClass(ConversionManager.getDefaultManager().convertClassNameToClass(descriptor.getJavaClassName()));
    }
  }
  setProject(proj);
}

Fixed version (ground truth):
public void setClasses(Class[] newClasses) throws Exception {
  this.classes=newClasses;
  generator=new Generator(new JavaModelInputImpl(classes,new JavaModelImpl(Thread.currentThread().getContextClassLoader())));
  Project proj=generator.generateProject();
  for (Iterator<ClassDescriptor> descriptorIt=proj.getOrderedDescriptors().iterator(); descriptorIt.hasNext(); ) {
    ClassDescriptor descriptor=descriptorIt.next();
    if (descriptor.getJavaClass() == null) {
      descriptor.setJavaClass(ConversionManager.getDefaultManager().convertClassNameToClass(descriptor.getJavaClassName()));
    }
  }
  setProject(proj);
}
Program: 68633
Project: 68633
Buggy source:
public void testName002Positive() throws Exception {
  boolean exception=false;
  String msg=null;
  String src="String_Node_Str";
  String tmpdir=System.getenv("String_Node_Str");
  try {
    Class[] jClasses=new Class[]{Name002.class};
    Generator gen=new Generator(new JavaModelInputImpl(jClasses,new JavaModelImpl()));
    gen.generateSchemaFiles(tmpdir,null);
    SchemaFactory sFact=SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
    Schema theSchema=sFact.newSchema(new File(tmpdir + "String_Node_Str"));
    Validator validator=theSchema.newValidator();
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
  }
  assertTrue("String_Node_Str" + msg,exception == false);
}

Fixed version (ground truth):
public void testName002Positive() throws Exception {
  boolean exception=false;
  String msg=null;
  String src="String_Node_Str";
  String tmpdir=System.getenv("String_Node_Str");
  try {
    Class[] jClasses=new Class[]{Name002.class};
    Generator gen=new Generator(new JavaModelInputImpl(jClasses,new JavaModelImpl(Thread.currentThread().getContextClassLoader())));
    gen.generateSchemaFiles(tmpdir,null);
    SchemaFactory sFact=SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
    Schema theSchema=sFact.newSchema(new File(tmpdir + "String_Node_Str"));
    Validator validator=theSchema.newValidator();
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
  }
  assertTrue("String_Node_Str" + msg,exception == false);
}
Program: 68634
Project: 68634
Buggy source:
public void testNamespace001Positive() throws Exception {
  boolean exception=false;
  String msg=null;
  String src="String_Node_Str";
  String tmpdir=System.getenv("String_Node_Str");
  try {
    Class[] jClasses=new Class[]{NameSpace001.class};
    Generator gen=new Generator(new JavaModelInputImpl(jClasses,new JavaModelImpl()));
    gen.generateSchemaFiles(tmpdir,null);
    SchemaFactory sFact=SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
    Schema theSchema=sFact.newSchema(new File(tmpdir + "String_Node_Str"));
    Validator validator=theSchema.newValidator();
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
    msg=ex.getMessage();
  }
  assertTrue("String_Node_Str" + msg,exception == false);
}

Fixed version (ground truth):
public void testNamespace001Positive() throws Exception {
  boolean exception=false;
  String msg=null;
  String src="String_Node_Str";
  String tmpdir=System.getenv("String_Node_Str");
  try {
    Class[] jClasses=new Class[]{NameSpace001.class};
    Generator gen=new Generator(new JavaModelInputImpl(jClasses,new JavaModelImpl(Thread.currentThread().getContextClassLoader())));
    gen.generateSchemaFiles(tmpdir,null);
    SchemaFactory sFact=SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
    Schema theSchema=sFact.newSchema(new File(tmpdir + "String_Node_Str"));
    Validator validator=theSchema.newValidator();
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
    msg=ex.getMessage();
  }
  assertTrue("String_Node_Str" + msg,exception == false);
}
Program: 68635
Project: 68635
Buggy source:
public void testName001Positive() throws Exception {
  boolean exception=false;
  String msg=null;
  String src="String_Node_Str";
  String tmpdir=System.getenv("String_Node_Str");
  try {
    Class[] jClasses=new Class[]{Name001.class};
    Generator gen=new Generator(new JavaModelInputImpl(jClasses,new JavaModelImpl()));
    gen.generateSchemaFiles(tmpdir,null);
    SchemaFactory sFact=SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
    Schema theSchema=sFact.newSchema(new File(tmpdir + "String_Node_Str"));
    Validator validator=theSchema.newValidator();
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
    msg=ex.toString();
  }
  assertTrue("String_Node_Str" + msg,exception == false);
}

Fixed version (ground truth):
public void testName001Positive() throws Exception {
  boolean exception=false;
  String msg=null;
  String src="String_Node_Str";
  String tmpdir=System.getenv("String_Node_Str");
  try {
    Class[] jClasses=new Class[]{Name001.class};
    Generator gen=new Generator(new JavaModelInputImpl(jClasses,new JavaModelImpl(Thread.currentThread().getContextClassLoader())));
    gen.generateSchemaFiles(tmpdir,null);
    SchemaFactory sFact=SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
    Schema theSchema=sFact.newSchema(new File(tmpdir + "String_Node_Str"));
    Validator validator=theSchema.newValidator();
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
    msg=ex.toString();
  }
  assertTrue("String_Node_Str" + msg,exception == false);
}
Program: 68636
Project: 68636
Buggy source:
public void testName001Negative() throws Exception {
  boolean exception=false;
  String src="String_Node_Str";
  String tmpdir=System.getenv("String_Node_Str");
  try {
    Class[] jClasses=new Class[]{Name001.class};
    Generator gen=new Generator(new JavaModelInputImpl(jClasses,new JavaModelImpl()));
    gen.generateSchemaFiles(tmpdir,null);
    SchemaFactory sFact=SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
    Schema theSchema=sFact.newSchema(new File(tmpdir + "String_Node_Str"));
    Validator validator=theSchema.newValidator();
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
  }
  assertFalse("String_Node_Str",exception == false);
}

Fixed version (ground truth):
public void testName001Negative() throws Exception {
  boolean exception=false;
  String src="String_Node_Str";
  String tmpdir=System.getenv("String_Node_Str");
  try {
    Class[] jClasses=new Class[]{Name001.class};
    Generator gen=new Generator(new JavaModelInputImpl(jClasses,new JavaModelImpl(Thread.currentThread().getContextClassLoader())));
    gen.generateSchemaFiles(tmpdir,null);
    SchemaFactory sFact=SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
    Schema theSchema=sFact.newSchema(new File(tmpdir + "String_Node_Str"));
    Validator validator=theSchema.newValidator();
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
  }
  assertFalse("String_Node_Str",exception == false);
}
Program: 68637
Project: 68637
Buggy source:
public void testNamespace001Negative() throws Exception {
  boolean exception=false;
  String msg=null;
  String src="String_Node_Str";
  String tmpdir=System.getenv("String_Node_Str");
  try {
    Class[] jClasses=new Class[]{NameSpace001.class};
    Generator gen=new Generator(new JavaModelInputImpl(jClasses,new JavaModelImpl()));
    gen.generateSchemaFiles(tmpdir,null);
    SchemaFactory sFact=SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
    Schema theSchema=sFact.newSchema(new File(tmpdir + "String_Node_Str"));
    Validator validator=theSchema.newValidator();
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
    msg=ex.getMessage();
  }
  assertFalse("String_Node_Str" + msg,exception == false);
}

Fixed version (ground truth):
public void testNamespace001Negative() throws Exception {
  boolean exception=false;
  String msg=null;
  String src="String_Node_Str";
  String tmpdir=System.getenv("String_Node_Str");
  try {
    Class[] jClasses=new Class[]{NameSpace001.class};
    Generator gen=new Generator(new JavaModelInputImpl(jClasses,new JavaModelImpl(Thread.currentThread().getContextClassLoader())));
    gen.generateSchemaFiles(tmpdir,null);
    SchemaFactory sFact=SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
    Schema theSchema=sFact.newSchema(new File(tmpdir + "String_Node_Str"));
    Validator validator=theSchema.newValidator();
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
    msg=ex.getMessage();
  }
  assertFalse("String_Node_Str" + msg,exception == false);
}
Program: 68638
Project: 68638
Buggy source:
public void testName002Negative() throws Exception {
  boolean exception=false;
  String msg=null;
  String src="String_Node_Str";
  String tmpdir=System.getenv("String_Node_Str");
  try {
    Class[] jClasses=new Class[]{Name002.class};
    Generator gen=new Generator(new JavaModelInputImpl(jClasses,new JavaModelImpl()));
    gen.generateSchemaFiles(tmpdir,null);
    SchemaFactory sFact=SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
    Schema theSchema=sFact.newSchema(new File(tmpdir + "String_Node_Str"));
    Validator validator=theSchema.newValidator();
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
    msg=ex.getMessage();
  }
  assertFalse("String_Node_Str" + msg,exception == false);
}

Fixed version (ground truth):
public void testName002Negative() throws Exception {
  boolean exception=false;
  String msg=null;
  String src="String_Node_Str";
  String tmpdir=System.getenv("String_Node_Str");
  try {
    Class[] jClasses=new Class[]{Name002.class};
    Generator gen=new Generator(new JavaModelInputImpl(jClasses,new JavaModelImpl(Thread.currentThread().getContextClassLoader())));
    gen.generateSchemaFiles(tmpdir,null);
    SchemaFactory sFact=SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
    Schema theSchema=sFact.newSchema(new File(tmpdir + "String_Node_Str"));
    Validator validator=theSchema.newValidator();
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
    msg=ex.getMessage();
  }
  assertFalse("String_Node_Str" + msg,exception == false);
}
Program: 68639
Project: 68639
Buggy source:
public void testBaseType001cPositive() throws Exception {
  boolean exception=false;
  String msg=null;
  String src="String_Node_Str";
  String tmpdir=System.getenv("String_Node_Str");
  try {
    Class[] jClasses=new Class[]{BaseType001c.class};
    Generator gen=new Generator(new JavaModelInputImpl(jClasses,new JavaModelImpl()));
    gen.generateSchemaFiles(tmpdir,null);
    SchemaFactory sFact=SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
    Schema theSchema=sFact.newSchema(new File(tmpdir + "String_Node_Str"));
    Validator validator=theSchema.newValidator();
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
    msg=ex.toString();
  }
  assertTrue("String_Node_Str" + msg,exception == false);
}

Fixed version (ground truth):
public void testBaseType001cPositive() throws Exception {
  boolean exception=false;
  String msg=null;
  String src="String_Node_Str";
  String tmpdir=System.getenv("String_Node_Str");
  try {
    Class[] jClasses=new Class[]{BaseType001c.class};
    Generator gen=new Generator(new JavaModelInputImpl(jClasses,new JavaModelImpl(Thread.currentThread().getContextClassLoader())));
    gen.generateSchemaFiles(tmpdir,null);
    SchemaFactory sFact=SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
    Schema theSchema=sFact.newSchema(new File(tmpdir + "String_Node_Str"));
    Validator validator=theSchema.newValidator();
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
    msg=ex.toString();
  }
  assertTrue("String_Node_Str" + msg,exception == false);
}
Program: 68640
Project: 68640
Buggy source:
public void testBaseType001cNegative() throws Exception {
  boolean exception=false;
  String src="String_Node_Str";
  String tmpdir=System.getenv("String_Node_Str");
  try {
    Class[] jClasses=new Class[]{BaseType001c.class};
    Generator gen=new Generator(new JavaModelInputImpl(jClasses,new JavaModelImpl()));
    gen.generateSchemaFiles(tmpdir,null);
    SchemaFactory sFact=SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
    Schema theSchema=sFact.newSchema(new File(tmpdir + "String_Node_Str"));
    Validator validator=theSchema.newValidator();
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
  }
  assertFalse("String_Node_Str",exception == false);
}

Fixed version (ground truth):
public void testBaseType001cNegative() throws Exception {
  boolean exception=false;
  String src="String_Node_Str";
  String tmpdir=System.getenv("String_Node_Str");
  try {
    Class[] jClasses=new Class[]{BaseType001c.class};
    Generator gen=new Generator(new JavaModelInputImpl(jClasses,new JavaModelImpl(Thread.currentThread().getContextClassLoader())));
    gen.generateSchemaFiles(tmpdir,null);
    SchemaFactory sFact=SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
    Schema theSchema=sFact.newSchema(new File(tmpdir + "String_Node_Str"));
    Validator validator=theSchema.newValidator();
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
  }
  assertFalse("String_Node_Str",exception == false);
}
Program: 68641
Project: 68641
Buggy source:
/** 
 * The following test expects a schema validation exception to occur. This is due to the fact that the supplied instance document does not contain a 'firstName' element, which is required as the  corresponding field in the Employee class contains the following annotation:  @XmlElement(required = true)
 * @throws Exception
 */
public void testEmployeeSchemaGenMissingRequiredElement() throws Exception {
  boolean exception=false;
  String src="String_Node_Str";
  String tmpdir=System.getenv("String_Node_Str");
  String msg="String_Node_Str";
  try {
    Class[] jClasses=new Class[]{Address.class,Employee.class,PhoneNumber.class,Department.class};
    Generator gen=new Generator(new JavaModelInputImpl(jClasses,new JavaModelImpl()));
    gen.generateSchemaFiles(tmpdir,null);
    SchemaFactory sFact=SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
    Schema theSchema=sFact.newSchema(new File(tmpdir + "String_Node_Str"));
    Validator validator=theSchema.newValidator();
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
    msg=ex.getLocalizedMessage();
  }
  assertTrue("String_Node_Str",exception);
  assertTrue("String_Node_Str" + msg,msg.contains("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * The following test expects a schema validation exception to occur. This is due to the fact that the supplied instance document does not contain a 'firstName' element, which is required as the  corresponding field in the Employee class contains the following annotation:  @XmlElement(required = true)
 * @throws Exception
 */
public void testEmployeeSchemaGenMissingRequiredElement() throws Exception {
  boolean exception=false;
  String src="String_Node_Str";
  String tmpdir=System.getenv("String_Node_Str");
  String msg="String_Node_Str";
  try {
    Class[] jClasses=new Class[]{Address.class,Employee.class,PhoneNumber.class,Department.class};
    Generator gen=new Generator(new JavaModelInputImpl(jClasses,new JavaModelImpl(Thread.currentThread().getContextClassLoader())));
    gen.generateSchemaFiles(tmpdir,null);
    SchemaFactory sFact=SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
    Schema theSchema=sFact.newSchema(new File(tmpdir + "String_Node_Str"));
    Validator validator=theSchema.newValidator();
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
    msg=ex.getLocalizedMessage();
  }
  assertTrue("String_Node_Str",exception);
  assertTrue("String_Node_Str" + msg,msg.contains("String_Node_Str"));
}