nus-yam/ex-repair huggingface dataset:
Program: 77766
Project: 77766
Buggy source:
/** 
 * Initial the parameters class. Web.xml is in UTF-8 format. No need to do encoding convertion.
 * @param config Servlet configuration
 */
public synchronized static void initParameters(ServletConfig config){
  ServletContext context=config.getServletContext();
  workingFolder=context.getInitParameter(INIT_PARAM_REPORT_DIR);
  if (workingFolder == null || workingFolder.trim().length() <= 0) {
    workingFolder=context.getRealPath("String_Node_Str");
  }
  if (workingFolder != null && workingFolder.trim().endsWith(File.separator)) {
    workingFolder=workingFolder.trim().substring(0,workingFolder.trim().length() - 1);
  }
  webAppLocale=getLocaleFromString(context.getInitParameter(INIT_PARAM_LOCALE));
  if (webAppLocale == null)   webAppLocale=Locale.getDefault();
  isWorkingFolderAccessOnly=Boolean.valueOf(context.getInitParameter(INIT_PARAM_WORKING_FOLDER_ACCESS_ONLY)).booleanValue();
  String s_maxRows=context.getInitParameter(INIT_PARAM_VIEWER_MAXROWS);
  try {
    maxRows=Integer.valueOf(s_maxRows).intValue();
  }
 catch (  NumberFormatException e) {
    maxRows=-1;
  }
  clearDocuments();
}

Fixed version (ground truth):
/** 
 * Initial the parameters class. Web.xml is in UTF-8 format. No need to do encoding convertion.
 * @param context Servlet Context
 */
public synchronized static void initParameters(ServletContext context){
  workingFolder=context.getInitParameter(INIT_PARAM_REPORT_DIR);
  if (workingFolder == null || workingFolder.trim().length() <= 0) {
    workingFolder=context.getRealPath("String_Node_Str");
  }
  if (workingFolder != null && workingFolder.trim().endsWith(File.separator)) {
    workingFolder=workingFolder.trim().substring(0,workingFolder.trim().length() - 1);
  }
  webAppLocale=getLocaleFromString(context.getInitParameter(INIT_PARAM_LOCALE));
  if (webAppLocale == null)   webAppLocale=Locale.getDefault();
  isWorkingFolderAccessOnly=Boolean.valueOf(context.getInitParameter(INIT_PARAM_WORKING_FOLDER_ACCESS_ONLY)).booleanValue();
  String s_maxRows=context.getInitParameter(INIT_PARAM_VIEWER_MAXROWS);
  try {
    maxRows=Integer.valueOf(s_maxRows).intValue();
  }
 catch (  NumberFormatException e) {
    maxRows=-1;
  }
  clearDocuments();
}
Program: 77767
Project: 77767
Buggy source:
/** 
 * Checks if the font is bold
 * @param value			the CSSValue
 * @return				true if the font is boldfalse if not
 */
public static boolean isBoldFont(CSSValue value){
  if (value instanceof StringValue && value != null) {
    String weight=((StringValue)value).getStringValue();
    if ("String_Node_Str".equals(weight.toLowerCase()) || "String_Node_Str".equals(weight.toLowerCase()) || "String_Node_Str".equals(weight)|| "String_Node_Str".equals(weight)|| "String_Node_Str".equals(weight)|| "String_Node_Str".equals(weight)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks if the font is bold
 * @param value			the CSSValue
 * @return				true if the font is boldfalse if not
 */
public static boolean isBoldFont(CSSValue value){
  if (value != null) {
    String weight=value.getCssText();
    if ("String_Node_Str".equals(weight.toLowerCase()) || "String_Node_Str".equals(weight.toLowerCase()) || "String_Node_Str".equals(weight)|| "String_Node_Str".equals(weight)|| "String_Node_Str".equals(weight)|| "String_Node_Str".equals(weight)) {
      return true;
    }
  }
  return false;
}
Program: 77768
Project: 77768
Buggy source:
public PDFTextLM(PDFLayoutEngineContext context,PDFStackingLM parent,IContent content,IContentEmitter emitter,IReportItemExecutor executor){
  super(context,parent,content,emitter,executor);
  lineLM=(PDFLineAreaLM)getParent();
  ITextContent textContent=(ITextContent)content;
  String text=textContent.getText();
  if (!PropertyUtil.isInlineElement(content)) {
    if (text == null && "String_Node_Str".equals(text)) {
      textContent.setText("String_Node_Str");
    }
  }
  if (text != null && text.length() != 0) {
    this.textContent=textContent;
    comp=new Compositor(textContent,lineLM.getMaxAvaWidth(),this);
  }
}

Fixed version (ground truth):
public PDFTextLM(PDFLayoutEngineContext context,PDFStackingLM parent,IContent content,IContentEmitter emitter,IReportItemExecutor executor){
  super(context,parent,content,emitter,executor);
  lineLM=(PDFLineAreaLM)getParent();
  ITextContent textContent=(ITextContent)content;
  String text=textContent.getText();
  if (text != null && text.length() != 0) {
    transform(textContent);
    this.textContent=textContent;
    comp=new Compositor(textContent,lineLM.getMaxAvaWidth(),this);
  }
}
Program: 77769
Project: 77769
Buggy source:
protected boolean layoutChildren(){
  if (null == textContent)   return false;
  transform(textContent);
  pause=false;
  return comp.compose();
}

Fixed version (ground truth):
protected boolean layoutChildren(){
  if (null == textContent)   return false;
  pause=false;
  return comp.compose();
}
Program: 77770
Project: 77770
Buggy source:
private void initParamterBindings(){
  if (targetReportHandle != null) {
    bindingList.clear();
    parameterList.clear();
    String errorMessage=null;
    String newFilename=locationEditor.getText().trim();
    if (newFilename.length() == 0) {
      errorMessage=ERROR_MSG_REPORT_REQUIRED;
    }
 else {
      if (targetReportHandle instanceof ReportDesignHandle) {
        for (Iterator iter=((ReportDesignHandle)targetReportHandle).getAllParameters().iterator(); iter.hasNext(); ) {
          Object obj=iter.next();
          if (obj instanceof ParameterHandle) {
            parameterList.add(obj);
          }
 else           if (obj instanceof ParameterGroupHandle) {
            parameterList.addAll(((ParameterGroupHandle)obj).getParameters().getContents());
          }
        }
        if (newFilename.equals(inputHandle.getReportName())) {
          for (Iterator iter=inputHandle.paramBindingsIterator(); iter.hasNext(); ) {
            ParamBindingHandle handle=(ParamBindingHandle)iter.next();
            bindingList.add(handle.getStructure());
          }
        }
      }
    }
    if (errorMessage != null) {
      messageLine.setText(errorMessage);
      messageLine.setImage(ERROR_ICON);
    }
 else {
      messageLine.setText("String_Node_Str");
      messageLine.setImage(null);
    }
    paramBindingTable.refresh();
    paramBindingTable.getTable().setEnabled(!parameterList.isEmpty());
    updateButtons();
  }
}

Fixed version (ground truth):
private void initParamterBindings(){
  if (targetReportHandle != null) {
    bindingList.clear();
    parameterList.clear();
    String errorMessage=null;
    String newFilename=locationEditor.getText().trim();
    if (newFilename.length() == 0) {
      errorMessage=ERROR_MSG_REPORT_REQUIRED;
    }
 else {
      if (targetReportHandle instanceof ReportDesignHandle) {
        for (Iterator iter=((ReportDesignHandle)targetReportHandle).getAllParameters().iterator(); iter.hasNext(); ) {
          Object obj=iter.next();
          if (obj instanceof ParameterHandle) {
            parameterList.add(obj);
          }
        }
        if (newFilename.equals(inputHandle.getReportName())) {
          for (Iterator iter=inputHandle.paramBindingsIterator(); iter.hasNext(); ) {
            ParamBindingHandle handle=(ParamBindingHandle)iter.next();
            bindingList.add(handle.getStructure());
          }
        }
      }
    }
    if (errorMessage != null) {
      messageLine.setText(errorMessage);
      messageLine.setImage(ERROR_ICON);
    }
 else {
      messageLine.setText("String_Node_Str");
      messageLine.setImage(null);
    }
    paramBindingTable.refresh();
    paramBindingTable.getTable().setEnabled(!parameterList.isEmpty());
    updateButtons();
  }
}
Program: 77771
Project: 77771
Buggy source:
private List doQueryCascadeParameterSelectionList(String paramName,IViewerReportDesignHandle design,String groupName,Object[] groupKeys,InputOptions options,ViewerAttributeBean attrBean) throws RemoteException, ReportServiceException {
  List selectionList=new ArrayList();
  Collection list=getReportService().getSelectionListForCascadingGroup(design,groupName,groupKeys,options);
  if (list != null && list.size() > 0) {
    ScalarParameterHandle parameterHandle=(ScalarParameterHandle)attrBean.findParameter(paramName);
    Iterator iList=list.iterator();
    int index=0;
    while (iList != null && iList.hasNext()) {
      ParameterSelectionChoice item=(ParameterSelectionChoice)iList.next();
      if (item != null && item.getValue() != null) {
        SelectItemChoice selectItemChoice=new SelectItemChoice();
        Object value=item.getValue();
        String label=item.getLabel();
        if (label == null || label.length() <= 0) {
          label=ParameterValidationUtil.getDisplayValue(null,parameterHandle.getPattern(),value,attrBean.getLocale());
        }
        label=ParameterAccessor.htmlEncode(label);
        selectItemChoice.setLabel(label);
        selectItemChoice.setValue(ParameterValidationUtil.getDisplayValue(value));
        selectionList.add(index++,selectItemChoice);
      }
    }
  }
  return selectionList;
}

Fixed version (ground truth):
private List doQueryCascadeParameterSelectionList(String paramName,IViewerReportDesignHandle design,String groupName,Object[] groupKeys,InputOptions options,ViewerAttributeBean attrBean) throws RemoteException, ReportServiceException {
  List selectionList=new ArrayList();
  Collection list=getReportService().getSelectionListForCascadingGroup(design,groupName,groupKeys,options);
  if (list != null && list.size() > 0) {
    ScalarParameterHandle parameterHandle=(ScalarParameterHandle)attrBean.findParameter(paramName);
    Iterator iList=list.iterator();
    int index=0;
    while (iList != null && iList.hasNext()) {
      ParameterSelectionChoice item=(ParameterSelectionChoice)iList.next();
      if (item != null && item.getValue() != null) {
        SelectItemChoice selectItemChoice=new SelectItemChoice();
        Object value=item.getValue();
        String label=item.getLabel();
        if (label == null || label.length() <= 0) {
          label=ParameterValidationUtil.getDisplayValue(null,parameterHandle.getPattern(),value,attrBean.getLocale());
        }
        selectItemChoice.setLabel(label);
        selectItemChoice.setValue(ParameterValidationUtil.getDisplayValue(value));
        selectionList.add(index++,selectItemChoice);
      }
    }
  }
  return selectionList;
}
Program: 77772
Project: 77772
Buggy source:
/** 
 * Displays the specified url using eclipse SWT browser.
 * @param report report report
 * @param format report format
 * @param browser SWT browser instance
 * @param servletName servlet name to viewer report
 */
public static void display(String report,String format,Browser browser,String servletName){
  startWebApp();
  browser.setUrl(createURL(servletName,report,format,true) + "String_Node_Str" + new Random().nextInt());
}

Fixed version (ground truth):
/** 
 * Displays the specified url using eclipse SWT browser.
 * @param report report report
 * @param format report format
 * @param browser SWT browser instance
 * @param servletName servlet name to viewer report
 */
public static void display(String report,String format,Browser browser,String servletName){
  browser.setUrl(createURL(servletName,report,format,true) + "String_Node_Str" + new Random().nextInt());
}
Program: 77773
Project: 77773
Buggy source:
/** 
 * returns true if the link is a toc, otherwise, return false means that is a bookmark.
 * @param params
 * @param bean
 * @return
 */
protected boolean isToc(Oprand[] params,BaseAttributeBean bean){
  if (params != null && params.length > 0) {
    for (int i=0; i < params.length; i++) {
      if (IBirtConstants.OPRAND_TOC.equalsIgnoreCase(params[i].getName())) {
        if ("String_Node_Str".equalsIgnoreCase(params[i].getValue()))         return true;
      }
    }
  }
  return bean.isToc();
}

Fixed version (ground truth):
/** 
 * returns true if the link is a toc, otherwise, return false means that is a bookmark.
 * @param params
 * @param bean
 * @return
 */
protected boolean isToc(Oprand[] params,BaseAttributeBean bean){
  if (params != null && params.length > 0) {
    for (int i=0; i < params.length; i++) {
      if (IBirtConstants.OPRAND_BOOKMARK.equalsIgnoreCase(params[i].getName())) {
        return false;
      }
    }
  }
  return bean.isToc();
}
Program: 77775
Project: 77775
Buggy source:
public void endPage(IPageContent page){
  logger.log(Level.FINE,"String_Node_Str");
  writer.closeTag(HTMLTags.TAG_DIV);
  if (page != null) {
    if (outputMasterPageContent) {
      writer.openTag(HTMLTags.TAG_DIV);
      handlePageStyle(page.getPageFooter().getStyleClass(),page.getPageFooter().getStyle());
      contentVisitor.visitChildren(page.getPageFooter(),null);
      writer.closeTag(HTMLTags.TAG_DIV);
    }
  }
  writer.closeTag(HTMLTags.TAG_DIV);
}

Fixed version (ground truth):
public void endPage(IPageContent page){
  logger.log(Level.FINE,"String_Node_Str");
  writer.closeTag(HTMLTags.TAG_DIV);
  if (page != null) {
    if (outputMasterPageContent) {
      boolean showFooter=true;
      Object genBy=page.getGenerateBy();
      if (genBy instanceof SimpleMasterPageDesign) {
        SimpleMasterPageDesign masterPage=(SimpleMasterPageDesign)genBy;
        if (!masterPage.isShowFooterOnLast()) {
          long totalPage=page.getPageNumber();
          IReportContent report=page.getReportContent();
          if (report != null) {
            totalPage=report.getTotalPage();
          }
          if (page.getPageNumber() == totalPage) {
            showFooter=false;
          }
        }
      }
      if (showFooter) {
        writer.openTag(HTMLTags.TAG_DIV);
        handlePageStyle(page.getPageFooter().getStyleClass(),page.getPageFooter().getStyle());
        contentVisitor.visitChildren(page.getPageFooter(),null);
        writer.closeTag(HTMLTags.TAG_DIV);
      }
    }
  }
  writer.closeTag(HTMLTags.TAG_DIV);
}
Program: 77776
Project: 77776
Buggy source:
protected IContentEmitter createContentEmitter() throws EngineException {
  String format=executionContext.getOutputFormat();
  if ("String_Node_Str".equalsIgnoreCase(format)) {
    bodyOnly=false;
  }
 else {
    bodyOnly=true;
  }
  ExtensionManager extManager=ExtensionManager.getInstance();
  boolean supported=false;
  Collection supportedFormats=extManager.getSupportedFormat();
  Iterator iter=supportedFormats.iterator();
  while (iter.hasNext()) {
    String supportedFormat=(String)iter.next();
    if (supportedFormat != null && supportedFormat.equalsIgnoreCase(format)) {
      supported=true;
      break;
    }
  }
  if (!supported) {
    log.log(Level.SEVERE,MessageConstants.FORMAT_NOT_SUPPORTED_EXCEPTION,format);
    throw new EngineException(MessageConstants.FORMAT_NOT_SUPPORTED_EXCEPTION,format);
  }
  IContentEmitter emitter=extManager.createEmitter(format,emitterID);
  if (emitter == null) {
    log.log(Level.SEVERE,"String_Node_Str",format);
    throw new EngineException(MessageConstants.CANNOT_CREATE_EMITTER_EXCEPTION);
  }
  return emitter;
}

Fixed version (ground truth):
protected IContentEmitter createContentEmitter() throws EngineException {
  String format=executionContext.getOutputFormat();
  if ("String_Node_Str".equalsIgnoreCase(format)) {
    bodyOnly=false;
  }
 else {
    bodyOnly=true;
  }
  ExtensionManager extManager=ExtensionManager.getInstance();
  boolean supported=false;
  Collection supportedFormats=extManager.getSupportedFormat();
  Iterator iter=supportedFormats.iterator();
  while (iter.hasNext()) {
    String supportedFormat=(String)iter.next();
    if (supportedFormat != null && supportedFormat.equalsIgnoreCase(format)) {
      supported=true;
      break;
    }
  }
  if (!supported) {
    log.log(Level.SEVERE,MessageConstants.FORMAT_NOT_SUPPORTED_EXCEPTION,format);
    throw new EngineException(MessageConstants.FORMAT_NOT_SUPPORTED_EXCEPTION,format);
  }
  IContentEmitter emitter=extManager.createEmitter(format,emitterID);
  if (emitter == null) {
    log.log(Level.SEVERE,"String_Node_Str",format);
    throw new EngineException(MessageConstants.CANNOT_CREATE_EMITTER_EXCEPTION);
  }
  if (!bodyOnly) {
    emitter=new HTMLTableLayoutEmitter(emitter);
  }
  return emitter;
}
Program: 77777
Project: 77777
Buggy source:
public AbstractDataEngine(ExecutionContext context){
  this.context=context;
  try {
    Scriptable scope=context.getScope();
    context.registerBean("String_Node_Str",new NativeRowObject(scope,rsets));
  }
 catch (  Exception ex) {
    logger.log(Level.SEVERE,"String_Node_Str",ex);
    ex.printStackTrace();
  }
}

Fixed version (ground truth):
public AbstractDataEngine(ExecutionContext context){
  this.context=context;
  try {
    Scriptable scope=context.getScope();
    context.registerBean("String_Node_Str",new NativeRowObject(scope,context));
  }
 catch (  Exception ex) {
    logger.log(Level.SEVERE,"String_Node_Str",ex);
    ex.printStackTrace();
  }
}
Program: 77778
Project: 77778
Buggy source:
public void close(IResultSet rs){
  rsets.remove(rs);
}

Fixed version (ground truth):
public void close(IResultSet rs){
}
Program: 77779
Project: 77779
Buggy source:
public void shutdown(){
  rsets.clear();
  dteEngine.shutdown();
}

Fixed version (ground truth):
public void shutdown(){
  dteEngine.shutdown();
}
Program: 77780
Project: 77780
Buggy source:
public void shutdown(){
  rsets.clear();
  if (null != dos) {
    try {
      dos.close();
    }
 catch (    IOException e) {
    }
    dos=null;
  }
  dteEngine.shutdown();
}

Fixed version (ground truth):
public void shutdown(){
  if (null != dos) {
    try {
      dos.close();
    }
 catch (    IOException e) {
    }
    dos=null;
  }
  dteEngine.shutdown();
}
Program: 77782
Project: 77782
Buggy source:
public void shutdown(){
  rsets.clear();
  if (null != dos) {
    try {
      dos.close();
    }
 catch (    IOException e) {
    }
    dos=null;
  }
  dteEngine.shutdown();
}

Fixed version (ground truth):
public void shutdown(){
  if (null != dos) {
    try {
      dos.close();
    }
 catch (    IOException e) {
    }
    dos=null;
  }
  dteEngine.shutdown();
}
Program: 77783
Project: 77783
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=null;
    if (parentResult == null) {
      resultSet=new DteResultSet(this,context,queryResults);
    }
 else {
      resultSet=new DteResultSet(parentResult,queryResults);
    }
    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);
    DteResultSet resultSet=null;
    if (parentResult == null) {
      resultSet=new DteResultSet(this,context,queryResults);
    }
 else {
      resultSet=new DteResultSet(parentResult,queryResults);
    }
    return resultSet;
  }
 catch (  BirtException be) {
    logger.log(Level.SEVERE,be.getMessage());
    context.addException(be);
    return null;
  }
}
Program: 77784
Project: 77784
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);
      resultSet=new DteResultSet(this,context,dteResults);
    }
 else {
      dteResults=pQuery.execute(resultSet.getQueryResults(),scope);
      resultSet=new DteResultSet(resultSet,dteResults);
    }
    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);
      resultSet=new DteResultSet(this,context,dteResults);
    }
 else {
      dteResults=pQuery.execute(resultSet.getQueryResults(),scope);
      resultSet=new DteResultSet(resultSet,dteResults);
    }
    return resultSet;
  }
 catch (  BirtException be) {
    logger.log(Level.SEVERE,be.getMessage());
    context.addException(be);
  }
  return null;
}
Program: 77785
Project: 77785
Buggy source:
public IBlob getBlob(int index) throws OdaException {
  assertNotNull(rs);
  try {
    java.sql.Blob blob=rs.getBlob(index);
    return new Blob(blob);
  }
 catch (  UnsupportedOperationException e1) {
    try {
      InputStream inputStream=rs.getBinaryStream(index);
      return new Blob(SqlBlobUtil.newBlob(inputStream));
    }
 catch (    SQLException e2) {
      throw new JDBCException(ResourceConstants.RESULTSET_CANNOT_GET_BLOB_VALUE,e2);
    }
  }
catch (  SQLException e) {
    throw new JDBCException(ResourceConstants.RESULTSET_CANNOT_GET_BLOB_VALUE,e);
  }
}

Fixed version (ground truth):
public IBlob getBlob(int index) throws OdaException {
  assertNotNull(rs);
  try {
    java.sql.Blob blob=rs.getBlob(index);
    return new Blob(blob);
  }
 catch (  UnsupportedOperationException e1) {
    try {
      InputStream inputStream=rs.getBinaryStream(index);
      return new Blob(SqlBlobUtil.newBlob(inputStream));
    }
 catch (    SQLException e2) {
      throw new JDBCException(ResourceConstants.RESULTSET_CANNOT_GET_BLOB_VALUE,e2);
    }
  }
catch (  SQLException e) {
    try {
      byte[] bytes=rs.getBytes(index);
      return new Blob(SqlBlobUtil.newBlob(new ByteArrayInputStream(bytes)));
    }
 catch (    SQLException e2) {
      throw new JDBCException(ResourceConstants.RESULTSET_CANNOT_GET_BLOB_VALUE,e2);
    }
  }
}
Program: 77786
Project: 77786
Buggy source:
boolean isRowInDetailBand(IRowContent row){
  IBandContent band=(IBandContent)row.getParent();
  if (band.getBandType() == IBandContent.BAND_DETAIL) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
boolean isRowInDetailBand(IRowContent row){
  IElement parent=row.getParent();
  if (!(parent instanceof IBandContent)) {
    return false;
  }
  IBandContent band=(IBandContent)parent;
  if (band.getBandType() == IBandContent.BAND_DETAIL) {
    return true;
  }
  return false;
}
Program: 77787
Project: 77787
Buggy source:
/** 
 * @param result
 * @param key
 */
private static void addConditionalExprBindings(TotalExprBinding result,IConditionalExpression key,List bindings,String groupName){
  IConditionalExpression ce=key;
  if (groupName != null)   ce.setGroupName(groupName);
  String bindingName=TOTAL_PREFIX + totalColumnSuffix;
  totalColumnSuffix++;
  ColumnBinding columnBinding=new ColumnBinding(bindingName,ce);
  List allColumnBindings=new ArrayList();
  allColumnBindings.add(columnBinding);
  result.addColumnBindings(allColumnBindings);
  result.addNewExpression("String_Node_Str" + JavascriptEvalUtil.transformToJsConstants(bindingName) + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param result
 * @param key
 */
private void addConditionalExprBindings(TotalExprBinding result,IConditionalExpression key,List bindings,String groupName){
  IConditionalExpression ce=key;
  if (groupName != null)   ce.setGroupName(groupName);
  String bindingName=TOTAL_PREFIX + totalColumnSuffix;
  totalColumnSuffix++;
  ColumnBinding columnBinding=new ColumnBinding(bindingName,ce);
  List allColumnBindings=new ArrayList();
  allColumnBindings.add(columnBinding);
  result.addColumnBindings(allColumnBindings);
  result.addNewExpression("String_Node_Str" + JavascriptEvalUtil.transformToJsConstants(bindingName) + "String_Node_Str");
}
Program: 77789
Project: 77789
Buggy source:
/** 
 * @param exprs
 * @return
 */
public static ITotalExprBindings prepareTotalExpressions(List exprs,String groupName){
  TotalExprBinding result=new TotalExprBinding();
  List l=new ArrayList();
  for (int i=0; i < exprs.size(); i++) {
    Object key=exprs.get(i);
    result.addColumnBindings(l);
    if (key instanceof String) {
      String expr=key == null ? null : key.toString();
      String newExpr=prepareTotalExpression(expr,l,groupName);
      result.addColumnBindings(l);
      result.addNewExpression(newExpr);
    }
 else     if (key instanceof IConditionalExpression) {
      addConditionalExprBindings(result,(IConditionalExpression)key,l,groupName);
    }
 else     if (key == null) {
      result.addNewExpression(null);
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @param exprs
 * @return
 */
public ITotalExprBindings prepareTotalExpressions(List exprs,String groupName){
  TotalExprBinding result=new TotalExprBinding();
  List l=new ArrayList();
  for (int i=0; i < exprs.size(); i++) {
    Object key=exprs.get(i);
    result.addColumnBindings(l);
    if (key instanceof String) {
      String expr=key == null ? null : key.toString();
      String newExpr=prepareTotalExpression(expr,l,groupName);
      result.addColumnBindings(l);
      result.addNewExpression(newExpr);
    }
 else     if (key instanceof IConditionalExpression) {
      addConditionalExprBindings(result,(IConditionalExpression)key,l,groupName);
    }
 else     if (key == null) {
      result.addNewExpression(null);
    }
  }
  return result;
}
Program: 77790
Project: 77790
Buggy source:
/** 
 * Transfer the old expression to column dataBinding and bind it to the Query. And create a news expression to replace the old expression.
 * @param expr expression to be transfered.return the transfered expression
 */
protected String transformExpression(String expr){
  if (expr == null) {
    return null;
  }
  IBaseQueryDefinition query=getParentQuery();
  if (query != null) {
    List expressions=new ArrayList();
    expressions.add(expr);
    ITotalExprBindings totalExpressionBinding=ExpressionUtil.prepareTotalExpressions(expressions,getCurrentGroupName());
    addNewColumnBindings(query,totalExpressionBinding);
    List newExpressions=totalExpressionBinding.getNewExpression();
    return (String)newExpressions.get(0);
  }
  return expr;
}

Fixed version (ground truth):
/** 
 * Transfer the old expression to column dataBinding and bind it to the Query. And create a news expression to replace the old expression.
 * @param expr expression to be transfered.return the transfered expression
 */
protected String transformExpression(String expr){
  if (expr == null) {
    return null;
  }
  IBaseQueryDefinition query=getParentQuery();
  if (query != null) {
    List expressions=new ArrayList();
    expressions.add(expr);
    ITotalExprBindings totalExpressionBinding=expressionUtil.prepareTotalExpressions(expressions,getCurrentGroupName());
    addNewColumnBindings(query,totalExpressionBinding);
    List newExpressions=totalExpressionBinding.getNewExpression();
    return (String)newExpressions.get(0);
  }
  return expr;
}
Program: 77791
Project: 77791
Buggy source:
/** 
 * Transfer the old visibility and hightlight expressions to column dataBinding and bind it to the Query. And create new visibility and hightlight expressions to replace the old.
 */
private void transformColumnExpressions(ColumnDesign column){
  IBaseQueryDefinition query=getParentQuery();
  if (query == null) {
    return;
  }
  List expressions=new ArrayList();
  VisibilityDesign visibilities=column.getVisibility();
  if (visibilities != null) {
    for (int i=0; i < visibilities.count(); i++) {
      expressions.add(visibilities.getRule(i).getExpression());
    }
  }
  HighlightDesign highlights=column.getHighlight();
  if (highlights != null) {
    for (int i=0; i < highlights.getRuleCount(); i++) {
      expressions.add(createConditionalExpression(highlights.getRule(i)));
    }
  }
  ITotalExprBindings totalExpressionBindings=ExpressionUtil.prepareTotalExpressions(expressions,getCurrentGroupName());
  addNewColumnBindings(query,totalExpressionBindings);
  int expressionIndex=0;
  List newExpressions=totalExpressionBindings.getNewExpression();
  if (visibilities != null) {
    for (int i=0; i < visibilities.count(); i++) {
      visibilities.getRule(i).setExpression((String)newExpressions.get(expressionIndex++));
    }
  }
  if (highlights != null) {
    for (int i=0; i < highlights.getRuleCount(); i++) {
      highlights.getRule(i).setConditionExpr((String)newExpressions.get(expressionIndex++));
    }
  }
}

Fixed version (ground truth):
/** 
 * Transfer the old visibility and hightlight expressions to column dataBinding and bind it to the Query. And create new visibility and hightlight expressions to replace the old.
 */
private void transformColumnExpressions(ColumnDesign column){
  IBaseQueryDefinition query=getParentQuery();
  if (query == null) {
    return;
  }
  List expressions=new ArrayList();
  VisibilityDesign visibilities=column.getVisibility();
  if (visibilities != null) {
    for (int i=0; i < visibilities.count(); i++) {
      expressions.add(visibilities.getRule(i).getExpression());
    }
  }
  HighlightDesign highlights=column.getHighlight();
  if (highlights != null) {
    for (int i=0; i < highlights.getRuleCount(); i++) {
      expressions.add(createConditionalExpression(highlights.getRule(i)));
    }
  }
  ITotalExprBindings totalExpressionBindings=expressionUtil.prepareTotalExpressions(expressions,getCurrentGroupName());
  addNewColumnBindings(query,totalExpressionBindings);
  int expressionIndex=0;
  List newExpressions=totalExpressionBindings.getNewExpression();
  if (visibilities != null) {
    for (int i=0; i < visibilities.count(); i++) {
      visibilities.getRule(i).setExpression((String)newExpressions.get(expressionIndex++));
    }
  }
  if (highlights != null) {
    for (int i=0; i < highlights.getRuleCount(); i++) {
      highlights.getRule(i).setConditionExpr((String)newExpressions.get(expressionIndex++));
    }
  }
}
Program: 77792
Project: 77792
Buggy source:
public ReportQueryBuilder(){
}

Fixed version (ground truth):
public ReportQueryBuilder(){
  expressionUtil=new ExpressionUtil();
}
Program: 77793
Project: 77793
Buggy source:
/** 
 * Boolean -> Integer true 	-> 1 others 	-> 0  Date -> Integer Date.getTime(); String -> Integer Integer.valueOf();
 * @param source
 * @return
 * @throws BirtException
 */
public static Integer toInteger(Object source) throws BirtException {
  if (source == null)   return null;
  if (source instanceof Integer) {
    return (Integer)source;
  }
 else   if (source instanceof BigDecimal) {
    int intValue=((BigDecimal)source).intValue();
    return new Integer(intValue);
  }
 else   if (source instanceof Boolean) {
    if (true == ((Boolean)source).booleanValue())     return new Integer(1);
    return new Integer(0);
  }
 else   if (source instanceof Date) {
    long longValue=((Date)source).getTime();
    return new Integer((int)longValue);
  }
 else   if (source instanceof Double) {
    int intValue=((Double)source).intValue();
    return new Integer(intValue);
  }
 else   if (source instanceof String) {
    try {
      return Integer.valueOf((String)source);
    }
 catch (    NumberFormatException e) {
      throw new BirtException(pluginId,ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"},resourceBundle);
    }
  }
 else {
    throw new BirtException(pluginId,ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"},resourceBundle);
  }
}

Fixed version (ground truth):
/** 
 * Boolean -> Integer true 	-> 1 others 	-> 0  Date -> Integer Date.getTime(); String -> Integer Integer.valueOf();
 * @param source
 * @return
 * @throws BirtException
 */
public static Integer toInteger(Object source) throws BirtException {
  if (source == null)   return null;
  if (source instanceof Integer) {
    return (Integer)source;
  }
 else   if (source instanceof BigDecimal) {
    int intValue=((BigDecimal)source).intValue();
    return new Integer(intValue);
  }
 else   if (source instanceof Boolean) {
    if (true == ((Boolean)source).booleanValue())     return new Integer(1);
    return new Integer(0);
  }
 else   if (source instanceof Date) {
    long longValue=((Date)source).getTime();
    return new Integer((int)longValue);
  }
 else   if (source instanceof Double) {
    int intValue=((Double)source).intValue();
    return new Integer(intValue);
  }
 else   if (source instanceof String) {
    try {
      return new Integer(Double.valueOf((String)source).intValue());
    }
 catch (    NumberFormatException e) {
      throw new BirtException(pluginId,ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"},resourceBundle);
    }
  }
 else {
    throw new BirtException(pluginId,ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"},resourceBundle);
  }
}
Program: 77794
Project: 77794
Buggy source:
/** 
 * compile the complex expression
 * @param complexNode
 * @throws BirtException
 */
private void compileComplexExpr(Node complexNode,ScriptOrFnNode tree,List columnExprList) throws BirtException {
  Node child=complexNode.getFirstChild();
  while (child != null) {
    if (child.getType() == Token.FUNCTION) {
      int index=getFunctionIndex(child.getString(),tree);
      compileFunctionNode(tree.getFunctionNode(index),tree,columnExprList);
    }
    Node nextChild=child.getNext();
    if (child.getType() == Token.NUMBER || child.getType() == Token.STRING || child.getType() == Token.TRUE || child.getType() == Token.FALSE || child.getType() == Token.NULL) {
      processChild(complexNode,child,tree,columnExprList);
      child=nextChild;
      continue;
    }
    processChild(complexNode,child,tree,columnExprList);
    child=nextChild;
  }
}

Fixed version (ground truth):
/** 
 * compile the complex expression
 * @param complexNode
 * @throws BirtException
 */
private void compileComplexExpr(Node complexNode,ScriptOrFnNode tree,List columnExprList) throws BirtException {
  Node child=complexNode.getFirstChild();
  while (child != null) {
    if (child.getType() == Token.FUNCTION) {
      int index=getFunctionIndex(child.getString(),tree);
      compileFunctionNode(tree.getFunctionNode(index),tree,columnExprList);
    }
    Node nextChild=child.getNext();
    if (child.getType() == Token.NUMBER || child.getType() == Token.STRING || child.getType() == Token.TRUE || child.getType() == Token.FALSE || child.getType() == Token.NULL) {
      processChild(child,tree,columnExprList);
      child=nextChild;
      continue;
    }
    processChild(child,tree,columnExprList);
    child=nextChild;
  }
}
Program: 77795
Project: 77795
Buggy source:
/** 
 * compile column reference expression
 * @param refNode
 * @throws BirtException
 */
private void compileDirectColRefExpr(Node refNode,ScriptOrFnNode tree,List columnExprList) throws BirtException {
  assert(refNode.getType() == Token.GETPROP || refNode.getType() == Token.GETELEM);
  Node rowName=refNode.getFirstChild();
  assert(rowName != null);
  if (rowName.getType() != Token.NAME) {
    if (refNode.getType() == Token.GETPROP || refNode.getType() == Token.GETELEM) {
      int level=compileOuterColRefExpr(refNode);
      if (level == -1) {
        compileComplexExpr(refNode,tree,columnExprList);
      }
 else {
        Node nextNode=refNode.getLastChild();
        if (nextNode.getType() == Token.STRING) {
          ColumnBinding info=new ColumnBinding(nextNode.getString(),"String_Node_Str",level);
          columnExprList.add(info);
        }
      }
      return;
    }
    compileComplexExpr(refNode,tree,columnExprList);
    return;
  }
 else   compileSimpleColumnRefExpr(refNode,rowName,columnExprList);
}

Fixed version (ground truth):
/** 
 * compile column reference expression
 * @param refNode
 * @throws BirtException
 */
private void compileDirectColRefExpr(Node refNode,ScriptOrFnNode tree,List columnExprList) throws BirtException {
  assert(refNode.getType() == Token.GETPROP || refNode.getType() == Token.GETELEM || refNode.getType() == Token.SETELEM || refNode.getType() == Token.SETPROP);
  Node rowName=refNode.getFirstChild();
  assert(rowName != null);
  if (rowName.getType() != Token.NAME) {
    if (refNode.getType() == Token.GETPROP || refNode.getType() == Token.GETELEM || refNode.getType() == Token.SETELEM || refNode.getType() == Token.SETPROP) {
      int level=compileOuterColRefExpr(refNode);
      if (level == -1) {
        compileComplexExpr(refNode,tree,columnExprList);
      }
 else {
        Node nextNode=refNode.getLastChild();
        if (nextNode.getType() == Token.STRING) {
          ColumnBinding info=new ColumnBinding(nextNode.getString(),"String_Node_Str",level);
          columnExprList.add(info);
        }
      }
      return;
    }
    compileComplexExpr(refNode,tree,columnExprList);
    return;
  }
 else   compileSimpleColumnRefExpr(refNode,tree,columnExprList);
}
Program: 77796
Project: 77796
Buggy source:
/** 
 * process child node
 * @param parent
 * @param child
 * @param tree
 * @param columnExprList
 * @throws BirtException
 */
private void processChild(Node parent,Node child,ScriptOrFnNode tree,List columnExprList) throws BirtException {
switch (child.getType()) {
case Token.NUMBER:
case Token.STRING:
case Token.NULL:
case Token.TRUE:
case Token.FALSE:
    break;
case Token.GETPROP:
case Token.GETELEM:
  compileDirectColRefExpr(child,tree,columnExprList);
break;
case Token.CALL:
compileAggregateExpr(parent,child,tree,columnExprList);
break;
default :
compileComplexExpr(child,tree,columnExprList);
}
}

Fixed version (ground truth):
/** 
 * process child node
 * @param parent
 * @param child
 * @param tree
 * @param columnExprList
 * @throws BirtException
 */
private void processChild(Node child,ScriptOrFnNode tree,List columnExprList) throws BirtException {
switch (child.getType()) {
case Token.NUMBER:
case Token.STRING:
case Token.NULL:
case Token.TRUE:
case Token.FALSE:
    break;
case Token.GETPROP:
case Token.GETELEM:
case Token.SETPROP:
case Token.SETELEM:
{
    compileDirectColRefExpr(child,tree,columnExprList);
    break;
  }
case Token.CALL:
compileAggregateExpr(child,tree,columnExprList);
break;
default :
compileComplexExpr(child,tree,columnExprList);
}
}
Program: 77797
Project: 77797
Buggy source:
/** 
 * extract arguments from aggregation expression
 * @param context
 * @param callNode
 * @throws BirtException
 */
private void extractArguments(Node callNode,ScriptOrFnNode tree,List columnExprList) throws BirtException {
  Node arg=callNode.getFirstChild().getNext();
  while (arg != null) {
    Node nextArg=arg.getNext();
    processChild(callNode,arg,tree,columnExprList);
    arg=nextArg;
  }
}

Fixed version (ground truth):
/** 
 * extract arguments from aggregation expression
 * @param context
 * @param callNode
 * @throws BirtException
 */
private void extractArguments(Node callNode,ScriptOrFnNode tree,List columnExprList) throws BirtException {
  Node arg=callNode.getFirstChild().getNext();
  while (arg != null) {
    Node nextArg=arg.getNext();
    processChild(arg,tree,columnExprList);
    arg=nextArg;
  }
}
Program: 77798
Project: 77798
Buggy source:
/** 
 * @param refNode
 * @return
 */
private int compileOuterColRefExpr(Node refNode){
  int count=0;
  Node rowFirstNode=refNode.getFirstChild();
  if (refNode.getType() == Token.GETPROP || refNode.getType() == Token.GETELEM) {
    if (rowFirstNode.getType() == Token.NAME && rowFirstNode.getString().equals(ROW_INDICATOR)) {
      Node rowColumn=rowFirstNode.getNext();
      if (rowColumn.getType() == Token.STRING) {
        if ("String_Node_Str".equals(rowColumn.getString()))         count++;
      }
      return count;
    }
 else     if (rowFirstNode.getType() == Token.GETPROP) {
      if (compileOuterColRefExpr(rowFirstNode) == -1)       return -1;
 else       count=count + compileOuterColRefExpr(rowFirstNode);
      Node nextChild=rowFirstNode.getNext();
      if (nextChild.getType() == Token.STRING) {
        if ("String_Node_Str".equals(nextChild.getString()))         count++;
      }
    }
 else     return -1;
    return count;
  }
 else   return -1;
}

Fixed version (ground truth):
/** 
 * @param refNode
 * @return
 */
private int compileOuterColRefExpr(Node refNode){
  int count=0;
  Node rowFirstNode=refNode.getFirstChild();
  if (refNode.getType() == Token.GETPROP || refNode.getType() == Token.GETELEM || refNode.getType() == Token.SETPROP || refNode.getType() == Token.SETELEM) {
    if (rowFirstNode.getType() == Token.NAME && rowFirstNode.getString().equals(ROW_INDICATOR)) {
      Node rowColumn=rowFirstNode.getNext();
      if (rowColumn.getType() == Token.STRING) {
        if ("String_Node_Str".equals(rowColumn.getString()))         count++;
      }
      return count;
    }
 else     if (rowFirstNode.getType() == Token.GETPROP || rowFirstNode.getType() == Token.SETPROP) {
      if (compileOuterColRefExpr(rowFirstNode) == -1)       return -1;
 else       count=count + compileOuterColRefExpr(rowFirstNode);
      Node nextChild=rowFirstNode.getNext();
      if (nextChild.getType() == Token.STRING) {
        if ("String_Node_Str".equals(nextChild.getString()))         count++;
      }
    }
 else     return -1;
    return count;
  }
 else   return -1;
}
Program: 77799
Project: 77799
Buggy source:
/** 
 * compile the expression from a script tree
 * @param expression
 * @param context
 * @param tree
 * @param columnExprList
 * @throws BirtException
 */
private void CompiledExprFromTree(String expression,Context context,ScriptOrFnNode tree,List columnExprList) throws BirtException {
  if (tree.getFirstChild() == tree.getLastChild()) {
    if (tree.getFirstChild().getType() == Token.FUNCTION) {
      int index=getFunctionIndex(tree.getFirstChild().getString(),tree);
      compileFunctionNode(tree.getFunctionNode(index),tree,columnExprList);
    }
 else {
      if (tree.getFirstChild().getType() != Token.EXPR_RESULT && tree.getFirstChild().getType() != Token.EXPR_VOID && tree.getFirstChild().getType() != Token.BLOCK) {
        throw new CoreException(pluginId,ResourceConstants.INVALID_EXPRESSION);
      }
      Node exprNode=tree.getFirstChild();
      Node child=exprNode.getFirstChild();
      assert(child != null);
      processChild(exprNode,child,tree,columnExprList);
    }
  }
 else {
    compileComplexExpr(tree,tree,columnExprList);
  }
}

Fixed version (ground truth):
/** 
 * compile the expression from a script tree
 * @param expression
 * @param context
 * @param tree
 * @param columnExprList
 * @throws BirtException
 */
private void CompiledExprFromTree(String expression,Context context,ScriptOrFnNode tree,List columnExprList) throws BirtException {
  if (tree.getFirstChild() == tree.getLastChild()) {
    if (tree.getFirstChild().getType() == Token.FUNCTION) {
      int index=getFunctionIndex(tree.getFirstChild().getString(),tree);
      compileFunctionNode(tree.getFunctionNode(index),tree,columnExprList);
    }
 else {
      if (tree.getFirstChild().getType() != Token.EXPR_RESULT && tree.getFirstChild().getType() != Token.EXPR_VOID && tree.getFirstChild().getType() != Token.BLOCK) {
        throw new CoreException(pluginId,ResourceConstants.INVALID_EXPRESSION);
      }
      Node exprNode=tree.getFirstChild();
      processChild(exprNode,tree,columnExprList);
    }
  }
 else {
    compileComplexExpr(tree,tree,columnExprList);
  }
}
Program: 77800
Project: 77800
Buggy source:
/** 
 * compile aggregate expression
 * @param context
 * @param parent
 * @param callNode
 * @throws BirtException
 */
private void compileAggregateExpr(Node parent,Node callNode,ScriptOrFnNode tree,List columnExprList) throws BirtException {
  assert(callNode.getType() == Token.CALL);
  compileAggregationFunction(callNode,tree,columnExprList);
  extractArguments(callNode,tree,columnExprList);
}

Fixed version (ground truth):
/** 
 * compile aggregate expression
 * @param context
 * @param parent
 * @param callNode
 * @throws BirtException
 */
private void compileAggregateExpr(Node callNode,ScriptOrFnNode tree,List columnExprList) throws BirtException {
  assert(callNode.getType() == Token.CALL);
  compileAggregationFunction(callNode,tree,columnExprList);
  extractArguments(callNode,tree,columnExprList);
}
Program: 77802
Project: 77802
Buggy source:
public IQueryResults execute(IQueryResults outerResults,Scriptable scope) throws DataException {
  QueryResults queryResults=(QueryResults)super.execute(outerResults,scope);
  queryResults.setID(queryDefn.getQueryResultsID());
  return queryResults;
}

Fixed version (ground truth):
public IQueryResults execute(IQueryResults outerResults,Scriptable scope) throws DataException {
  String basedID=queryDefn.getQueryResultsID();
  String _1partID=QueryResultIDUtil.get1PartID(basedID);
  if (_1partID == null)   realBasedQueryID=basedID;
 else   realBasedQueryID=_1partID;
  QueryResults queryResults=(QueryResults)super.execute(outerResults,scope);
  queryResults.setID(realBasedQueryID);
  return queryResults;
}
Program: 77803
Project: 77803
Buggy source:
protected IResultIterator executeOdiQuery(IEventHandler eventHandler) throws DataException {
  RDLoad rdLoad=RDUtil.newLoad(engine.getContext(),new QueryResultInfo(queryDefn.getQueryResultsID(),null,-1));
  DataSetResultSet dataSetResult=rdLoad.loadDataSetData();
  IResultClass meta=dataSetResult.getResultClass();
  IResultIterator resultIterator=new CachedResultSet(query,populateResultClass(meta),dataSetResult,eventHandler);
  dataSetResult.close();
  return resultIterator;
}

Fixed version (ground truth):
protected IResultIterator executeOdiQuery(IEventHandler eventHandler) throws DataException {
  RDLoad rdLoad=RDUtil.newLoad(engine.getContext(),new QueryResultInfo(realBasedQueryID,null,-1));
  DataSetResultSet dataSetResult=rdLoad.loadDataSetData();
  IResultClass meta=dataSetResult.getResultClass();
  IResultIterator resultIterator=new CachedResultSet(query,populateResultClass(meta),dataSetResult,eventHandler);
  dataSetResult.close();
  return resultIterator;
}
Program: 77804
Project: 77804
Buggy source:
public IResultMetaData getResultMetaData() throws DataException {
  RDLoad rdLoad=RDUtil.newLoad(engine.getContext(),new QueryResultInfo(queryDefn.getQueryResultsID(),null,-1));
  return rdLoad.loadResultMetaData();
}

Fixed version (ground truth):
public IResultMetaData getResultMetaData() throws DataException {
  RDLoad rdLoad=RDUtil.newLoad(engine.getContext(),new QueryResultInfo(realBasedQueryID,null,-1));
  return rdLoad.loadResultMetaData();
}