nus-yam/ex-repair huggingface dataset:
Program: 78143
Project: 78143
Buggy source:
/** 
 * Writes the XML document to an output stream
 * @param svgDocument
 * @param outputStream
 * @throws Exception
 */
private void writeDocumentToOutputStream(Document svgDocument,OutputStream outputStream) throws Exception {
  if (svgDocument != null && outputStream != null) {
    OutputStreamWriter writer=null;
    writer=new OutputStreamWriter(outputStream,"String_Node_Str");
    DOMSource source=new DOMSource(svgDocument);
    StreamResult result=new StreamResult(writer);
    TransformerFactory transFactory=TransformerFactory.newInstance();
    Transformer transformer=transFactory.newTransformer();
    transformer.transform(source,result);
  }
}

Fixed version (ground truth):
/** 
 * Writes the XML document to an output stream
 * @param svgDocument
 * @param outputStream
 * @throws Exception
 */
private void writeDocumentToOutputStream(Document svgDocument,OutputStream outputStream) throws Exception {
  if (svgDocument != null && outputStream != null) {
    OutputStreamWriter writer=null;
    writer=new OutputStreamWriter(outputStream,"String_Node_Str");
    DOMSource source=new DOMSource(svgDocument);
    StreamResult result=new StreamResult(writer);
    checkForTransformFactoryImpl();
    TransformerFactory transFactory=TransformerFactory.newInstance();
    Transformer transformer=transFactory.newTransformer();
    transformer.transform(source,result);
  }
}
Program: 78144
Project: 78144
Buggy source:
protected void __initParameters(HttpServletRequest request) throws Exception {
  IViewerReportDesignHandle design=getDesignHandle(request);
  InputOptions options=new InputOptions();
  options.setOption(InputOptions.OPT_REQUEST,request);
  options.setOption(InputOptions.OPT_LOCALE,locale);
  Collection parameterList=this.getReportService().getParameterDefinitions(design,options,false);
  this.parameters=(HashMap)getParsedParameters(design,parameterList,request,options);
  this.missingParameter=validateParameters(parameterList,this.parameters);
}

Fixed version (ground truth):
protected void __initParameters(HttpServletRequest request) throws Exception {
  this.reportDesignHandle=getDesignHandle(request);
  InputOptions options=new InputOptions();
  options.setOption(InputOptions.OPT_REQUEST,request);
  options.setOption(InputOptions.OPT_LOCALE,locale);
  Collection parameterList=this.getReportService().getParameterDefinitions(this.reportDesignHandle,options,false);
  this.parameters=(HashMap)getParsedParameters(this.reportDesignHandle,parameterList,request,options);
  this.missingParameter=validateParameters(parameterList,this.parameters);
}
Program: 78145
Project: 78145
Buggy source:
protected IViewerReportDesignHandle getDesignHandle(HttpServletRequest request){
  IViewerReportDesignHandle design=null;
  IReportRunnable reportRunnable=null;
  IReportDocument reportDocumentInstance=ReportEngineService.getInstance().openReportDocument(this.reportDesignName,this.reportDocumentName);
  if (reportDocumentInstance != null) {
    reportRunnable=reportDocumentInstance.getReportRunnable();
    reportDocumentInstance.close();
  }
  if (reportRunnable != null) {
    design=new BirtViewerReportDesignHandle(IViewerReportDesignHandle.RPT_RUNNABLE_OBJECT,reportRunnable);
  }
 else {
    design=new BirtViewerReportDesignHandle(null,reportDesignName);
  }
  return design;
}

Fixed version (ground truth):
protected IViewerReportDesignHandle getDesignHandle(HttpServletRequest request){
  IViewerReportDesignHandle design=null;
  IReportRunnable reportRunnable=null;
  IReportDocument reportDocumentInstance=ReportEngineService.getInstance().openReportDocument(this.reportDesignName,this.reportDocumentName);
  if (reportDocumentInstance != null) {
    reportRunnable=reportDocumentInstance.getReportRunnable();
    if (IBirtConstants.SERVLET_PATH_FRAMESET.equalsIgnoreCase(request.getServletPath())) {
      this.parameterMap=reportDocumentInstance.getParameterValues();
    }
    reportDocumentInstance.close();
  }
  if (reportRunnable != null) {
    design=new BirtViewerReportDesignHandle(IViewerReportDesignHandle.RPT_RUNNABLE_OBJECT,reportRunnable);
  }
 else {
    design=new BirtViewerReportDesignHandle(null,reportDesignName);
  }
  return design;
}
Program: 78146
Project: 78146
Buggy source:
protected void __initParameters(HttpServletRequest request) throws Exception {
  IViewerReportDesignHandle design=getDesignHandle(request);
  if (isDesigner) {
    this.parseConfigVars(request);
  }
  InputOptions options=new InputOptions();
  options.setOption(InputOptions.OPT_REQUEST,request);
  options.setOption(InputOptions.OPT_LOCALE,locale);
  Collection parameterList=this.getReportService().getParameterDefinitions(design,options,false);
  this.parameters=(HashMap)getParsedParameters(design,parameterList,request,options);
  this.missingParameter=validateParameters(parameterList,this.parameters);
}

Fixed version (ground truth):
protected void __initParameters(HttpServletRequest request) throws Exception {
  this.reportDesignHandle=getDesignHandle(request);
  if (isDesigner) {
    this.parseConfigVars(request);
  }
  InputOptions options=new InputOptions();
  options.setOption(InputOptions.OPT_REQUEST,request);
  options.setOption(InputOptions.OPT_LOCALE,locale);
  Collection parameterList=this.getReportService().getParameterDefinitions(reportDesignHandle,options,false);
  this.parameters=(HashMap)getParsedParameters(reportDesignHandle,parameterList,request,options);
  this.missingParameter=validateParameters(parameterList,this.parameters);
}
Program: 78147
Project: 78147
Buggy source:
/** 
 * parse paramenters from config file.
 * @param request
 * @return
 */
protected void parseConfigVars(HttpServletRequest request){
  String reportConfigName=this.reportDesignName.replaceFirst(IBirtConstants.SUFFIX_DESIGN_FILE,IBirtConstants.SUFFIX_DESIGN_CONFIG);
  SessionHandle sessionHandle=DesignEngine.newSession(ULocale.getDefault());
  ReportDesignHandle handle=null;
  try {
    this.configMap=new HashMap();
    handle=sessionHandle.openDesign(reportConfigName);
    Iterator configVars=handle.configVariablesIterator();
    while (configVars.hasNext()) {
      ConfigVariableHandle configVar=(ConfigVariableHandle)configVars.next();
      if (configVar != null && configVar.getName() != null) {
        this.configMap.put(configVar.getName(),configVar.getValue());
      }
    }
    handle.close();
  }
 catch (  Exception e) {
    try {
      handle.close();
    }
 catch (    Exception err) {
    }
  }
}

Fixed version (ground truth):
/** 
 * parse paramenters from config file.
 * @param request
 * @return
 */
protected void parseConfigVars(HttpServletRequest request){
  String reportConfigName=this.reportDesignName.replaceFirst(IBirtConstants.SUFFIX_DESIGN_FILE,IBirtConstants.SUFFIX_DESIGN_CONFIG);
  SessionHandle sessionHandle=DesignEngine.newSession(ULocale.getDefault());
  ReportDesignHandle handle=null;
  try {
    this.configMap=new HashMap();
    handle=sessionHandle.openDesign(reportConfigName);
    if (handle != null) {
      Iterator configVars=handle.configVariablesIterator();
      while (configVars != null && configVars.hasNext()) {
        ConfigVariableHandle configVar=(ConfigVariableHandle)configVars.next();
        if (configVar != null && configVar.getName() != null) {
          this.configMap.put(configVar.getName(),configVar.getValue());
        }
      }
      handle.close();
    }
  }
 catch (  Exception e) {
    try {
      if (handle != null)       handle.close();
    }
 catch (    Exception err) {
    }
  }
}
Program: 78148
Project: 78148
Buggy source:
/** 
 * get parameter object.
 * @param request
 * @param parameterObj
 * @exception Throwable
 * @return
 */
protected Object getParamValueObject(HttpServletRequest request,ParameterDefinition parameterObj) throws ReportServiceException {
  String paramName=parameterObj.getName();
  String format=parameterObj.getDisplayFormat();
  Object paramValueObj=super.getParamValueObject(request,parameterObj);
  if (paramValueObj != null)   return paramValueObj;
  IReportRunnable runnable;
  try {
    runnable=ReportEngineService.getInstance().openReportDesign(reportDesignName);
  }
 catch (  EngineException e) {
    throw new ReportServiceException(e.getLocalizedMessage());
  }
  Map configMap=runnable.getTestConfig();
  if (ParameterAccessor.isDesigner(request) && configMap.containsKey(paramName)) {
    String configValue=(String)configMap.get(paramName);
    ReportParameterConverter cfgConverter=new ReportParameterConverter(format,Locale.US);
    return cfgConverter.parse(configValue,parameterObj.getDataType());
  }
 else   return super.getParamValueObject(request,parameterObj);
}

Fixed version (ground truth):
/** 
 * get parameter object.
 * @param request
 * @param parameterObj
 * @exception Throwable
 * @return
 */
protected Object getParamValueObject(HttpServletRequest request,ParameterDefinition parameterObj) throws ReportServiceException {
  String paramName=parameterObj.getName();
  String format=parameterObj.getDisplayFormat();
  Object paramValueObj=super.getParamValueObject(request,parameterObj);
  if (paramValueObj != null)   return paramValueObj;
  if (ParameterAccessor.isDesigner(request) && this.configMap != null && this.configMap.containsKey(paramName)) {
    paramValueObj=this.configMap.get(paramName);
  }
 else   if (this.parameterMap != null && this.parameterMap.containsKey(paramName)) {
    paramValueObj=this.parameterMap.get(paramName);
  }
  if (paramValueObj != null) {
    ReportParameterConverter cfgConverter=new ReportParameterConverter(format,Locale.US);
    return cfgConverter.parse(paramValueObj.toString(),parameterObj.getDataType());
  }
 else {
    return super.getParamValueObject(request,parameterObj);
  }
}
Program: 78149
Project: 78149
Buggy source:
protected void doService(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
  Collection fragments=new ArrayList();
  IViewerReportService service=getReportService();
  String reportDesignName=ParameterAccessor.getReport(request);
  Collection parameters=null;
  InputOptions options=new InputOptions();
  options.setOption(InputOptions.OPT_REQUEST,request);
  IViewerReportDesignHandle design=new BirtViewerReportDesignHandle(null,reportDesignName);
  try {
    parameters=service.getParameterDefinitions(design,options,true);
  }
 catch (  ReportServiceException e) {
    e.printStackTrace();
  }
  if (parameters != null) {
    Iterator iParameters=parameters.iterator();
    while (iParameters != null && iParameters.hasNext()) {
      Object parameter=iParameters.next();
      if (parameter == null) {
        continue;
      }
      IFragment fragment=null;
      if (parameter instanceof ParameterGroupDefinition) {
        fragment=new ParameterGroupFragment((ParameterGroupDefinition)parameter);
      }
 else       if (parameter instanceof ParameterDefinition) {
        ParameterDefinition scalarParameter=(ParameterDefinition)parameter;
        if (!scalarParameter.isHidden()) {
switch (scalarParameter.getControlType()) {
case ParameterDefinition.TEXT_BOX:
{
              fragment=new TextBoxParameterFragment(scalarParameter);
              break;
            }
case ParameterDefinition.LIST_BOX:
{
            fragment=new ComboBoxParameterFragment(scalarParameter);
            break;
          }
case ParameterDefinition.RADIO_BUTTON:
{
          fragment=new RadioButtonParameterFragment(scalarParameter);
          break;
        }
case ParameterDefinition.CHECK_BOX:
{
        fragment=new CheckboxParameterFragment(scalarParameter);
        break;
      }
  }
}
}
if (fragment != null) {
fragment.setJSPRootPath(JSPRootPath);
fragments.add(fragment);
}
}
}
request.setAttribute("String_Node_Str",fragments);
}

Fixed version (ground truth):
protected void doService(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
}
Program: 78150
Project: 78150
Buggy source:
protected void prepareParameterBean(HttpServletRequest request,IViewerReportService service,ScalarParameterBean parameterBean,Locale locale) throws ReportServiceException {
  String reportDesignName=ParameterAccessor.getReport(request);
  ViewerAttributeBean attrBean=(ViewerAttributeBean)request.getAttribute("String_Node_Str");
  IViewerReportDesignHandle design=new BirtViewerReportDesignHandle(null,reportDesignName);
  InputOptions options=new InputOptions();
  options.setOption(InputOptions.OPT_REQUEST,request);
  Collection selectionList=null;
  ParameterDefinition paramDef=parameterBean.getParameter();
  if (paramDef.getGroup() != null && paramDef.getGroup().cascade()) {
    Map paramValues=attrBean.getParameters();
    selectionList=getParameterSelectionListForCascadingGroup(design,service,paramValues);
  }
 else   selectionList=service.getParameterSelectionList(design,options,parameter.getName());
  parameterBean.setValueInList(false);
  if (selectionList != null) {
    ReportParameterConverter converter=new ReportParameterConverter(parameter.getPattern(),locale);
    for (Iterator iter=selectionList.iterator(); iter.hasNext(); ) {
      ParameterSelectionChoice selectionItem=(ParameterSelectionChoice)iter.next();
      String value=converter.format(selectionItem.getValue());
      String label=selectionItem.getLabel();
      label=(label == null || label.length() <= 0) ? value : label;
      label=ParameterAccessor.htmlEncode(label);
      if (label != null) {
        parameterBean.getSelectionList().add(label);
        parameterBean.getSelectionTable().put(label,value);
      }
      if (value != null && value.equals(parameterBean.getValue())) {
        parameterBean.setValueInList(true);
      }
    }
  }
}

Fixed version (ground truth):
protected void prepareParameterBean(HttpServletRequest request,IViewerReportService service,ScalarParameterBean parameterBean,Locale locale) throws ReportServiceException {
}
Program: 78151
Project: 78151
Buggy source:
protected void prepareParameterBean(HttpServletRequest request,IViewerReportService service,ScalarParameterBean parameterBean,Locale locale) throws ReportServiceException {
  String reportDesignName=ParameterAccessor.getReport(request);
  IViewerReportDesignHandle designHandle=new BirtViewerReportDesignHandle(null,reportDesignName);
  InputOptions options=new InputOptions();
  options.setOption(InputOptions.OPT_REQUEST,request);
  Collection selectionList=service.getParameterSelectionList(designHandle,options,parameterBean.getName());
  if (selectionList != null) {
    ReportParameterConverter converter=new ReportParameterConverter(parameter.getPattern(),locale);
    for (Iterator iter=selectionList.iterator(); iter.hasNext(); ) {
      ParameterSelectionChoice selectionItem=(ParameterSelectionChoice)iter.next();
      String value=converter.format(selectionItem.getValue());
      String label=selectionItem.getLabel();
      label=(label == null || label.length() <= 0) ? value : label;
      label=ParameterAccessor.htmlEncode(label);
      parameterBean.getSelectionList().add(label);
      parameterBean.getSelectionTable().put(label,value);
    }
  }
}

Fixed version (ground truth):
protected void prepareParameterBean(HttpServletRequest request,IViewerReportService service,ScalarParameterBean parameterBean,Locale locale) throws ReportServiceException {
}
Program: 78152
Project: 78152
Buggy source:
public boolean onBroughtToTop(IReportEditorPage prePage){
  boolean isDisplay=false;
  if (getEditorInput() != prePage.getEditorInput()) {
    setInput(prePage.getEditorInput());
  }
  if (prePage.isDirty()) {
    prePage.doSave(null);
  }
  if (isMissingParameter()) {
    if (parameterDialog != null) {
      parameterDialog.open();
      if (parameterDialog.getReturnCode() == InputParameterHtmlDialog.RETURN_CODE_BROWSER_CLOSED) {
        isDisplay=true;
      }
    }
  }
 else {
    isDisplay=true;
  }
  if (isDisplay) {
    display();
  }
  return true;
}

Fixed version (ground truth):
public boolean onBroughtToTop(IReportEditorPage prePage){
  boolean isDisplay=false;
  if (getEditorInput() != prePage.getEditorInput()) {
    setInput(prePage.getEditorInput());
  }
  if (prePage.isDirty()) {
    prePage.doSave(null);
  }
  if (isMissingParameter()) {
    if (parameterDialog != null) {
      parameterDialog.open();
      if (parameterDialog.getReturnCode() == InputParameterHtmlDialog.RETURN_CODE_BROWSER_CLOSED) {
        isDisplay=true;
        if (isMissingParameter()) {
          editor.setActivePage(prePage.getId());
          return false;
        }
      }
    }
  }
 else {
    isDisplay=true;
  }
  if (isDisplay) {
    display();
  }
  return true;
}
Program: 78153
Project: 78153
Buggy source:
private final boolean isValidPrecedingCharacter(int iCh){
  return (iCh == ' ' || iCh == '\r' || iCh == '\n');
}

Fixed version (ground truth):
private final boolean isValidPrecedingCharacter(int iCh){
  return (iCh == ' ' || iCh == '\t' || iCh == '\r' || iCh == '\n');
}
Program: 78154
Project: 78154
Buggy source:
public AbstractContent(IContent content){
  this(content.getReportContent());
  this.name=content.getName();
  this.bounds=content.getBounds();
  this.x=content.getX();
  this.y=content.getY();
  this.width=content.getWidth();
  this.height=content.getHeight();
  this.hyperlink=content.getHyperlinkAction();
  this.bookmark=content.getBookmark();
  this.helpText=content.getHelpText();
  this.inlineStyle=content.getInlineStyle();
  this.generateBy=content.getGenerateBy();
  this.styleClass=content.getStyleClass();
  this.instanceId=content.getInstanceID();
  this.toc=content.getTOC();
}

Fixed version (ground truth):
public AbstractContent(IContent content){
  this(content.getReportContent());
  this.name=content.getName();
  this.x=content.getX();
  this.y=content.getY();
  this.width=content.getWidth();
  this.height=content.getHeight();
  this.hyperlink=content.getHyperlinkAction();
  this.bookmark=content.getBookmark();
  this.helpText=content.getHelpText();
  this.inlineStyle=content.getInlineStyle();
  this.generateBy=content.getGenerateBy();
  this.styleClass=content.getStyleClass();
  this.instanceId=content.getInstanceID();
  this.toc=content.getTOC();
}
Program: 78155
Project: 78155
Buggy source:
/** 
 * @return the width of the report item
 */
public DimensionType getWidth(){
  return width;
}

Fixed version (ground truth):
/** 
 * @return the width of the report item
 */
public DimensionType getWidth(){
  if (width != null) {
    return width;
  }
  if (generateBy instanceof ReportItemDesign) {
    return ((ReportItemDesign)generateBy).getWidth();
  }
  return null;
}
Program: 78156
Project: 78156
Buggy source:
/** 
 * @return the height of the report item
 */
public DimensionType getHeight(){
  return height;
}

Fixed version (ground truth):
/** 
 * @return the height of the report item
 */
public DimensionType getHeight(){
  if (height != null) {
    return height;
  }
  if (generateBy instanceof ReportItemDesign) {
    return ((ReportItemDesign)generateBy).getHeight();
  }
  return null;
}
Program: 78157
Project: 78157
Buggy source:
/** 
 * @return the x position of the repor titem.
 */
public DimensionType getX(){
  return x;
}

Fixed version (ground truth):
/** 
 * @return the x position of the repor titem.
 */
public DimensionType getX(){
  if (x != null) {
    return x;
  }
  if (generateBy instanceof ReportItemDesign) {
    return ((ReportItemDesign)generateBy).getX();
  }
  return null;
}
Program: 78158
Project: 78158
Buggy source:
/** 
 * @return Returns the y position of the repor titem.
 */
public DimensionType getY(){
  return y;
}

Fixed version (ground truth):
/** 
 * @return Returns the y position of the repor titem.
 */
public DimensionType getY(){
  if (y != null) {
    return y;
  }
  if (generateBy instanceof ReportItemDesign) {
    return ((ReportItemDesign)generateBy).getY();
  }
  return null;
}
Program: 78159
Project: 78159
Buggy source:
protected IResultSet doExecuteQuery(DteResultSet parentResult,IQueryDefinition query){
  String queryID=(String)queryIDMap.get(query);
  try {
    IQueryResults parentQueryResults=null;
    if (parentResult != null) {
      parentQueryResults=parentResult.getQueryResults();
    }
    String resultSetID=null;
    if (parentQueryResults == null) {
      resultSetID=getResultID(null,-1,queryID);
    }
 else {
      String pRsetId=parentQueryResults.getID();
      long rowid=parentResult.getRawID();
      resultSetID=getResultID(pRsetId,rowid,queryID);
    }
    if (resultSetID == null) {
      logger.log(Level.SEVERE,"String_Node_Str");
      return null;
    }
    ((QueryDefinition)query).setQueryResultsID(resultSetID);
    IPreparedQuery pQuery=dteEngine.prepare(query);
    Scriptable scope=context.getSharedScope();
    IQueryResults dteResults;
    if (parentQueryResults == null) {
      dteResults=pQuery.execute(scope);
    }
 else {
      dteResults=pQuery.execute(parentQueryResults,scope);
    }
    DteResultSet resultSet=new DteResultSet(dteResults.getID(),dteResults.getResultIterator(),this,context);
    rsets.addFirst(resultSet);
    return resultSet;
  }
 catch (  BirtException be) {
    logger.log(Level.SEVERE,be.getMessage());
    context.addException(be);
    return null;
  }
}

Fixed version (ground truth):
protected IResultSet doExecuteQuery(DteResultSet parentResult,IQueryDefinition query){
  String queryID=(String)queryIDMap.get(query);
  try {
    IQueryResults parentQueryResults=null;
    if (parentResult != null) {
      parentQueryResults=parentResult.getQueryResults();
    }
    String resultSetID=null;
    if (parentQueryResults == null) {
      resultSetID=getResultID(null,-1,queryID);
    }
 else {
      String pRsetId=parentQueryResults.getID();
      long rowid=parentResult.getRawID();
      resultSetID=getResultID(pRsetId,rowid,queryID);
    }
    if (resultSetID == null) {
      logger.log(Level.SEVERE,"String_Node_Str");
      return null;
    }
    ((QueryDefinition)query).setQueryResultsID(resultSetID);
    IPreparedQuery pQuery=dteEngine.prepare(query);
    Scriptable scope=context.getSharedScope();
    IQueryResults dteResults;
    if (parentQueryResults == null) {
      dteResults=pQuery.execute(scope);
    }
 else {
      dteResults=pQuery.execute(parentQueryResults,scope);
    }
    DataSetID dataSetId=new DataSetID(dteResults.getID());
    DteResultSet resultSet=new DteResultSet(dataSetId,parentResult,dteResults.getResultIterator(),this,context);
    rsets.addFirst(resultSet);
    return resultSet;
  }
 catch (  BirtException be) {
    logger.log(Level.SEVERE,be.getMessage());
    context.addException(be);
    return null;
  }
}
Program: 78160
Project: 78160
Buggy source:
protected IResultSet doExecuteQuery(DteResultSet parentResult,IQueryDefinition query){
  String queryID=(String)queryIDMap.get(query);
  try {
    IQueryResults queryResults=null;
    if (parentResult != null) {
      queryResults=parentResult.getQueryResults();
    }
    String resultSetID=null;
    if (queryResults == null) {
      resultSetID=getResultID(null,-1,queryID);
    }
 else {
      String pRsetId=queryResults.getID();
      long rowid=parentResult.getCurrentPosition();
      resultSetID=getResultID(pRsetId,rowid,queryID);
    }
    if (resultSetID == null) {
      logger.log(Level.SEVERE,"String_Node_Str");
      return null;
    }
    queryResults=dteEngine.getQueryResults(resultSetID);
    DteResultSet resultSet=new DteResultSet(queryResults.getID(),queryResults.getResultIterator(),this,context);
    rsets.addFirst(resultSet);
    return resultSet;
  }
 catch (  BirtException be) {
    logger.log(Level.SEVERE,be.getMessage());
    context.addException(be);
    return null;
  }
}

Fixed version (ground truth):
protected IResultSet doExecuteQuery(DteResultSet parentResult,IQueryDefinition query){
  String queryID=(String)queryIDMap.get(query);
  try {
    IQueryResults queryResults=null;
    if (parentResult != null) {
      queryResults=parentResult.getQueryResults();
    }
    String resultSetID=null;
    if (queryResults == null) {
      resultSetID=getResultID(null,-1,queryID);
    }
 else {
      String pRsetId=queryResults.getID();
      long rowid=parentResult.getCurrentPosition();
      resultSetID=getResultID(pRsetId,rowid,queryID);
    }
    if (resultSetID == null) {
      logger.log(Level.SEVERE,"String_Node_Str");
      return null;
    }
    queryResults=dteEngine.getQueryResults(resultSetID);
    DataSetID dataSetId=new DataSetID(queryResults.getID());
    DteResultSet resultSet=new DteResultSet(dataSetId,parentResult,queryResults.getResultIterator(),this,context);
    rsets.addFirst(resultSet);
    return resultSet;
  }
 catch (  BirtException be) {
    logger.log(Level.SEVERE,be.getMessage());
    context.addException(be);
    return null;
  }
}
Program: 78161
Project: 78161
Buggy source:
protected IResultSet doExecuteQuery(DteResultSet resultSet,IQueryDefinition query){
  IPreparedQuery pQuery=(IPreparedQuery)queryMap.get(query);
  if (pQuery == null) {
    return null;
  }
  try {
    Scriptable scope=context.getSharedScope();
    IQueryResults dteResults;
    if (resultSet == null) {
      dteResults=pQuery.execute(scope);
    }
 else {
      dteResults=pQuery.execute(resultSet.getQueryResults(),scope);
    }
    resultSet=new DteResultSet(dteResults.getID(),dteResults.getResultIterator(),this,context);
    rsets.addFirst(resultSet);
    return resultSet;
  }
 catch (  BirtException be) {
    logger.log(Level.SEVERE,be.getMessage());
    context.addException(be);
  }
  return null;
}

Fixed version (ground truth):
protected IResultSet doExecuteQuery(DteResultSet resultSet,IQueryDefinition query){
  IPreparedQuery pQuery=(IPreparedQuery)queryMap.get(query);
  if (pQuery == null) {
    return null;
  }
  try {
    Scriptable scope=context.getSharedScope();
    IQueryResults dteResults;
    if (resultSet == null) {
      dteResults=pQuery.execute(scope);
    }
 else {
      dteResults=pQuery.execute(resultSet.getQueryResults(),scope);
    }
    DataSetID dataSetId=new DataSetID(dteResults.getID());
    resultSet=new DteResultSet(dataSetId,resultSet,dteResults.getResultIterator(),this,context);
    rsets.addFirst(resultSet);
    return resultSet;
  }
 catch (  BirtException be) {
    logger.log(Level.SEVERE,be.getMessage());
    context.addException(be);
  }
  return null;
}
Program: 78163
Project: 78163
Buggy source:
/** 
 * @return
 * @throws DataException
 */
private RDSave getRdSave() throws DataException {
  if (rdSave == null) {
    rdSave=RDUtil.newSave(this.context,this.queryDefn,this.queryResultID,1,null,-1);
  }
  return rdSave;
}

Fixed version (ground truth):
/** 
 * @return
 * @throws DataException
 */
private RDSave getRdSave() throws DataException {
  if (rdSave == null) {
    rdSave=RDUtil.newSave(this.context,this.queryDefn != null ? this.queryDefn : subQueryDefn,this.queryResultID,1,subQueryName,subQueryIndex);
  }
  return rdSave;
}
Program: 78164
Project: 78164
Buggy source:
/** 
 * @param name
 * @param value
 * @throws DataException
 */
void doSaveExpr(String name,Object value) throws DataException {
  if (needsSaveToDoc() == false)   return;
  if (isBasicSaved == false) {
    isBasicSaved=true;
    this.getRdSave().saveResultIterator(new DummyCachedResult(),-1,null);
  }
  this.getRdSave().saveExprValue(0,name,value);
}

Fixed version (ground truth):
/** 
 * @param name
 * @param value
 * @throws DataException
 */
void doSaveExpr(String name,Object value) throws DataException {
  if (needsSaveToDoc() == false)   return;
  if (isBasicSaved == false) {
    isBasicSaved=true;
    int groupLevel;
    int[] subQueryInfo;
    if (subQueryName == null) {
      groupLevel=-1;
      subQueryInfo=null;
    }
 else {
      groupLevel=1;
      subQueryInfo=new int[]{0,1};
    }
    this.getRdSave().saveResultIterator(new DummyCachedResult(),groupLevel,subQueryInfo);
  }
  this.getRdSave().saveExprValue(0,name,value);
}
Program: 78165
Project: 78165
Buggy source:
public IResultIterator getSecondaryIterator(String subQueryName,Scriptable scope) throws BirtException {
  this.checkOpened();
  return queryResults.preparedQuery.execSubQuery(subQueryName,scope != null ? scope : queryScope,this.jsDummyRowObject);
}

Fixed version (ground truth):
public IResultIterator getSecondaryIterator(String subQueryName,Scriptable scope) throws BirtException {
  this.checkOpened();
  return queryResults.preparedQuery.execSubQuery(getQueryResultsID(),subQueryName,scope != null ? scope : queryScope,this.jsDummyRowObject);
}
Program: 78166
Project: 78166
Buggy source:
public void doSave(OutputStream resultClassStream,OutputStream dataSetDataStream,OutputStream groupInfoStream,boolean isSubQuery) throws DataException {
  try {
    IOUtil.writeInt(resultClassStream,0);
    if (dataSetDataStream != null)     IOUtil.writeInt(dataSetDataStream,0);
    IOUtil.writeInt(groupInfoStream,0);
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e,"String_Node_Str");
  }
}

Fixed version (ground truth):
public void doSave(OutputStream resultClassStream,OutputStream dataSetDataStream,OutputStream groupInfoStream,boolean isSubQuery) throws DataException {
  try {
    if (resultClassStream != null)     IOUtil.writeInt(resultClassStream,0);
    if (dataSetDataStream != null)     IOUtil.writeInt(dataSetDataStream,0);
    IOUtil.writeInt(groupInfoStream,0);
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e,"String_Node_Str");
  }
}
Program: 78167
Project: 78167
Buggy source:
/** 
 * @return
 * @throws BirtException 
 */
private IResultIterator execSubQuery(String name,Scriptable scope,Scriptable parentScope) throws BirtException {
  Object ob=subQueryMap.get(name);
  if (ob == null)   return null;
  PreparedDummyQuery preparedQuery=new PreparedDummyQuery(context,(ISubqueryDefinition)ob,scope);
  return preparedQuery.executeQuery(scope,parentScope).getResultIterator();
}

Fixed version (ground truth):
/** 
 * @return
 * @throws BirtException 
 */
private IResultIterator execSubQuery(String parentQueryResultID,String name,Scriptable scope,Scriptable parentScope) throws BirtException {
  Object ob=subQueryMap.get(name);
  if (ob == null)   return null;
  PreparedDummyQuery preparedQuery=new PreparedDummyQuery(context,(ISubqueryDefinition)ob,scope);
  preparedQuery.subQueryName=name;
  preparedQuery.subQueryIndex=0;
  QueryResults queryResults=(QueryResults)preparedQuery.executeQuery(scope,parentScope);
  queryResults.setID(parentQueryResultID);
  return queryResults.getResultIterator();
}
Program: 78168
Project: 78168
Buggy source:
private Map getConfigVars(){
  HashMap configVars=new HashMap();
  String reportDesignName=this.getFileUri();
  String configFileName=reportDesignName.replaceFirst(IBirtPreviewConstants.SUFFIX_DESIGN_FILE,IBirtPreviewConstants.SUFFIX_DESIGN_CONFIG);
  try {
    SessionHandle sessionHandle=DesignEngine.newSession(ULocale.getDefault());
    File configFile=new File(configFileName);
    if (configFile != null && configFile.exists() && configFile.isFile()) {
      ReportDesignHandle handle=sessionHandle.openDesign(configFileName);
      Iterator it=handle.configVariablesIterator();
      while (it.hasNext()) {
        ConfigVariableHandle configVar=(ConfigVariableHandle)it.next();
        if (configVar != null && configVar.getName() != null) {
          configVars.put(configVar.getName(),configVar.getValue());
        }
      }
    }
  }
 catch (  DesignFileException e) {
    e.printStackTrace();
  }
  return configVars;
}

Fixed version (ground truth):
private Map getConfigVars(){
  HashMap configVars=new HashMap();
  String reportDesignName=this.getFileUri();
  String configFileName=reportDesignName.replaceFirst(SUFFIX_DESIGN_FILE,SUFFIX_DESIGN_CONFIG);
  try {
    SessionHandle sessionHandle=SessionHandleAdapter.getInstance().getSessionHandle();
    File configFile=new File(configFileName);
    if (configFile != null && configFile.exists() && configFile.isFile()) {
      ReportDesignHandle handle=sessionHandle.openDesign(configFileName);
      Iterator it=handle.configVariablesIterator();
      while (it.hasNext()) {
        ConfigVariableHandle configVar=(ConfigVariableHandle)it.next();
        if (configVar != null && configVar.getName() != null) {
          configVars.put(configVar.getName(),configVar.getValue());
        }
      }
    }
  }
 catch (  DesignFileException e) {
    e.printStackTrace();
  }
  return configVars;
}
Program: 78169
Project: 78169
Buggy source:
private Map getConfigVars(){
  HashMap configVars=new HashMap();
  String reportDesignName=this.getFileUri();
  String configFileName=reportDesignName.replaceFirst(IBirtConstants.SUFFIX_DESIGN_FILE,IBirtConstants.SUFFIX_DESIGN_CONFIG);
  try {
    SessionHandle sessionHandle=DesignEngine.newSession(ULocale.getDefault());
    File configFile=new File(configFileName);
    if (configFile != null && configFile.exists() && configFile.isFile()) {
      ReportDesignHandle handle=sessionHandle.openDesign(configFileName);
      Iterator it=handle.configVariablesIterator();
      while (it.hasNext()) {
        ConfigVariableHandle configVar=(ConfigVariableHandle)it.next();
        if (configVar != null && configVar.getName() != null) {
          configVars.put(configVar.getName(),configVar.getValue());
        }
      }
    }
  }
 catch (  DesignFileException e) {
    e.printStackTrace();
  }
  return configVars;
}

Fixed version (ground truth):
private Map getConfigVars(){
  HashMap configVars=new HashMap();
  String reportDesignName=this.getFileUri();
  String configFileName=reportDesignName.replaceFirst(IBirtPreviewConstants.SUFFIX_DESIGN_FILE,IBirtPreviewConstants.SUFFIX_DESIGN_CONFIG);
  try {
    SessionHandle sessionHandle=DesignEngine.newSession(ULocale.getDefault());
    File configFile=new File(configFileName);
    if (configFile != null && configFile.exists() && configFile.isFile()) {
      ReportDesignHandle handle=sessionHandle.openDesign(configFileName);
      Iterator it=handle.configVariablesIterator();
      while (it.hasNext()) {
        ConfigVariableHandle configVar=(ConfigVariableHandle)it.next();
        if (configVar != null && configVar.getName() != null) {
          configVars.put(configVar.getName(),configVar.getValue());
        }
      }
    }
  }
 catch (  DesignFileException e) {
    e.printStackTrace();
  }
  return configVars;
}
Program: 78170
Project: 78170
Buggy source:
/** 
 * Creates sorting and filter table area
 * @param parent the parent composite
 */
private void createFilterSortingArea(Composite parent){
  Group group=new Group(parent,SWT.NONE);
  group.setText(GROUP_DLG_GROUP_FILTER_SORTING);
  group.setLayout(new GridLayout());
  group.setLayoutData(new GridData(550,250));
  ArrayList list=new ArrayList(1);
  list.add(inputGroup);
  TabFolder tab=new TabFolder(group,SWT.TOP);
  tab.setLayoutData(new GridData(GridData.FILL_BOTH));
  TabItem bindingItem=new TabItem(tab,SWT.NONE);
  FormPage bindingPage=new DataSetColumnBindingsFormPage(tab,new DataSetColumnBindingsFormHandleProvider());
  bindingPage.setInput(list);
  bindingItem.setText(TAB_BINDING);
  bindingItem.setControl(bindingPage);
  TabItem filterItem=new TabItem(tab,SWT.NONE);
  FormPage filterPage=new FormPage(tab,FormPage.NORMAL_FUNCTION,new FilterHandleProvider(){
    public int[] getColumnWidths(){
      return new int[]{200,100,100,100};
    }
  }
);
  filterPage.setInput(list);
  filterItem.setText(TAB_FILTER);
  filterItem.setControl(filterPage);
  TabItem sortItem=new TabItem(tab,SWT.NONE);
  FormPage sortPage=new FormPage(tab,FormPage.NORMAL_FUNCTION,new SortingHandleProvider(){
    public int[] getColumnWidths(){
      return new int[]{200,100};
    }
  }
);
  sortPage.setInput(list);
  sortItem.setText(TAB_SORTING);
  sortItem.setControl(sortPage);
}

Fixed version (ground truth):
/** 
 * Creates sorting and filter table area
 * @param parent the parent composite
 */
private void createFilterSortingArea(Composite parent){
  Group group=new Group(parent,SWT.NONE);
  group.setText(GROUP_DLG_GROUP_FILTER_SORTING);
  group.setLayout(new GridLayout());
  group.setLayoutData(new GridData(550,250));
  ArrayList list=new ArrayList(1);
  list.add(inputGroup);
  TabFolder tab=new TabFolder(group,SWT.TOP);
  tab.setLayoutData(new GridData(GridData.FILL_BOTH));
  TabItem filterItem=new TabItem(tab,SWT.NONE);
  FormPage filterPage=new FormPage(tab,FormPage.NORMAL_FUNCTION,new FilterHandleProvider(){
    public int[] getColumnWidths(){
      return new int[]{200,100,100,100};
    }
  }
);
  filterPage.setInput(list);
  filterItem.setText(TAB_FILTER);
  filterItem.setControl(filterPage);
  TabItem sortItem=new TabItem(tab,SWT.NONE);
  FormPage sortPage=new FormPage(tab,FormPage.NORMAL_FUNCTION,new SortingHandleProvider(){
    public int[] getColumnWidths(){
      return new int[]{200,100};
    }
  }
);
  sortPage.setInput(list);
  sortItem.setText(TAB_SORTING);
  sortItem.setControl(sortPage);
}
Program: 78171
Project: 78171
Buggy source:
/** 
 * Anything before do service.
 * @param request incoming http request
 * @param response http response
 * @exception ServletException
 * @exception IOException
 */
protected void doPreService(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
  if ("String_Node_Str".equalsIgnoreCase(request.getServletPath())) {
    response.setContentType("String_Node_Str");
    response.setHeader("String_Node_Str","String_Node_Str");
  }
 else   if (ParameterAccessor.PARAM_FORMAT_PDF.equalsIgnoreCase(ParameterAccessor.getFormat(request))) {
    response.setContentType("String_Node_Str");
  }
 else {
    response.setContentType("String_Node_Str");
    response.setHeader("String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Anything before do service.
 * @param request incoming http request
 * @param response http response
 * @exception ServletException
 * @exception IOException
 */
protected void doPreService(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
  if (IBirtConstants.SERVLET_PATH_DOWNLOAD.equalsIgnoreCase(request.getServletPath())) {
    response.setContentType("String_Node_Str");
    response.setHeader("String_Node_Str","String_Node_Str");
  }
 else   if (ParameterAccessor.PARAM_FORMAT_PDF.equalsIgnoreCase(ParameterAccessor.getFormat(request))) {
    response.setContentType("String_Node_Str");
  }
 else {
    response.setContentType("String_Node_Str");
    response.setHeader("String_Node_Str","String_Node_Str");
  }
}
Program: 78172
Project: 78172
Buggy source:
/** 
 * Local initialization.
 * @return
 */
protected void __init(ServletConfig config){
  BirtReportServiceFactory.init(new BirtViewerReportService(config));
  viewer=new FramesetFragment();
  viewer.buildComposite();
  engine=new EngineFragment();
}

Fixed version (ground truth):
/** 
 * Local initialization.
 * @return
 */
protected void __init(ServletConfig config){
  BirtReportServiceFactory.init(new BirtViewerReportService(config));
  viewer=new FramesetFragment();
  viewer.buildComposite();
  engine=new EngineFragment();
  engine.buildComposite();
}
Program: 78175
Project: 78175
Buggy source:
/** 
 * initialize the pdfEmitter
 */
public void initialize(IEmitterServices services){
  this.reportRunnable=services.getReportRunnable();
  if (reportRunnable != null) {
    reportDesign=(ReportDesignHandle)reportRunnable.getDesignHandle();
  }
  Object renderContext=services.getRenderContext();
  if (renderContext != null && renderContext instanceof Map) {
    Object con=((Map)renderContext).get(EngineConstants.APPCONTEXT_PDF_RENDER_CONTEXT);
    if (con instanceof PDFRenderContext) {
      this.context=(PDFRenderContext)con;
    }
  }
  Object fd=services.getOption(RenderOptionBase.OUTPUT_FILE_NAME);
  File file=null;
  try {
    if (fd != null) {
      file=new File(fd.toString());
      output=new FileOutputStream(file);
    }
  }
 catch (  FileNotFoundException fnfe) {
    logger.log(Level.WARNING,fnfe.getMessage(),fnfe);
  }
  if (output == null) {
    Object value=services.getOption(RenderOptionBase.OUTPUT_STREAM);
    if (value != null && value instanceof OutputStream) {
      output=(OutputStream)value;
    }
 else {
      try {
        file=new File(REPORT_FILE);
        output=new FileOutputStream(file);
      }
 catch (      FileNotFoundException e) {
        logger.log(Level.SEVERE,e.getMessage(),e);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * initialize the pdfEmitter
 */
public void initialize(IEmitterServices services){
  this.reportRunnable=services.getReportRunnable();
  if (reportRunnable != null) {
    reportDesign=(ReportDesignHandle)reportRunnable.getDesignHandle();
  }
  Object renderContext=services.getRenderContext();
  if (renderContext != null && renderContext instanceof Map) {
    Object con=((Map)renderContext).get(EngineConstants.APPCONTEXT_PDF_RENDER_CONTEXT);
    if (con instanceof PDFRenderContext) {
      this.context=(PDFRenderContext)con;
    }
  }
  Object fd=services.getOption(RenderOptionBase.OUTPUT_FILE_NAME);
  File file=null;
  try {
    if (fd != null) {
      file=new File(fd.toString());
      File parent=file.getParentFile();
      if (parent != null && !parent.exists()) {
        parent.mkdirs();
      }
      output=new FileOutputStream(file);
    }
  }
 catch (  FileNotFoundException fnfe) {
    logger.log(Level.WARNING,fnfe.getMessage(),fnfe);
  }
  if (output == null) {
    Object value=services.getOption(RenderOptionBase.OUTPUT_STREAM);
    if (value != null && value instanceof OutputStream) {
      output=(OutputStream)value;
    }
 else {
      try {
        file=new File(REPORT_FILE);
        output=new FileOutputStream(file);
      }
 catch (      FileNotFoundException e) {
        logger.log(Level.SEVERE,e.getMessage(),e);
      }
    }
  }
}
Program: 78176
Project: 78176
Buggy source:
/** 
 * Executes the prepared (data) execution plan of a report item. Returns an IResultSet object <p>
 * @param the query to be executed
 * @return IResultSet object or null if the query is null
 */
IResultSet execute(IBaseQueryDefinition query);

Fixed version (ground truth):
/** 
 * execute the query in the parent result
 * @param parent parent result set.
 * @param query query to be executed
 * @return result.
 */
IResultSet execute(IResultSet parent,IBaseQueryDefinition query);
Program: 78177
Project: 78177
Buggy source:
abstract protected IResultSet doExecuteQuery(IBaseQueryDefinition query);

Fixed version (ground truth):
abstract protected IResultSet doExecuteQuery(DteResultSet parent,IBaseQueryDefinition query);
Program: 78178
Project: 78178
Buggy source:
/** 
 */
public IResultSet execute(IBaseQueryDefinition query){
  if (query instanceof IQueryDefinition) {
    return doExecuteQuery(query);
  }
 else   if (query instanceof ISubqueryDefinition) {
    return doExecuteSubQuery(query);
  }
  return null;
}

Fixed version (ground truth):
/** 
 */
public IResultSet execute(IResultSet parent,IBaseQueryDefinition query){
  if (query instanceof IQueryDefinition) {
    return doExecuteQuery((DteResultSet)parent,query);
  }
 else   if (query instanceof ISubqueryDefinition) {
    return doExecuteSubQuery((DteResultSet)parent,query);
  }
  return null;
}
Program: 78179
Project: 78179
Buggy source:
/** 
 * get the sub query result from the current query.
 * @param query
 * @return
 */
protected IResultSet doExecuteSubQuery(IBaseQueryDefinition query){
}

Fixed version (ground truth):
/** 
 * get the sub query result from the current query.
 * @param query
 * @return
 */
protected IResultSet doExecuteSubQuery(DteResultSet parent,IBaseQueryDefinition query){
}
Program: 78180
Project: 78180
Buggy source:
protected IResultSet doExecuteQuery(IBaseQueryDefinition query){
}

Fixed version (ground truth):
protected IResultSet doExecuteQuery(DteResultSet resultSet,IBaseQueryDefinition query){
}
Program: 78181
Project: 78181
Buggy source:
protected IResultSet doExecuteQuery(IBaseQueryDefinition query){
}

Fixed version (ground truth):
protected IResultSet doExecuteQuery(DteResultSet parentResult,IBaseQueryDefinition query){
}
Program: 78182
Project: 78182
Buggy source:
protected IResultSet doExecuteQuery(IBaseQueryDefinition query){
}

Fixed version (ground truth):
protected IResultSet doExecuteQuery(DteResultSet resultSet,IBaseQueryDefinition query){
}
Program: 78183
Project: 78183
Buggy source:
protected void generateContent(ExtendedItemDesign item,IForeignContent content){
  ExtendedItemHandle handle=(ExtendedItemHandle)item.getHandle();
  String tagName=handle.getExtensionName();
  String name=item.getName();
  IReportItemGeneration itemGeneration=ExtensionManager.getInstance().createGenerationItem(tagName);
  byte[] generationStatus=null;
  if (itemGeneration != null) {
    itemGeneration.setModelObject(handle);
    itemGeneration.setScriptContext(context.getReportContext());
    itemGeneration.setReportQueries(((ExtendedItemDesign)item).getQueries());
    IRowSet[] rowSets=executeQueries(item);
    try {
      if (rowSets != null) {
        itemGeneration.onRowSets(rowSets);
      }
      if (itemGeneration.needSerialization()) {
        ByteArrayOutputStream out=new ByteArrayOutputStream();
        itemGeneration.serialize(out);
        generationStatus=out.toByteArray();
      }
      itemGeneration.finish();
    }
 catch (    BirtException ex) {
      logger.log(Level.SEVERE,ex.getMessage(),ex);
      context.addException(new EngineException(MessageConstants.EXTENDED_ITEM_GENERATION_ERROR,handle.getExtensionName() + (name != null ? "String_Node_Str" + name : "String_Node_Str"),ex));
    }
    closeQueries(rowSets);
  }
  content.setRawType(IForeignContent.EXTERNAL_TYPE);
  content.setRawValue(generationStatus);
}

Fixed version (ground truth):
protected void generateContent(ExtendedItemDesign item,IForeignContent content){
  ExtendedItemHandle handle=(ExtendedItemHandle)item.getHandle();
  String tagName=handle.getExtensionName();
  String name=item.getName();
  IReportItemGeneration itemGeneration=ExtensionManager.getInstance().createGenerationItem(tagName);
  byte[] generationStatus=null;
  if (itemGeneration != null) {
    itemGeneration.setModelObject(handle);
    itemGeneration.setScriptContext(context.getReportContext());
    IBaseQueryDefinition[] queries=((ExtendedItemDesign)item).getQueries();
    if (queries == null) {
      if (item.getQuery() != null) {
        queries=new IBaseQueryDefinition[]{item.getQuery()};
      }
    }
    itemGeneration.setReportQueries(queries);
    IRowSet[] rowSets=executeQueries(item);
    try {
      if (rowSets != null) {
        itemGeneration.onRowSets(rowSets);
      }
      if (itemGeneration.needSerialization()) {
        ByteArrayOutputStream out=new ByteArrayOutputStream();
        itemGeneration.serialize(out);
        generationStatus=out.toByteArray();
      }
      itemGeneration.finish();
    }
 catch (    BirtException ex) {
      logger.log(Level.SEVERE,ex.getMessage(),ex);
      context.addException(new EngineException(MessageConstants.EXTENDED_ITEM_GENERATION_ERROR,handle.getExtensionName() + (name != null ? "String_Node_Str" + name : "String_Node_Str"),ex));
    }
    closeQueries(rowSets);
  }
  content.setRawType(IForeignContent.EXTERNAL_TYPE);
  content.setRawValue(generationStatus);
}
Program: 78184
Project: 78184
Buggy source:
protected void closeQuery(IContent content){
  Object generateBy=content.getGenerateBy();
  if (generateBy instanceof ReportItemDesign) {
    if (!(generateBy instanceof ExtendedItemDesign)) {
      ReportItemDesign design=(ReportItemDesign)generateBy;
      IBaseQueryDefinition query=design.getQuery();
      if (query != null) {
        IResultSet rset=(IResultSet)resultSets.pop();
        if (rset != null) {
          rset.close();
        }
      }
    }
  }
}

Fixed version (ground truth):
protected void closeQuery(IContent content){
  Object generateBy=content.getGenerateBy();
  if (generateBy instanceof ReportItemDesign) {
    ReportItemDesign design=(ReportItemDesign)generateBy;
    IBaseQueryDefinition query=design.getQuery();
    if (query != null) {
      IResultSet rset=(IResultSet)resultSets.pop();
      if (rset != null) {
        rset.close();
      }
    }
  }
}