Program: 74200
Project: 74200
Buggy source:
/** 
 * test setInstanceID in DataExtractionTask with subquery structure
 * @throws Exception 
 */
public void testDataExtractionFromIID_subquery() throws Exception {
  report_design=INPUT_subquery;
  report_document=OUTPUT_subquery;
  try {
    report_document=createReportDocument(report_design,report_document);
    reportDoc=engine.openReportDocument(report_document);
    IDataExtractionTask extractTask=engine.createDataExtractionTask(reportDoc);
    ArrayList iids=findIID(report_document,"String_Node_Str");
    assertEquals(1,iids.size());
    extractTask.setInstanceID((InstanceID)iids.get(0));
    IExtractionResults result=extractTask.extract();
    if (result != null) {
      String name=null;
      IDataIterator data=result.nextResultIterator();
      if (data != null) {
        data.next();
        name=data.getValue("String_Node_Str").toString();
        assertTrue(name.equalsIgnoreCase("String_Node_Str"));
        if (data.next()) {
          name=data.getValue("String_Node_Str").toString();
          assertTrue(name.equalsIgnoreCase("String_Node_Str"));
        }
      }
      data.close();
    }
 else {
      fail();
    }
    IFilterDefinition[] filterExpression=new IFilterDefinition[1];
    filterExpression[0]=new FilterDefinition(new ConditionalExpression("String_Node_Str",ConditionalExpression.OP_EQ,"String_Node_Str",null));
    extractTask.setFilters(filterExpression);
    result=extractTask.extract();
    if (result != null) {
      String name=null;
      IDataIterator data=result.nextResultIterator();
      if (data != null) {
        data.next();
        name=data.getValue("String_Node_Str").toString();
        assertTrue(name.equalsIgnoreCase("String_Node_Str"));
      }
      data.close();
    }
 else {
      fail();
    }
    iids=findIID(report_document,"String_Node_Str");
    assertEquals(2,iids.size());
    extractTask.setInstanceID((InstanceID)iids.get(0));
    result=extractTask.extract();
    if (result != null) {
      int num=0;
      IDataIterator data=result.nextResultIterator();
      if (data != null) {
        data.next();
        num=Integer.parseInt(data.getValue("String_Node_Str").toString());
        assertEquals(103,num);
        if (data.next()) {
          num=Integer.parseInt(data.getValue("String_Node_Str").toString());
          assertEquals(112,num);
        }
      }
      data.close();
    }
 else {
      fail();
    }
    filterExpression=new IFilterDefinition[1];
    filterExpression[0]=new FilterDefinition(new ConditionalExpression("String_Node_Str",ConditionalExpression.OP_EQ,"String_Node_Str",null));
    extractTask.setFilters(filterExpression);
    result=extractTask.extract();
    if (result != null) {
      IDataIterator data=result.nextResultIterator();
      if (data != null) {
        data.next();
        assertEquals(112,data.getValue("String_Node_Str"));
      }
      data.close();
    }
 else {
      fail();
    }
    extractTask.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * test setInstanceID in DataExtractionTask with subquery structure
 * @throws Exception 
 */
public void testDataExtractionFromIID_subquery() throws Exception {
  report_design=INPUT_subquery;
  report_document=OUTPUT_subquery;
  try {
    report_document=createReportDocument(report_design,report_document);
    reportDoc=engine.openReportDocument(report_document);
    IDataExtractionTask extractTask=engine.createDataExtractionTask(reportDoc);
    ArrayList iids=findIID(report_document,"String_Node_Str");
    assertEquals(1,iids.size());
    extractTask.setInstanceID((InstanceID)iids.get(0));
    IExtractionResults result=extractTask.extract();
    if (result != null) {
      String name=null;
      IDataIterator data=result.nextResultIterator();
      if (data != null) {
        data.next();
        name=data.getValue("String_Node_Str").toString();
        assertTrue(name.equalsIgnoreCase("String_Node_Str"));
        if (data.next()) {
          name=data.getValue("String_Node_Str").toString();
          assertTrue(name.equalsIgnoreCase("String_Node_Str"));
        }
      }
      data.close();
    }
 else {
      fail();
    }
    IFilterDefinition[] filterExpression=new IFilterDefinition[1];
    filterExpression[0]=new FilterDefinition(new ConditionalExpression("String_Node_Str",ConditionalExpression.OP_EQ,"String_Node_Str",null));
    extractTask.setFilters(filterExpression);
    result=extractTask.extract();
    if (result != null) {
      String name=null;
      IDataIterator data=result.nextResultIterator();
      if (data != null) {
        data.next();
        name=data.getValue("String_Node_Str").toString();
        assertTrue(name.equalsIgnoreCase("String_Node_Str"));
      }
      data.close();
    }
 else {
      fail();
    }
    iids=findIID(report_document,"String_Node_Str");
    assertEquals(2,iids.size());
    extractTask.setInstanceID((InstanceID)iids.get(0));
    result=extractTask.extract();
    if (result != null) {
      int num=0;
      IDataIterator data=result.nextResultIterator();
      if (data != null) {
        data.next();
        num=Integer.parseInt(data.getValue("String_Node_Str").toString());
        assertEquals(103,num);
        if (data.next()) {
          num=Integer.parseInt(data.getValue("String_Node_Str").toString());
          assertEquals(112,num);
        }
      }
      data.close();
    }
 else {
      fail();
    }
    filterExpression=new IFilterDefinition[1];
    filterExpression[0]=new FilterDefinition(new ConditionalExpression("String_Node_Str",ConditionalExpression.OP_EQ,"String_Node_Str",null));
    extractTask.setFilters(filterExpression);
    result=extractTask.extract();
    if (result != null) {
      IDataIterator data=result.nextResultIterator();
      if (data != null) {
        data.next();
        assertEquals("String_Node_Str",data.getValue("String_Node_Str").toString());
      }
      data.close();
    }
 else {
      fail();
    }
    extractTask.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
    fail("String_Node_Str");
  }
}