nus-yam/ex-repair huggingface dataset:
Program: 77681
Project: 77681
Buggy source:
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);
  options.setOption(InputOptions.OPT_RTL,new Boolean(rtl));
  Collection parameterList=getParameterList();
  if (this.isDesigner && !IBirtConstants.SERVLET_PATH_FRAMESET.equalsIgnoreCase(request.getServletPath()))   parseConfigVars(request,parameterList);
  this.parametersAsString=getParsedParametersAsString(parameterList,request,options);
  Collection parameterDefList=getReportService().getParameterDefinitions(this.reportDesignHandle,options,false);
  if (documentInUrl)   this.missingParameter=false;
 else   this.missingParameter=validateParameters(parameterDefList,this.parametersAsString);
  this.parametersAsString=getParsedParametersAsStringWithDefaultValue(this.parametersAsString,request,options);
  this.parameters=(HashMap)getParsedParameters(this.reportDesignHandle,parameterList,request,options);
}

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);
  options.setOption(InputOptions.OPT_RTL,new Boolean(rtl));
  Collection parameterList=getParameterList();
  if (this.isDesigner && !IBirtConstants.SERVLET_PATH_FRAMESET.equalsIgnoreCase(request.getServletPath()))   parseConfigVars(request,parameterList);
  this.parametersAsString=getParsedParametersAsString(parameterList,request,options);
  this.parameterDefList=getReportService().getParameterDefinitions(this.reportDesignHandle,options,false);
  if (documentInUrl)   this.missingParameter=false;
 else   this.missingParameter=validateParameters(parameterDefList,this.parametersAsString);
  this.parametersAsString=getParsedParametersAsStringWithDefaultValue(this.parametersAsString,request,options);
  this.parameters=(HashMap)getParsedParameters(this.reportDesignHandle,parameterList,request,options);
}
Program: 77682
Project: 77682
Buggy source:
private static ParameterDefinition convertScalarParameter(IScalarParameterDefn engineParam,ParameterGroupDefinition group,IGetParameterDefinitionTask task){
  Object handle=engineParam.getHandle();
  ScalarParameterHandle scalarParamHandle=null;
  if (handle instanceof ScalarParameterHandle)   scalarParamHandle=(ScalarParameterHandle)handle;
  String name=engineParam.getName();
  String pattern=scalarParamHandle == null ? "String_Node_Str" : scalarParamHandle.getPattern();
  String displayFormat=engineParam.getDisplayFormat();
  String displayName=engineParam.getDisplayName();
  String helpText=engineParam.getHelpText();
  String promptText=engineParam.getPromptText();
  int dataType=engineParam.getDataType();
  int controlType=engineParam.getControlType();
  boolean hidden=engineParam.isHidden();
  boolean allowNull=engineParam.allowNull();
  boolean allowBlank=engineParam.allowBlank();
  boolean mustMatch=scalarParamHandle == null ? false : scalarParamHandle.isMustMatch();
  boolean concealValue=engineParam.isValueConcealed();
  Collection selectionList=convertEngineParameterSelectionChoice(task.getSelectionList(name));
  ParameterDefinition param=new ParameterDefinition(name,pattern,displayFormat,displayName,helpText,promptText,dataType,controlType,hidden,allowNull,allowBlank,mustMatch,concealValue,group,selectionList);
  return param;
}

Fixed version (ground truth):
private static ParameterDefinition convertScalarParameter(IScalarParameterDefn engineParam,ParameterGroupDefinition group,IGetParameterDefinitionTask task){
  Object handle=engineParam.getHandle();
  ScalarParameterHandle scalarParamHandle=null;
  if (handle instanceof ScalarParameterHandle)   scalarParamHandle=(ScalarParameterHandle)handle;
  String name=engineParam.getName();
  String pattern=scalarParamHandle == null ? "String_Node_Str" : scalarParamHandle.getPattern();
  String displayFormat=engineParam.getDisplayFormat();
  String displayName=engineParam.getDisplayName();
  String helpText=engineParam.getHelpText();
  String promptText=engineParam.getPromptText();
  int dataType=engineParam.getDataType();
  int controlType=engineParam.getControlType();
  boolean hidden=engineParam.isHidden();
  boolean allowNull=engineParam.allowNull();
  boolean allowBlank=engineParam.allowBlank();
  boolean mustMatch=scalarParamHandle == null ? false : scalarParamHandle.isMustMatch();
  boolean concealValue=engineParam.isValueConcealed();
  ParameterDefinition param=new ParameterDefinition(name,pattern,displayFormat,displayName,helpText,promptText,dataType,controlType,hidden,allowNull,allowBlank,mustMatch,concealValue,group,null);
  return param;
}
Program: 77684
Project: 77684
Buggy source:
private static ParameterGroupDefinition convertParameterGroup(IParameterGroupDefn engineParam,IGetParameterDefinitionTask task){
  boolean cascade=engineParam instanceof ICascadingParameterGroup;
  ParameterGroupDefinition paramGroup=new ParameterGroupDefinition(engineParam.getName(),engineParam.getDisplayName(),engineParam.getPromptText(),null,cascade);
  List contents=convertParametersInGroup(engineParam.getContents(),paramGroup,task);
  paramGroup.setParameters(contents);
  return paramGroup;
}

Fixed version (ground truth):
private static ParameterGroupDefinition convertParameterGroup(IParameterGroupDefn engineParam,IGetParameterDefinitionTask task){
  boolean cascade=engineParam instanceof ICascadingParameterGroup;
  String name=engineParam.getName();
  String displayName=engineParam.getDisplayName();
  String helpText=engineParam.getHelpText();
  String promptText=engineParam.getPromptText();
  ParameterGroupDefinition paramGroup=new ParameterGroupDefinition(name,displayName,promptText,null,cascade,helpText);
  List contents=convertParametersInGroup(engineParam.getContents(),paramGroup,task);
  paramGroup.setParameters(contents);
  return paramGroup;
}
Program: 77685
Project: 77685
Buggy source:
public ParameterGroupDefinition(String name,String displayName,String promptText,List parameters,boolean cascade){
  this.name=name;
  this.displayName=displayName;
  this.promptText=promptText;
  this.parameters=parameters;
  this.cascade=cascade;
}

Fixed version (ground truth):
public ParameterGroupDefinition(){
}
Program: 77686
Project: 77686
Buggy source:
/** 
 * Init the bean.
 * @param request
 * @throws Exception
 */
protected void __init(HttpServletRequest request) throws Exception {
  if (ParameterAccessor.isGetImageOperator(request)) {
    return;
  }
  this.category="String_Node_Str";
  this.masterPageContent=ParameterAccessor.isMasterPageContent(request);
  this.isDesigner=ParameterAccessor.isDesigner(request);
  this.bookmark=ParameterAccessor.getBookmark(request);
  this.reportPage=String.valueOf(ParameterAccessor.getPage(request));
  this.reportDocumentName=ParameterAccessor.getReportDocument(request);
  this.reportDesignName=ParameterAccessor.getReport(request);
  this.format=ParameterAccessor.getFormat(request);
  this.maxRows=ParameterAccessor.getMaxRows(request);
  ReportEngineService.getInstance().setMaxRows(this.maxRows);
  processReport(request);
  String title=null;
  if (title == null || title.trim().length() <= 0) {
    title=BirtResources.getString(ResourceConstants.BIRT_VIEWER_TITLE);
  }
  this.reportTitle=ParameterAccessor.htmlEncode(title);
  this.__initParameters(request);
}

Fixed version (ground truth):
/** 
 * Init the bean.
 * @param request
 * @throws Exception
 */
protected void __init(HttpServletRequest request) throws Exception {
  if (ParameterAccessor.isGetImageOperator(request)) {
    return;
  }
  this.category="String_Node_Str";
  this.masterPageContent=ParameterAccessor.isMasterPageContent(request);
  this.isDesigner=ParameterAccessor.isDesigner(request);
  this.bookmark=ParameterAccessor.getBookmark(request);
  this.reportPage=String.valueOf(ParameterAccessor.getPage(request));
  this.reportDocumentName=ParameterAccessor.getReportDocument(request);
  this.reportDesignName=ParameterAccessor.getReport(request);
  this.format=ParameterAccessor.getFormat(request);
  if (ParameterAccessor.PARAM_FORMAT_HTM.equalsIgnoreCase(this.format)) {
    this.format=ParameterAccessor.PARAM_FORMAT_HTML;
  }
  if (!ParameterAccessor.validateFormat(this.format)) {
    this.exception=new Exception(BirtResources.getString(ResourceConstants.VIEWER_ERROR_UNSUPPORTEDFORMAT));
    return;
  }
  this.maxRows=ParameterAccessor.getMaxRows(request);
  ReportEngineService.getInstance().setMaxRows(this.maxRows);
  processReport(request);
  String title=null;
  if (title == null || title.trim().length() <= 0) {
    title=BirtResources.getString(ResourceConstants.BIRT_VIEWER_TITLE);
  }
  this.reportTitle=ParameterAccessor.htmlEncode(title);
  this.__initParameters(request);
}
Program: 77690
Project: 77690
Buggy source:
/** 
 * Sets the page break inside property for block-level elements. The input value is one of constants defined in <code>DesignChoiceConstants</code>: <ul> <li><code>PAGEBREAK_INSIDE_AVOID</code> <li><code>PAGEBREAK_INSIDE_AUTO</code> <li><code>PAGEBREAK_INSIDE_INHERIT</code> </ul>
 * @param value the new page break inside property
 * @throws SemanticException if the value is not one of the above.
 */
public void setPageBreakInside(String value) throws SemanticException {
  setStringProperty(Style.PAGE_BREAK_INSIDE_PROP,value);
}

Fixed version (ground truth):
/** 
 * Sets the page break inside property for block-level elements. The input value is one of constants defined in <code>DesignChoiceConstants</code>: <ul> <li><code>PAGEBREAK_INSIDE_AVOID</code> <li><code>PAGEBREAK_INSIDE_AUTO</code> <li><code>PAGEBREAK_INSIDE_INHERIT</code> </ul>
 * @param value the new page break inside property
 * @throws SemanticException if the value is not one of the above.
 * @deprecated
 */
public void setPageBreakInside(String value) throws SemanticException {
  setStringProperty(Style.PAGE_BREAK_INSIDE_PROP,value);
}
Program: 77691
Project: 77691
Buggy source:
/** 
 * Returns the page break inside property for block-level elements. The return value is one of constants defined in <code>DesignChoiceConstants</code>: <ul> <li><code>PAGEBREAK_INSIDE_AVOID</code> <li><code>PAGEBREAK_INSIDE_AUTO</code> <li><code>PAGEBREAK_INSIDE_INHERIT</code> </ul>
 * @return the page break inside property
 */
public String getPageBreakInside(){
  return getStringProperty(Style.PAGE_BREAK_INSIDE_PROP);
}

Fixed version (ground truth):
/** 
 * Returns the page break inside property for block-level elements. The return value is one of constants defined in <code>DesignChoiceConstants</code>: <ul> <li><code>PAGEBREAK_INSIDE_AVOID</code> <li><code>PAGEBREAK_INSIDE_AUTO</code> <li><code>PAGEBREAK_INSIDE_INHERIT</code> </ul>
 * @return the page break inside property
 * @deprecated
 */
public String getPageBreakInside(){
  return getStringProperty(Style.PAGE_BREAK_INSIDE_PROP);
}
Program: 77693
Project: 77693
Buggy source:
/** 
 * localzie the text.
 * @param key text key
 * @param text default text
 * @return localized text.
 */
private String localize(String key,String text){
  ReportDesignHandle reportDesign=getReportDesign();
  if (key != null && reportDesign != null) {
    String t=reportDesign.getMessage(key,locale);
    if (t != null) {
      return t;
    }
  }
  return text;
}

Fixed version (ground truth):
/** 
 * localzie the text.
 * @param key text key
 * @param text default text
 * @return localized text.
 */
private String localize(IContent content,String key,String text){
  assert(content != null);
  assert(content.getGenerateBy() != null);
  DesignElementHandle element=((ReportItemDesign)content.getGenerateBy()).getHandle();
  if (key != null && element != null) {
    String t=ModuleUtil.getExternalizedValue(element,key,text,ULocale.forLocale(locale));
    if (t != null) {
      return t;
    }
  }
  return text;
}
Program: 77694
Project: 77694
Buggy source:
public Object visitTable(ITableContent table,Object value){
  if (table.getGenerateBy() instanceof TableItemDesign)   TableScriptExecutor.handleOnRender(table,context);
 else   if (table.getGenerateBy() instanceof GridItemDesign)   GridScriptExecutor.handleOnRender(table,context);
  String captionText=table.getCaption();
  String captionKey=table.getCaptionKey();
  captionText=localize(captionKey,captionText);
  table.setCaption(captionText);
  return table;
}

Fixed version (ground truth):
public Object visitTable(ITableContent table,Object value){
  if (table.getGenerateBy() instanceof TableItemDesign)   TableScriptExecutor.handleOnRender(table,context);
 else   if (table.getGenerateBy() instanceof GridItemDesign)   GridScriptExecutor.handleOnRender(table,context);
  String captionText=table.getCaption();
  String captionKey=table.getCaptionKey();
  captionText=localize(table,captionKey,captionText);
  table.setCaption(captionText);
  return table;
}
Program: 77695
Project: 77695
Buggy source:
/** 
 * process the data content <li> localize the help text <li> format the value <li> handle it as it is an text.
 * @param data data object
 */
protected void processData(IDataContent data){
  String helpText=localize(data.getHelpKey(),data.getHelpText());
  data.setHelpText(helpText);
  String text="String_Node_Str";
  if (data.getLabelKey() != null || data.getLabelText() != null) {
    text=localize(data.getLabelKey(),data.getLabelText());
  }
 else {
    Object value=data.getValue();
    if (value != null) {
      IStyle style=data.getComputedStyle();
      if (value instanceof Number) {
        String format=style.getNumberFormat();
        NumberFormatter fmt=context.getNumberFormatter(format);
        text=fmt.format((Number)value);
        CSSValue align=style.getProperty(IStyle.STYLE_NUMBER_ALIGN);
        if (align != null && align != CSSValueConstants.NONE_VALUE) {
          data.getStyle().setProperty(IStyle.STYLE_TEXT_ALIGN,align);
        }
      }
 else       if (value instanceof String) {
        StringFormatter fmt=context.getStringFormatter(style.getStringFormat());
        text=fmt.format((String)value);
      }
 else       if (value instanceof Date) {
        DateFormatter fmt=context.getDateFormatter(style.getDateFormat());
        text=fmt.format((Date)value);
      }
 else {
        text=value.toString();
      }
    }
  }
  data.setText(text);
}

Fixed version (ground truth):
/** 
 * process the data content <li> localize the help text <li> format the value <li> handle it as it is an text.
 * @param data data object
 */
protected void processData(IDataContent data){
  String helpText=localize(data,data.getHelpKey(),data.getHelpText());
  data.setHelpText(helpText);
  String text="String_Node_Str";
  if (data.getLabelKey() != null || data.getLabelText() != null) {
    text=localize(data,data.getLabelKey(),data.getLabelText());
  }
 else {
    Object value=data.getValue();
    if (value != null) {
      IStyle style=data.getComputedStyle();
      if (value instanceof Number) {
        String format=style.getNumberFormat();
        NumberFormatter fmt=context.getNumberFormatter(format);
        text=fmt.format((Number)value);
        CSSValue align=style.getProperty(IStyle.STYLE_NUMBER_ALIGN);
        if (align != null && align != CSSValueConstants.NONE_VALUE) {
          data.getStyle().setProperty(IStyle.STYLE_TEXT_ALIGN,align);
        }
      }
 else       if (value instanceof String) {
        StringFormatter fmt=context.getStringFormatter(style.getStringFormat());
        text=fmt.format((String)value);
      }
 else       if (value instanceof Date) {
        DateFormatter fmt=context.getDateFormatter(style.getDateFormat());
        text=fmt.format((Date)value);
      }
 else {
        text=value.toString();
      }
    }
  }
  data.setText(text);
}
Program: 77696
Project: 77696
Buggy source:
/** 
 * process the label content <li> localize the help text <li> localize the label content <li> handle it as it is an text
 * @param label label object
 */
protected void processLabel(ILabelContent label){
  String helpText=localize(label.getHelpKey(),label.getHelpText());
  label.setHelpText(helpText);
  String text=localize(label.getLabelKey(),label.getLabelText());
  label.setText(text);
}

Fixed version (ground truth):
/** 
 * process the label content <li> localize the help text <li> localize the label content <li> handle it as it is an text
 * @param label label object
 */
protected void processLabel(ILabelContent label){
  String helpText=localize(label,label.getHelpKey(),label.getHelpText());
  label.setHelpText(helpText);
  String text=localize(label,label.getLabelKey(),label.getLabelText());
  label.setText(text);
}
Program: 77697
Project: 77697
Buggy source:
protected void processImage(IImageContent image){
  String altText=localize(image.getAltTextKey(),image.getAltText());
  image.setAltText(altText);
  String helpText=localize(image.getHelpKey(),image.getHelpText());
  image.setHelpText(helpText);
}

Fixed version (ground truth):
protected void processImage(IImageContent image){
  String altText=localize(image,image.getAltTextKey(),image.getAltText());
  image.setAltText(altText);
  String helpText=localize(image,image.getHelpKey(),image.getHelpText());
  image.setHelpText(helpText);
}
Program: 77698
Project: 77698
Buggy source:
/** 
 * Returns externalized message for the given locale.
 * @param textIDProp the display key property name
 * @param textProp the property name
 * @param locale the locale
 * @return externalized message.
 */
public String getExternalizedValue(String textIDProp,String textProp,ULocale locale){
  return ModelUtil.getExternalizedValue(getElement(),textIDProp,textProp,locale);
}

Fixed version (ground truth):
/** 
 * Returns externalized message.
 * @param textIDProp the display key property name
 * @param textProp the property name
 * @return externalized message.
 */
public String getExternalizedValue(String textIDProp,String textProp){
  return ModelUtil.getExternalizedValue(getElement(),textIDProp,textProp,ThreadResources.getLocale());
}
Program: 77699
Project: 77699
Buggy source:
/** 
 * Returns externalized message for the given locale.
 * @param textIDProp the display key property name
 * @param textProp the property name
 * @param locale the locale
 * @return externalized message.
 */
public String getExternalizedValue(String textIDProp,String textProp,ULocale locale){
  return ModelUtil.getExternalizedValue(getElement(),textIDProp,textProp,locale);
}

Fixed version (ground truth):
/** 
 * Returns externalized message.
 * @param textIDProp the display key property name
 * @param textProp the property name
 * @return externalized message.
 */
public String getExternalizedValue(String textIDProp,String textProp){
  return ModelUtil.getExternalizedValue(getElement(),textIDProp,textProp,ThreadResources.getLocale());
}
Program: 77701
Project: 77701
Buggy source:
/** 
 * Return an instance of JointResultMeta.
 * @param left
 * @param right
 * @return
 * @throws DataException
 */
private JointResultMetadata getJointResultMetadata(IResultMetaData left,IResultMetaData right) throws DataException {
  try {
    String leftPrefix=dataSet.getLeftDataSetDesignName();
    String rightPrefix=dataSet.getRightDataSetDesignName();
    if (leftPrefix.equals(rightPrefix)) {
      leftPrefix=leftPrefix + "String_Node_Str";
      rightPrefix=rightPrefix + "String_Node_Str";
    }
    leftPrefix=leftPrefix + COLUMN_NAME_SPLITTER;
    rightPrefix=rightPrefix + COLUMN_NAME_SPLITTER;
    JointResultMetadata meta=populatorJointResultMetadata(left,leftPrefix,right,rightPrefix);
    return meta;
  }
 catch (  BirtException be) {
    throw DataException.wrap(be);
  }
}

Fixed version (ground truth):
/** 
 * Return an instance of JointResultMeta.
 * @param left
 * @param right
 * @return
 * @throws DataException
 */
private JointResultMetadata getJointResultMetadata(IResultMetaData left,IResultMetaData right) throws DataException {
  if (left == null || right == null) {
    throw new DataException(ResourceConstants.UNEXPECTED_ERROR);
  }
  try {
    String leftPrefix=dataSet.getLeftDataSetDesignName();
    String rightPrefix=dataSet.getRightDataSetDesignName();
    if (leftPrefix.equals(rightPrefix)) {
      leftPrefix=leftPrefix + "String_Node_Str";
      rightPrefix=rightPrefix + "String_Node_Str";
    }
    leftPrefix=leftPrefix + COLUMN_NAME_SPLITTER;
    rightPrefix=rightPrefix + COLUMN_NAME_SPLITTER;
    JointResultMetadata meta=populatorJointResultMetadata(left,leftPrefix,right,rightPrefix);
    return meta;
  }
 catch (  BirtException be) {
    throw DataException.wrap(be);
  }
}
Program: 77702
Project: 77702
Buggy source:
/** 
 * whether need to use result hint
 * @param dataSetHandle
 * @return
 */
private boolean checkHandleType(DataSetHandle dataSetHandle){
  if (dataSetHandle instanceof ScriptDataSetHandle)   return true;
 else   if (dataSetHandle instanceof JointDataSetHandle) {
    List dataSets=((JointDataSetHandle)dataSetHandle).getDataSetNames();
    for (int i=0; i < dataSets.size(); i++) {
      DataSetHandle dsHandle=((JointDataSetHandle)dataSetHandle).getModuleHandle().findDataSet(dataSets.get(i).toString());
      if (dsHandle != null && dsHandle instanceof ScriptDataSetHandle) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * whether need to use result hint
 * @param dataSetHandle
 * @return
 */
private boolean checkHandleType(DataSetHandle dataSetHandle){
  if (dataSetHandle instanceof ScriptDataSetHandle)   return true;
 else   if (dataSetHandle instanceof JointDataSetHandle) {
    List dataSets=((JointDataSetHandle)dataSetHandle).getDataSetNames();
    for (int i=0; i < dataSets.size(); i++) {
      DataSetHandle dsHandle=((JointDataSetHandle)dataSetHandle).getModuleHandle().findDataSet(dataSets.get(i).toString());
      if (dsHandle != null && dsHandle instanceof ScriptDataSetHandle) {
        return true;
      }
 else       if (dsHandle instanceof JointDataSetHandle) {
        if (checkHandleType(dsHandle))         return true;
      }
    }
  }
  return false;
}
Program: 77703
Project: 77703
Buggy source:
public JointDataSetAdapter(JointDataSetHandle handle) throws BirtException {
  super(handle.getName());
  Iterator it=handle.joinConditionsIterator();
  JoinConditionHandle jc=null;
  while (it.hasNext()) {
    jc=(JoinConditionHandle)it.next();
    addJoinCondition(new JoinCondition(new ScriptExpression(jc.getLeftExpression()),new ScriptExpression(jc.getRightExpression()),adaptJoinOperator(jc.getOperator())));
  }
  if (jc != null) {
    setLeftDataSetDesignName(jc.getLeftDataSet());
    setRightDataSetDesignName(jc.getRightDataSet());
    setJoinType(adaptJoinType(jc.getJoinType()));
  }
  DataAdapterUtil.adaptBaseDataSet(handle,this);
}

Fixed version (ground truth):
public JointDataSetAdapter(JointDataSetHandle handle) throws BirtException {
  super(handle.getQualifiedName());
  Iterator it=handle.joinConditionsIterator();
  JoinConditionHandle jc=null;
  while (it.hasNext()) {
    jc=(JoinConditionHandle)it.next();
    addJoinCondition(new JoinCondition(new ScriptExpression(jc.getLeftExpression()),new ScriptExpression(jc.getRightExpression()),adaptJoinOperator(jc.getOperator())));
  }
  if (jc != null) {
    setLeftDataSetDesignName(jc.getLeftDataSet());
    setRightDataSetDesignName(jc.getRightDataSet());
    setJoinType(adaptJoinType(jc.getJoinType()));
  }
  DataAdapterUtil.adaptBaseDataSet(handle,this);
}
Program: 77704
Project: 77704
Buggy source:
/** 
 * Creates adaptor based on Model DataSourceHandle.
 * @param source model handle
 */
public ScriptDataSourceAdapter(ScriptDataSourceHandle source) throws BirtException {
  super(source.getName());
  DataAdapterUtil.adaptBaseDataSource(source,this);
  setOpenScript(source.getOpen());
  setCloseScript(source.getClose());
}

Fixed version (ground truth):
/** 
 * Creates adaptor based on Model DataSourceHandle.
 * @param source model handle
 */
public ScriptDataSourceAdapter(ScriptDataSourceHandle source) throws BirtException {
  super(source.getQualifiedName());
  DataAdapterUtil.adaptBaseDataSource(source,this);
  setOpenScript(source.getOpen());
  setCloseScript(source.getClose());
}
Program: 77705
Project: 77705
Buggy source:
/** 
 * submit current line to parent true if succeed
 * @return
 */
public boolean endLine(){
  updateLine();
  align();
  boolean ret=true;
  ret=parent.addArea(root);
  lineFinished=true;
  if (ret) {
    newContext();
    last=null;
    return true;
  }
 else {
    last=root;
    return false;
  }
}

Fixed version (ground truth):
/** 
 * submit current line to parent true if succeed
 * @return
 */
public boolean endLine(){
  updateLine();
  align();
  boolean ret=true;
  if (root.getChildrenCount() > 0) {
    ret=parent.addArea(root);
  }
  lineFinished=true;
  if (ret) {
    newContext();
    last=null;
    return true;
  }
 else {
    last=root;
    return false;
  }
}
Program: 77706
Project: 77706
Buggy source:
/** 
 */
public RowSaveUtil(int rowCount,OutputStream rowExprsOs,OutputStream rowLenOs,Set exprNameSet){
  this.rowCount=rowCount;
  this.exprNameSet=exprNameSet;
  this.rowExprsDos=new DataOutputStream(rowExprsOs);
  this.rowLenDos=new DataOutputStream(rowLenOs);
}

Fixed version (ground truth):
/** 
 */
public RowSaveUtil(int rowCount,OutputStream rowExprsOs,OutputStream rowLenOs,Set exprNameSet){
  this.rowCount=rowCount;
  this.exprNameSet=exprNameSet;
  this.rowExprsDos=new DataOutputStream(rowExprsOs);
  this.rowLenDos=new DataOutputStream(rowLenOs);
  this.lastRowIndex=-1;
}
Program: 77707
Project: 77707
Buggy source:
/** 
 * @param currIndex
 * @param exprID
 * @param exprValue
 * @throws DataException
 */
public int saveExprValue(Map valueMap) throws DataException {
  initSave(false);
  ByteArrayOutputStream tempBaos=new ByteArrayOutputStream();
  BufferedOutputStream tempBos=new BufferedOutputStream(tempBaos);
  DataOutputStream tempDos=new DataOutputStream(tempBos);
  try {
    IOUtil.writeInt(tempDos,valueMap.size());
    Iterator it=valueMap.entrySet().iterator();
    while (it.hasNext()) {
      Map.Entry entry=(Entry)it.next();
      String exprID=(String)entry.getKey();
      Object value=entry.getValue();
      IOUtil.writeString(tempDos,exprID);
      IOUtil.writeObject(tempDos,value);
      exprNameSet.add(exprID);
    }
    tempDos.flush();
    tempBos.flush();
    tempBaos.flush();
    byte[] bytes=tempBaos.toByteArray();
    int rowBytes=bytes.length;
    IOUtil.writeRawBytes(this.rowExprsDos,bytes);
    tempBaos=null;
    tempBos=null;
    tempDos=null;
    return rowBytes;
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * @param currIndex
 * @param exprID
 * @param exprValue
 * @throws DataException
 */
private int saveExprValue(Map valueMap) throws DataException {
  ByteArrayOutputStream tempBaos=new ByteArrayOutputStream();
  BufferedOutputStream tempBos=new BufferedOutputStream(tempBaos);
  DataOutputStream tempDos=new DataOutputStream(tempBos);
  try {
    IOUtil.writeInt(tempDos,valueMap.size());
    Iterator it=valueMap.entrySet().iterator();
    while (it.hasNext()) {
      Map.Entry entry=(Entry)it.next();
      String exprID=(String)entry.getKey();
      Object value=entry.getValue();
      IOUtil.writeString(tempDos,exprID);
      IOUtil.writeObject(tempDos,value);
      exprNameSet.add(exprID);
    }
    tempDos.flush();
    tempBos.flush();
    tempBaos.flush();
    byte[] bytes=tempBaos.toByteArray();
    int rowBytes=bytes.length;
    IOUtil.writeRawBytes(this.rowExprsDos,bytes);
    tempBaos=null;
    tempBos=null;
    tempDos=null;
    return rowBytes;
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e,"String_Node_Str");
  }
}
Program: 77709
Project: 77709
Buggy source:
protected void closeLayout(){
  if (root.getChildrenCount() == 0) {
    return;
  }
  if (!isLast) {
    updateAllUnresolvedCellArea();
    root.setHeight(getCurrentBP() + getOffsetY());
    return;
  }
  ArrayList list=this.dropList;
  int bottomMaxBorder=0;
  ArrayList changed=new ArrayList();
  for (int i=0; i < list.size(); i++) {
    DropCellInfo cell=(DropCellInfo)list.get(i);
    bottomMaxBorder=Math.max(resolveBottomBorder(cell.cell),bottomMaxBorder);
    changed.add(cell.cell);
  }
  updateAllUnresolvedCellArea();
  if (lastRowArea != null) {
    Iterator iter=lastRowArea.getChildren();
    while (iter.hasNext()) {
      CellArea cell=(CellArea)iter.next();
      if (!changed.contains(cell)) {
        bottomMaxBorder=Math.max(resolveBottomBorder(cell),bottomMaxBorder);
        changed.add(cell);
      }
    }
  }
  if (bottomMaxBorder > 0) {
    for (int i=0; i < changed.size(); i++) {
      CellArea cell=(CellArea)changed.get(i);
      cell.setHeight(cell.getHeight() + bottomMaxBorder);
    }
    if (lastRowArea != null) {
      lastRowArea.setHeight(lastRowArea.getHeight() + bottomMaxBorder);
    }
  }
  root.setHeight(getCurrentBP() + getOffsetY() + bottomMaxBorder);
}

Fixed version (ground truth):
protected void closeLayout(){
  if (root.getChildrenCount() == 0) {
    return;
  }
  ArrayList lastDropCells=new ArrayList();
  Iterator it=dropList.iterator();
  while (it.hasNext()) {
    DropCellInfo dropCell=(DropCellInfo)it.next();
    for (int columnID=dropCell.cell.getColumnID(); columnID < dropCell.cell.getColumnID() + dropCell.cell.getColSpan(); columnID++)     lastDropCells.add(new Integer(columnID));
  }
  if (!isLast) {
    updateAllUnresolvedCellArea(lastDropCells);
    root.setHeight(getCurrentBP() + getOffsetY());
    return;
  }
  ArrayList list=this.dropList;
  int bottomMaxBorder=0;
  ArrayList changed=new ArrayList();
  for (int i=0; i < list.size(); i++) {
    DropCellInfo cell=(DropCellInfo)list.get(i);
    bottomMaxBorder=Math.max(resolveBottomBorder(cell.cell),bottomMaxBorder);
    changed.add(cell.cell);
  }
  updateAllUnresolvedCellArea(lastDropCells);
  if (lastRowArea != null) {
    Iterator iter=lastRowArea.getChildren();
    while (iter.hasNext()) {
      CellArea cell=(CellArea)iter.next();
      if (!changed.contains(cell)) {
        bottomMaxBorder=Math.max(resolveBottomBorder(cell),bottomMaxBorder);
        changed.add(cell);
      }
    }
  }
  if (bottomMaxBorder > 0) {
    for (int i=0; i < changed.size(); i++) {
      CellArea cell=(CellArea)changed.get(i);
      cell.setHeight(cell.getHeight() + bottomMaxBorder);
    }
    if (lastRowArea != null) {
      lastRowArea.setHeight(lastRowArea.getHeight() + bottomMaxBorder);
    }
  }
  root.setHeight(getCurrentBP() + getOffsetY() + bottomMaxBorder);
}
Program: 77710
Project: 77710
Buggy source:
protected void updateAllUnresolvedCellArea(){
  Iterator iter=dropList.iterator();
  while (iter.hasNext()) {
    DropCellInfo dropCell=(DropCellInfo)iter.next();
    verticalAlign(dropCell.cell);
    iter.remove();
  }
}

Fixed version (ground truth):
protected void updateAllUnresolvedCellArea(ArrayList lastDropCells){
  removeDropCells(lastDropCells);
}
Program: 77711
Project: 77711
Buggy source:
/** 
 * start row update content cache
 * @param row
 */
public void startRow(IRowContent row){
  currentRowID++;
  CellWrapper[] newRowContent=new CellWrapper[columnNumber];
  if (currentRowID > 0) {
    for (int i=0; i < columnNumber; i++) {
      if (currentRowContent[i] != null) {
        int rowSpan=currentRowContent[i].rowSpan;
        if (rowSpan > 0 && currentRowID < rowSpan + currentRowContent[i].rowID || rowSpan < 0) {
          newRowContent[i]=currentRowContent[i];
        }
 else {
          newRowContent[i]=null;
          removeDropAreaByIndex(i);
        }
      }
    }
  }
  lastRowContent=currentRowContent;
  lastRow=currentRow;
  currentRowContent=newRowContent;
  currentRow=new RowWrapper(row,currentRowID);
}

Fixed version (ground truth):
/** 
 * start row update content cache
 * @param row
 */
public void startRow(IRowContent row){
  currentRowID++;
  CellWrapper[] newRowContent=new CellWrapper[columnNumber];
  if (currentRowID > 0) {
    ArrayList removedDropCells=new ArrayList();
    for (int i=0; i < columnNumber; i++) {
      if (currentRowContent[i] != null) {
        int rowSpan=currentRowContent[i].rowSpan;
        if (rowSpan > 0 && currentRowID < rowSpan + currentRowContent[i].rowID || rowSpan < 0) {
          newRowContent[i]=currentRowContent[i];
        }
 else {
          newRowContent[i]=null;
          removedDropCells.add(new Integer(i));
        }
      }
    }
    if (removedDropCells.size() > 0) {
      removeDropCells(removedDropCells);
    }
  }
  lastRowContent=currentRowContent;
  lastRow=currentRow;
  currentRowContent=newRowContent;
  currentRow=new RowWrapper(row,currentRowID);
}
Program: 77712
Project: 77712
Buggy source:
protected void removeDropAreaBySpan(int rowSpan){
  Iterator iter=dropList.iterator();
  while (iter.hasNext()) {
    DropCellInfo dropCell=(DropCellInfo)iter.next();
    if (dropCell.rowSpan == rowSpan) {
      verticalAlign(dropCell.cell);
      iter.remove();
    }
  }
}

Fixed version (ground truth):
protected void removeDropAreaBySpan(int rowSpan){
  int maxHeight=0;
  Iterator iter=dropList.iterator();
  ArrayList removedList=new ArrayList();
  while (iter.hasNext()) {
    DropCellInfo dropCell=(DropCellInfo)iter.next();
    if (dropCell.rowSpan == rowSpan) {
      verticalAlign(dropCell.cell);
      iter.remove();
      removedList.add(dropCell);
      maxHeight=Math.max(maxHeight,dropCell.leftHeight);
    }
  }
  if (maxHeight > 0) {
    if (lastRowArea != null) {
      lastRowArea.setHeight(lastRowArea.getHeight() + maxHeight);
      Iterator rowIter=lastRowArea.getChildren();
      while (rowIter.hasNext()) {
        CellArea cell=(CellArea)rowIter.next();
        cell.setHeight(cell.getHeight() + maxHeight);
      }
    }
    Iterator removedIter=removedList.iterator();
    while (removedIter.hasNext()) {
      DropCellInfo cell=(DropCellInfo)removedIter.next();
      cell.cell.setHeight(cell.cell.getHeight() + maxHeight - cell.leftHeight);
    }
    currentBP+=maxHeight;
  }
}
Program: 77713
Project: 77713
Buggy source:
private void closeTargetReport(){
  if (targetReportHandle instanceof ReportDesignHandle) {
    ((ReportDesignHandle)targetReportHandle).close();
    targetReportHandle=null;
  }
}

Fixed version (ground truth):
private void closeTargetReport(){
  if (targetReportHandle instanceof ReportDesignHandle) {
    ((ReportDesignHandle)targetReportHandle).close();
  }
 else   if (targetReportHandle instanceof IReportDocument) {
    ((IReportDocument)targetReportHandle).close();
  }
  targetReportHandle=null;
}
Program: 77714
Project: 77714
Buggy source:
private void initTargetReport(String newFilename){
  targetReportHandle=null;
  String errorMessage=null;
  if (newFilename.endsWith("String_Node_Str")) {
    ReportEngine engine=new ReportEngine(new EngineConfig());
    try {
      targetReportHandle=engine.openReportDocument(URIUtil.resolveAbsolutePath(getBasePath(),newFilename));
    }
 catch (    EngineException e) {
      e.printStackTrace();
    }
  }
 else {
    try {
      targetReportHandle=SessionHandleAdapter.getInstance().getSessionHandle().openDesign(newFilename);
    }
 catch (    DesignFileException e) {
      try {
        targetReportHandle=SessionHandleAdapter.getInstance().getSessionHandle().openDesign(URIUtil.resolveAbsolutePath(getBasePath(),newFilename));
      }
 catch (      DesignFileException e1) {
        errorMessage=ERROR_MSG_INVALID_REPORT;
      }
    }
  }
  if (errorMessage != null) {
    messageLine.setText(errorMessage);
    messageLine.setImage(ERROR_ICON);
  }
 else {
    messageLine.setText("String_Node_Str");
    messageLine.setImage(null);
  }
}

Fixed version (ground truth):
private void initTargetReport(String newFilename){
  closeTargetReport();
  targetReportHandle=null;
  String errorMessage=null;
  if (newFilename.endsWith("String_Node_Str")) {
    ReportEngine engine=new ReportEngine(new EngineConfig());
    try {
      targetReportHandle=engine.openReportDocument(URIUtil.resolveAbsolutePath(getBasePath(),newFilename));
    }
 catch (    EngineException e) {
      e.printStackTrace();
    }
  }
 else {
    try {
      targetReportHandle=SessionHandleAdapter.getInstance().getSessionHandle().openDesign(newFilename);
    }
 catch (    DesignFileException e) {
      try {
        targetReportHandle=SessionHandleAdapter.getInstance().getSessionHandle().openDesign(URIUtil.resolveAbsolutePath(getBasePath(),newFilename));
      }
 catch (      DesignFileException e1) {
        errorMessage=ERROR_MSG_INVALID_REPORT;
      }
    }
  }
  if (errorMessage != null) {
    messageLine.setText(errorMessage);
    messageLine.setImage(ERROR_ICON);
  }
 else {
    messageLine.setText("String_Node_Str");
    messageLine.setImage(null);
  }
}
Program: 77715
Project: 77715
Buggy source:
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();
}

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();
  Object ext=content.getExtension(IContent.DOCUMENT_EXTENSION);
  if (ext != null) {
    setExtension(IContent.DOCUMENT_EXTENSION,ext);
  }
}
Program: 77716
Project: 77716
Buggy source:
public IReportItemExecutor getNextChild(){
  if (childContent != null) {
    IReportItemExecutor ret=new ItemExecutorWrapper(childExecutor,childContent);
    childContent=null;
    childExecutor=null;
    needUpdate=true;
    return ret;
  }
  if (currentRunIn != null) {
    needUpdate=true;
    return currentRunIn.getNextChild();
  }
  assert(false);
  return null;
}

Fixed version (ground truth):
public IReportItemExecutor getNextChild(){
  if (childContent != null) {
    IReportItemExecutor ret=new ItemExecutorWrapper(childExecutor,childContent);
    childContent=null;
    childExecutor=null;
    needUpdate=true;
    return ret;
  }
  if (currentRunIn != null) {
    needUpdate=true;
    IReportItemExecutor runInChild=currentRunIn.getNextChild();
    if (runInChild != null) {
      IContent runInContent=runInChild.execute();
      if (runInContent != null && (runInContent.getChildren() == null || runInContent.getChildren().size() == 0)) {
        execute(runInChild,runInContent);
        runInChild.close();
        runInChild=new DOMReportItemExecutor(runInContent);
      }
    }
    return runInChild;
  }
  assert(false);
  return null;
}
Program: 77717
Project: 77717
Buggy source:
protected boolean handleChild(IReportItemExecutor childExecutor){
  boolean childBreak=false;
  IContent childContent=childExecutor.execute();
  PDFAbstractLM childLM=getFactory().createLayoutManager(this,childContent,emitter,childExecutor);
  if (needLineBreak(childContent)) {
    unfinishedExecutor=childExecutor;
    return !endLine();
  }
 else {
    childBreak=childLM.layout();
    if (childBreak) {
      if (!childLM.isFinished()) {
        addChild(childLM);
      }
    }
    return childBreak;
  }
}

Fixed version (ground truth):
protected boolean handleChild(IReportItemExecutor childExecutor){
  boolean childBreak=false;
  IContent childContent=childExecutor.execute();
  PDFAbstractLM childLM=getFactory().createLayoutManager(this,childContent,emitter,childExecutor);
  if (needLineBreak(childContent)) {
    unfinishedExecutor=childExecutor;
    return !endLine();
  }
 else {
    childBreak=childLM.layout();
    if (childBreak) {
      if (!childLM.isFinished()) {
        addChild(childLM);
        if (currentIP < expectedIP) {
          currentIP=expectedIP;
        }
      }
    }
    return childBreak;
  }
}
Program: 77718
Project: 77718
Buggy source:
private boolean needLineBreak(IContent content){
  int specWidth=0;
  int avaWidth=getMaxAvaWidth() - this.getCurrentIP();
  int calWidth=getDimensionValue(content.getWidth());
  if (calWidth > 0 && calWidth < getMaxAvaWidth()) {
    specWidth=calWidth;
  }
  return specWidth > avaWidth;
}

Fixed version (ground truth):
private boolean needLineBreak(IContent content){
  int specWidth=0;
  int avaWidth=getMaxAvaWidth() - this.getCurrentIP();
  int calWidth=getDimensionValue(content.getWidth());
  if (calWidth > 0 && calWidth < getMaxAvaWidth()) {
    specWidth=calWidth;
  }
  if (specWidth <= avaWidth && specWidth > 0) {
    expectedIP=currentIP + specWidth;
  }
  return specWidth > avaWidth;
}
Program: 77719
Project: 77719
Buggy source:
protected boolean traverseChildren(){
  if (last != null) {
    parent.addArea(last);
    last=null;
    if (breakAfterRelayout) {
      breakAfterRelayout=false;
      return true;
    }
  }
  boolean childBreak=false;
  if (children.size() > 0) {
    Iterator iterLM=children.iterator();
    while (iterLM.hasNext()) {
      PDFAbstractLM childLM=(PDFAbstractLM)iterLM.next();
      child=childLM;
      boolean currentBreak=childLM.layout();
      if (currentBreak) {
        childBreak=true;
      }
 else {
        iterLM.remove();
      }
    }
    if (childBreak) {
      return true;
    }
 else {
      endLine();
    }
  }
  boolean childHasNext=false;
  while (executor.hasNextChild() || unfinishedExecutor != null) {
    IReportItemExecutor childExecutor=null;
    if (unfinishedExecutor != null) {
      childExecutor=unfinishedExecutor;
      unfinishedExecutor=null;
    }
 else {
      childExecutor=executor.getNextChild();
    }
    assert(childExecutor != null);
    childHasNext=handleChild(childExecutor) || childHasNext;
    if (childHasNext && unfinishedExecutor != null) {
      if (lineFinished) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
protected boolean traverseChildren(){
  if (last != null) {
    parent.addArea(last);
    last=null;
    if (breakAfterRelayout) {
      breakAfterRelayout=false;
      return true;
    }
  }
  boolean childBreak=false;
  if (children.size() > 0) {
    Iterator iterLM=children.iterator();
    while (iterLM.hasNext()) {
      PDFAbstractLM childLM=(PDFAbstractLM)iterLM.next();
      child=childLM;
      boolean currentBreak=childLM.layout();
      if (currentBreak) {
        childBreak=true;
      }
 else {
        iterLM.remove();
      }
    }
    if (childBreak) {
      return true;
    }
 else {
      endLine();
    }
  }
  boolean childHasNext=false;
  while (executor.hasNextChild() || unfinishedExecutor != null) {
    IReportItemExecutor childExecutor=null;
    if (unfinishedExecutor != null) {
      childExecutor=unfinishedExecutor;
      unfinishedExecutor=null;
    }
 else {
      childExecutor=executor.getNextChild();
    }
    assert(childExecutor != null);
    childHasNext=handleChild(childExecutor) || childHasNext;
    if (childHasNext && unfinishedExecutor != null) {
      if (lineFinished) {
        return true;
      }
    }
  }
  return childHasNext;
}
Program: 77721
Project: 77721
Buggy source:
/** 
 * Initializes the pdfEmitter.
 * @param services 							the emitter svervices object.
 */
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);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Initializes the pdfEmitter.
 * @param services 							the emitter svervices object.
 */
public void initialize(IEmitterServices services){
  this.services=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: 77724
Project: 77724
Buggy source:
/** 
 * @param ri
 * @return
 * @throws DataException 
 */
public int getRowID(IResultIterator ri) throws DataException {
  if (mode == -1)   init(ri);
  if (mode == MODE_NORMAL)   return ri.getCurrentResultIndex();
 else   return ((Integer)ri.getCurrentResult().getFieldValue(rowIDPos)).intValue();
}

Fixed version (ground truth):
/** 
 * @param ri
 * @return
 * @throws DataException 
 */
public int getRowID(IResultIterator ri) throws DataException {
  if (mode == -1)   init(ri);
  if (mode == MODE_NORMAL) {
    return ri.getCurrentResultIndex();
  }
 else {
    IResultObject ob=ri.getCurrentResult();
    if (ob == null)     return -1;
 else     return ((Integer)ob.getFieldValue(rowIDPos)).intValue();
  }
}
Program: 77725
Project: 77725
Buggy source:
public boolean layout(){
  if (status != STATUS_END) {
    context.setPageEmpty(false);
  }
  return super.layout();
}

Fixed version (ground truth):
public boolean layout(){
  boolean hasNext=super.layout();
  if (status != STATUS_START) {
    context.setPageEmpty(false);
  }
  return hasNext;
}