nus-yam/ex-repair huggingface dataset:
Program: 67061
Project: 67061
Buggy source:
protected void editValue(Control control){
  String initValue=null;
  if (control instanceof Text) {
    initValue=((Text)control).getText();
  }
 else   if (control instanceof Combo) {
    initValue=((Combo)control).getText();
  }
  ExpressionBuilder expressionBuilder=new ExpressionBuilder(getShell(),initValue);
  if (designHandle != null) {
    if (expressionProvider == null) {
      ExpressionProvider exprProvider=new ChartCubeFilterExpressionProvider(designHandle,fExprMap.values().toArray(new String[]{}));
      expressionBuilder.setExpressionProvider(exprProvider);
    }
 else     expressionBuilder.setExpressionProvider(expressionProvider);
  }
  if (expressionBuilder.open() == OK) {
    String result=DEUtil.resolveNull(expressionBuilder.getResult());
    if (control instanceof Text) {
      ((Text)control).setText(result);
    }
 else     if (control instanceof Combo) {
      ((Combo)control).setText(result);
    }
  }
  updateButtons();
}

Fixed version (ground truth):
protected void editValue(Control control){
  String initValue=null;
  if (control instanceof Text) {
    initValue=((Text)control).getText();
  }
 else   if (control instanceof Combo) {
    initValue=((Combo)control).getText();
  }
 else   if (control instanceof CCombo) {
    initValue=((CCombo)control).getText();
  }
  ExpressionBuilder expressionBuilder=new ExpressionBuilder(getShell(),initValue);
  if (designHandle != null) {
    if (expressionProvider == null) {
      ExpressionProvider exprProvider=new ChartCubeFilterExpressionProvider(designHandle,fExprMap.values().toArray(new String[]{}));
      expressionBuilder.setExpressionProvider(exprProvider);
    }
 else     expressionBuilder.setExpressionProvider(expressionProvider);
  }
  if (expressionBuilder.open() == OK) {
    String result=DEUtil.resolveNull(expressionBuilder.getResult());
    if (control instanceof Text) {
      ((Text)control).setText(result);
    }
 else     if (control instanceof Combo) {
      ((Combo)control).setText(result);
    }
 else     if (control instanceof CCombo) {
      ((CCombo)control).setText(result);
    }
  }
  updateButtons();
}
Program: 67066
Project: 67066
Buggy source:
/** 
 * from object class to its type index value
 * @param obValue
 * @return
 */
private static int getTypeIndex(Object obValue){
  if (obValue == null)   return TYPE_NULL;
  if (obValue instanceof String) {
    if (isLongString((String)obValue)) {
      return TYPE_LONG_STRING;
    }
 else {
      return TYPE_STRING;
    }
  }
  Integer indexOb=(Integer)type2IndexMap.get(obValue.getClass());
  if (indexOb == null) {
    if (obValue instanceof Map) {
      return TYPE_MAP;
    }
    if (obValue instanceof List) {
      return TYPE_LIST;
    }
    if (obValue instanceof Scriptable) {
      return TYPE_JSObject;
    }
    if (Timestamp.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_TIME_STAMP;
    }
    if (Time.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_TIME;
    }
    if (java.sql.Date.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_DATE;
    }
    if (Date.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_DATE_TIME;
    }
    if (obValue instanceof Serializable) {
      return TYPE_SERIALIZABLE;
    }
    return -1;
  }
  return indexOb.intValue();
}

Fixed version (ground truth):
/** 
 * from object class to its type index value
 * @param obValue
 * @return
 */
public static int getTypeIndex(Object obValue){
  if (obValue == null)   return TYPE_NULL;
  if (obValue instanceof String) {
    if (isLongString((String)obValue)) {
      return TYPE_LONG_STRING;
    }
 else {
      return TYPE_STRING;
    }
  }
  Integer indexOb=(Integer)type2IndexMap.get(obValue.getClass());
  if (indexOb == null) {
    if (obValue instanceof Map) {
      return TYPE_MAP;
    }
    if (obValue instanceof List) {
      return TYPE_LIST;
    }
    if (obValue instanceof Scriptable) {
      return TYPE_JSObject;
    }
    if (Timestamp.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_TIME_STAMP;
    }
    if (Time.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_TIME;
    }
    if (java.sql.Date.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_DATE;
    }
    if (Date.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_DATE_TIME;
    }
    if (obValue instanceof Serializable) {
      return TYPE_SERIALIZABLE;
    }
    return -1;
  }
  return indexOb.intValue();
}
Program: 67068
Project: 67068
Buggy source:
/** 
 * To populate the relational measures from binding list of queryDefn
 * @param queryDefn
 */
private static void populateMeasureFromBinding(ICubeQueryDefinition queryDefn,ScriptContext cx) throws DataException {
  for (int i=0; i < queryDefn.getBindings().size(); i++) {
    createRelationalMeasures(queryDefn,(IBaseExpression)((IBinding)queryDefn.getBindings().get(i)).getExpression(),cx);
  }
}

Fixed version (ground truth):
/** 
 * To populate the relational measures from binding list of queryDefn
 * @param queryDefn
 */
private static void populateMeasureFromBinding(ICubeQueryDefinition queryDefn,ScriptContext cx) throws DataException {
  for (int i=0; i < queryDefn.getBindings().size(); i++) {
    List measureList=createRelationalMeasures(queryDefn,(IBaseExpression)((IBinding)queryDefn.getBindings().get(i)).getExpression(),cx);
    String functionName=((IBinding)queryDefn.getBindings().get(i)).getAggrFunction();
    if (functionName != null) {
      for (int j=0; j < measureList.size(); j++) {
        ((IMeasureDefinition)measureList.get(j)).setAggrFunction(functionName);
      }
    }
  }
}
Program: 67069
Project: 67069
Buggy source:
/** 
 * from object class to its type index value
 * @param obValue
 * @return
 */
public static int getTypeIndex(Object obValue){
  if (obValue == null)   return TYPE_NULL;
  if (obValue instanceof String) {
    if (isLongString((String)obValue)) {
      return TYPE_LONG_STRING;
    }
 else {
      return TYPE_STRING;
    }
  }
  Integer indexOb=(Integer)type2IndexMap.get(obValue.getClass());
  if (indexOb == null) {
    if (obValue instanceof Map) {
      return TYPE_MAP;
    }
    if (obValue instanceof List) {
      return TYPE_LIST;
    }
    if (obValue instanceof Scriptable) {
      if (obValue instanceof IdScriptableObject) {
        IdScriptableObject jsObject=((IdScriptableObject)obValue);
        if (jsObject.getClassName().equals("String_Node_Str")) {
          return TYPE_JSObject;
        }
        return -1;
      }
 else       if (obValue instanceof NativeJavaObject) {
        return TYPE_JSObject;
      }
      return -1;
    }
    if (Timestamp.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_TIME_STAMP;
    }
    if (Time.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_TIME;
    }
    if (java.sql.Date.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_DATE;
    }
    if (Date.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_DATE_TIME;
    }
    if (obValue instanceof Serializable) {
      return TYPE_SERIALIZABLE;
    }
    return -1;
  }
  return indexOb.intValue();
}

Fixed version (ground truth):
/** 
 * from object class to its type index value
 * @param obValue
 * @return
 */
private static int getTypeIndex(Object obValue){
  if (obValue == null)   return TYPE_NULL;
  if (obValue instanceof String) {
    if (isLongString((String)obValue)) {
      return TYPE_LONG_STRING;
    }
 else {
      return TYPE_STRING;
    }
  }
  Integer indexOb=(Integer)type2IndexMap.get(obValue.getClass());
  if (indexOb == null) {
    if (obValue instanceof Map) {
      return TYPE_MAP;
    }
    if (obValue instanceof List) {
      return TYPE_LIST;
    }
    if (obValue instanceof Scriptable) {
      return TYPE_JSObject;
    }
    if (Timestamp.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_TIME_STAMP;
    }
    if (Time.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_TIME;
    }
    if (java.sql.Date.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_DATE;
    }
    if (Date.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_DATE_TIME;
    }
    if (obValue instanceof Serializable) {
      return TYPE_SERIALIZABLE;
    }
    return -1;
  }
  return indexOb.intValue();
}
Program: 67071
Project: 67071
Buggy source:
public String formatValue(Object value) throws BirtException {
  if (directFormatter == null) {
    if (value instanceof java.util.Date) {
      directFormatter=new DateFormatter(pattern,this.locale,this.timeZone);
    }
 else     if (value instanceof Number) {
      directFormatter=new NumberFormatter(pattern,this.locale);
    }
 else     if (value instanceof String) {
      directFormatter=new StringFormatter(pattern,this.locale);
    }
 else {
      directFormatter=new DefaultFormatter(locale);
    }
  }
  return directFormatter.formatValue(value);
}

Fixed version (ground truth):
public String formatValue(Object value) throws BirtException {
  if (directFormatter == null) {
    if (value instanceof java.util.Date) {
      directFormatter=new DateFormatter(pattern,this.locale,this.timeZone);
    }
 else     if (value instanceof Number) {
      directFormatter=new NumberFormatter(pattern,this.locale);
    }
 else     if (pattern != null && value instanceof String) {
      directFormatter=new StringFormatter(pattern,this.locale);
    }
 else {
      directFormatter=new DefaultFormatter(locale);
    }
  }
  return directFormatter.formatValue(value);
}
Program: 67072
Project: 67072
Buggy source:
/** 
 * Returns the string value by object, according the the isLocaleNeutral option and the user specified formats(date format, number format, string format), if available.
 * @param dataIterator
 * @param columnNames
 * @param index
 * @return string representation of the object
 * @throws BirtException
 */
protected String getStringValue(IDataIterator dataIterator,String[] columnNames,int index) throws BirtException {
  Object obj=dataIterator.getValue(columnNames[index]);
  String value=null;
  if (isLocaleNeutral) {
    value=DataTypeUtil.toLocaleNeutralString(obj);
  }
 else {
    value=valueFormatters[index].formatValue(obj);
  }
  return value;
}

Fixed version (ground truth):
/** 
 * Returns the string value by object, according the the isLocaleNeutral option and the user specified formats(date format, number format, string format), if available.
 * @param dataIterator
 * @param columnNames
 * @param index
 * @return string representation of the object
 * @throws BirtException
 */
protected String getStringValue(IDataIterator dataIterator,String[] columnNames,int index) throws BirtException {
  Object obj=dataIterator.getValue(columnNames[index]);
  String value=null;
  if (isLocaleNeutral) {
    value=DataTypeUtil.toLocaleNeutralString(obj);
  }
 else   if (obj != null) {
    value=valueFormatters[index].formatValue(obj);
  }
  return value;
}
Program: 67073
Project: 67073
Buggy source:
protected void createFormatters(String[] columnNames,int[] columnTypes){
  int length=columnNames.length;
  valueFormatters=new IFormatter[length];
  String[] patterns=getPatterns(columnNames);
  for (int i=0; i < length; i++) {
switch (columnTypes[i]) {
case DataType.ANY_TYPE:
case DataType.UNKNOWN_TYPE:
case DataType.JAVA_OBJECT_TYPE:
      valueFormatters[i]=new AutoFormatter(patterns[i],this.locale,this.timeZone);
    break;
case DataType.DATE_TYPE:
case DataType.SQL_DATE_TYPE:
case DataType.SQL_TIME_TYPE:
  if (patterns[i] != null) {
    valueFormatters[i]=createDateFormatter(patterns[i],this.locale,this.timeZone);
  }
 else {
    valueFormatters[i]=dateFormatter;
  }
break;
case DataType.DECIMAL_TYPE:
case DataType.DOUBLE_TYPE:
case DataType.INTEGER_TYPE:
valueFormatters[i]=new NumberFormatter(patterns[i],this.locale);
break;
case DataType.STRING_TYPE:
valueFormatters[i]=new StringFormatter(patterns[i],this.locale);
break;
default :
valueFormatters[i]=new DefaultFormatter(this.locale);
break;
}
}
}

Fixed version (ground truth):
protected void createFormatters(String[] columnNames,int[] columnTypes){
  int length=columnNames.length;
  valueFormatters=new IFormatter[length];
  String[] patterns=getPatterns(columnNames);
  for (int i=0; i < length; i++) {
switch (columnTypes[i]) {
case DataType.ANY_TYPE:
case DataType.UNKNOWN_TYPE:
case DataType.JAVA_OBJECT_TYPE:
      valueFormatters[i]=new AutoFormatter(patterns[i],this.locale,this.timeZone);
    break;
case DataType.DATE_TYPE:
case DataType.SQL_DATE_TYPE:
case DataType.SQL_TIME_TYPE:
  if (patterns[i] != null) {
    valueFormatters[i]=createDateFormatter(patterns[i],this.locale,this.timeZone);
  }
 else {
    valueFormatters[i]=dateFormatter;
  }
break;
case DataType.DECIMAL_TYPE:
case DataType.DOUBLE_TYPE:
case DataType.INTEGER_TYPE:
valueFormatters[i]=new NumberFormatter(patterns[i],this.locale);
break;
case DataType.STRING_TYPE:
if (patterns[i] != null) {
valueFormatters[i]=new StringFormatter(patterns[i],this.locale);
}
 else {
valueFormatters[i]=new DefaultFormatter(this.locale);
}
break;
default :
valueFormatters[i]=new DefaultFormatter(this.locale);
break;
}
}
}
Program: 67074
Project: 67074
Buggy source:
public void defineCube(CubeHandle cubeHandle) throws BirtException {
  if (CubeHandleUtil.defineCube(this.dataEngine,cubeHandle,this.sessionContext.getAppContext()))   return;
  Set involvedDataSets=getInvolvedDataSets((TabularCubeHandle)cubeHandle);
  Iterator itr=involvedDataSets.iterator();
  while (itr.hasNext()) {
    DataSetHandle dsHandle=(DataSetHandle)itr.next();
    BaseDataSourceDesign baseDataSource=this.modelAdaptor.adaptDataSource(dsHandle.getDataSource());
    BaseDataSetDesign baseDataSet=this.modelAdaptor.adaptDataSet(dsHandle);
    if (baseDataSource != null && this.dataEngine.getDataSourceRuntime(baseDataSource.getName()) == null)     this.defineDataSource(baseDataSource);
    if (this.dataEngine.getDataSetDesign(baseDataSet.getName()) == null) {
      DefineDataSourceSetUtil.defineDataSourceAndDataSet(dsHandle,this);
    }
  }
  if (!cubeHandleMap.containsKey(cubeHandle.getQualifiedName())) {
    this.cubeHandleMap.put(cubeHandle.getQualifiedName(),cubeHandle);
  }
}

Fixed version (ground truth):
public void defineCube(CubeHandle cubeHandle) throws BirtException {
  if (CubeHandleUtil.defineCube(this.dataEngine,cubeHandle,this.sessionContext.getAppContext()))   return;
  Set involvedDataSets=getInvolvedDataSets((TabularCubeHandle)cubeHandle);
  Iterator itr=involvedDataSets.iterator();
  while (itr.hasNext()) {
    DataSetHandle dsHandle=(DataSetHandle)itr.next();
    BaseDataSourceDesign baseDataSource=this.modelAdaptor.adaptDataSource(dsHandle.getDataSource());
    BaseDataSetDesign baseDataSet=this.modelAdaptor.adaptDataSet(dsHandle);
    if (baseDataSource != null && this.dataEngine.getDataSourceRuntime(baseDataSource.getName()) == null)     this.defineDataSource(baseDataSource);
    if (this.dataEngine.getDataSetDesign(baseDataSet.getName()) == null) {
      DefineDataSourceSetUtil.defineDataSourceAndDataSet(dsHandle,this);
    }
  }
  if (!cubeHandleMap.containsKey(cubeHandle.getQualifiedName())) {
    this.cubeHandleMap.put(cubeHandle.getQualifiedName(),cubeHandle);
  }
  prepareForCubeGeneration((TabularCubeHandle)cubeHandle);
}
Program: 67077
Project: 67077
Buggy source:
/** 
 * Populate all dimensions.
 * @param cubeMaterializer
 * @param dimHandles
 * @param stopSign
 * @return
 * @throws AdapterException 
 * @throws IOException
 * @throws BirtException
 * @throws DataException
 */
private IDimension[] populateDimensions(CubeMaterializer cubeMaterializer,TabularCubeHandle cubeHandle,Map appContext,Map<ReportElementHandle,QueryDefinition> queryMap,Map<ReportElementHandle,List<ColumnMeta>> metaMap,SecurityListener sl) throws AdapterException {
  List dimHandles=cubeHandle.getContents(CubeHandle.DIMENSIONS_PROP);
  List result=new ArrayList();
  for (int i=0; i < dimHandles.size(); i++) {
    DimensionHandle dh=(DimensionHandle)dimHandles.get(i);
    IDimension dim=createdDimensions.get(dh.getName());
    if (dim == null) {
      dim=populateDimension(cubeMaterializer,dh,cubeHandle,appContext,queryMap,metaMap,sl);
      createdDimensions.put(dh.getName(),dim);
    }
    result.add(dim);
  }
  IDimension[] dimArray=new IDimension[dimHandles.size()];
  for (int i=0; i < result.size(); i++) {
    dimArray[i]=(IDimension)result.get(i);
  }
  return dimArray;
}

Fixed version (ground truth):
/** 
 * Populate all dimensions.
 * @param cubeMaterializer
 * @param dimHandles
 * @param stopSign
 * @return
 * @throws AdapterException 
 * @throws IOException
 * @throws BirtException
 * @throws DataException
 */
private IDimension[] populateDimensions(CubeMaterializer cubeMaterializer,TabularCubeHandle cubeHandle,Map appContext,SecurityListener sl) throws AdapterException {
  List dimHandles=cubeHandle.getContents(CubeHandle.DIMENSIONS_PROP);
  List result=new ArrayList();
  for (int i=0; i < dimHandles.size(); i++) {
    DimensionHandle dh=(DimensionHandle)dimHandles.get(i);
    IDimension dim=createdDimensions.get(dh.getName());
    if (dim == null) {
      dim=populateDimension(cubeMaterializer,dh,cubeHandle,appContext,sl);
      createdDimensions.put(dh.getName(),dim);
    }
    result.add(dim);
  }
  IDimension[] dimArray=new IDimension[dimHandles.size()];
  for (int i=0; i < result.size(); i++) {
    dimArray[i]=(IDimension)result.get(i);
  }
  return dimArray;
}
Program: 67079
Project: 67079
Buggy source:
private ColumnHintHandle findColumnHint(DataSetHandle handle,String columnName){
  if (columnName == null || columnName.trim().length() == 0)   return null;
  ColumnHintHandle hint=null;
  Iterator iter=handle.getPropertyHandle(DataSetHandle.COLUMN_HINTS_PROP).iterator();
  while (iter.hasNext()) {
    hint=(ColumnHintHandle)iter.next();
    if (columnName.equals(hint.getColumnName())) {
      return hint;
    }
  }
  if (hint == null && (handle instanceof DerivedDataSetHandle)) {
    List<DataSetHandle> inputDataSets=((DerivedDataSetHandle)handle).getInputDataSets();
    for (int i=0; i < inputDataSets.size(); i++) {
      hint=findColumnHint(inputDataSets.get(i),columnName);
      if (hint != null) {
        return hint;
      }
    }
  }
  return hint;
}

Fixed version (ground truth):
private ColumnHintHandle findColumnHint(DataSetHandle handle,String columnName){
  if (columnName == null || columnName.trim().length() == 0)   return null;
  ColumnHintHandle hint=null;
  Iterator iter=handle.getPropertyHandle(DataSetHandle.COLUMN_HINTS_PROP).iterator();
  while (iter.hasNext()) {
    hint=(ColumnHintHandle)iter.next();
    if (columnName.equals(hint.getColumnName())) {
      return hint;
    }
  }
  if (hint == null && (handle instanceof DerivedDataSetHandle)) {
    List<DataSetHandle> inputDataSets=((DerivedDataSetHandle)handle).getInputDataSets();
    for (int i=0; i < inputDataSets.size(); i++) {
      hint=findColumnHint(inputDataSets.get(i),columnName);
      if (hint != null) {
        return hint;
      }
    }
  }
  return null;
}
Program: 67080
Project: 67080
Buggy source:
private void openReportDocument() throws EngineException {
  try {
    if (archiveWriter == null) {
      openArchive();
    }
    String[] exts=executionContext.getEngineExtensions();
    writer=new ReportDocumentWriter(engine,archiveWriter,exts);
    executionContext.setReportDocWriter(writer);
    DocumentDataSource ds=executionContext.getDataSource();
    if (ds != null) {
      writer.saveReportletDocument(ds.getBookmark(),ds.getInstanceID());
    }
  }
 catch (  IOException ex) {
    throw new EngineException(MessageConstants.REPORT_ARCHIVE_OPEN_ERROR,ex);
  }
}

Fixed version (ground truth):
private void openReportDocument() throws EngineException {
  try {
    if (archiveWriter == null) {
      openArchive();
    }
    String[] exts=executionContext.getEngineExtensions();
    writer=new ReportDocumentWriter(engine,archiveWriter,exts);
    executionContext.setReportDocWriter(writer);
    DocumentDataSource ds=executionContext.getDataSource();
    if (ds != null && ds.isReportletDocument()) {
      writer.saveReportletDocument(ds.getBookmark(),ds.getInstanceID());
    }
  }
 catch (  IOException ex) {
    throw new EngineException(MessageConstants.REPORT_ARCHIVE_OPEN_ERROR,ex);
  }
}
Program: 67081
Project: 67081
Buggy source:
protected void writeContent(int type,String txt,IContent content){
  if (inForeign) {
    hasPInside=true;
  }
  context.addContainer(false);
  InlineFlag inlineFlag=InlineFlag.BLOCK;
  IStyle computedStyle=content.getComputedStyle();
  IStyle inlineStyle=null;
  if ("String_Node_Str".equalsIgnoreCase(content.getComputedStyle().getDisplay())) {
    if (context.isFirstInline()) {
      context.startInline();
      inlineFlag=InlineFlag.FIRST_INLINE;
      if (!styles.isEmpty()) {
        computedStyle=styles.peek();
      }
    }
 else     inlineFlag=InlineFlag.MIDDLE_INLINE;
    if (!inlineStyles.isEmpty()) {
      inlineStyle=mergeStyles(inlineStyles);
    }
  }
 else {
    adjustInline();
  }
  writeBookmark(content);
  writeToc(content);
  writeText(type,txt,content,inlineFlag,computedStyle,inlineStyle);
  context.setLastIsTable(false);
}

Fixed version (ground truth):
protected void writeContent(int type,String txt,IContent content){
  if (inForeign) {
    hasPInside=true;
  }
  context.addContainer(false);
  InlineFlag inlineFlag=InlineFlag.BLOCK;
  IStyle computedStyle=content.getComputedStyle();
  IStyle inlineStyle=null;
  if ("String_Node_Str".equalsIgnoreCase(content.getComputedStyle().getDisplay())) {
    if (context.isFirstInline()) {
      context.startInline();
      inlineFlag=InlineFlag.FIRST_INLINE;
      computedStyle=computeStyle(computedStyle);
    }
 else     inlineFlag=InlineFlag.MIDDLE_INLINE;
    if (!inlineStyles.isEmpty()) {
      inlineStyle=mergeStyles(inlineStyles);
    }
  }
 else {
    adjustInline();
  }
  writeBookmark(content);
  writeToc(content);
  writeText(type,txt,content,inlineFlag,computedStyle,inlineStyle);
  context.setLastIsTable(false);
}
Program: 67083
Project: 67083
Buggy source:
/** 
 * Adds new object to container
 * @param container container, not null
 * @param handle new object. If new object is null, create nothing
 * @throws SemanticException
 */
public static void addElementHandle(Object container,DesignElementHandle handle) throws SemanticException {
  assert(container != null);
  if (handle == null) {
    return;
  }
  container=unwrapToModel(container);
  if (container instanceof DesignElementHandle) {
    ((DesignElementHandle)container).addElement(handle,DEUtil.getDefaultSlotID(container));
  }
 else   if (container instanceof SlotHandle) {
    ((SlotHandle)container).add(handle);
  }
}

Fixed version (ground truth):
/** 
 * Adds new object to container
 * @param container container, not null
 * @param handle new object. If new object is null, create nothing
 * @throws SemanticException
 */
public static void addElementHandle(Object container,DesignElementHandle handle) throws SemanticException {
  assert(container != null);
  if (handle == null) {
    return;
  }
  container=unwrapToModel(container);
  if (container instanceof CellHandle && handle instanceof TableGroupHandle) {
    DesignElementHandle cellHandle=(CellHandle)container;
    TableHandle tableHandle=null;
    while (cellHandle.getContainer() != null) {
      cellHandle=cellHandle.getContainer();
      if (cellHandle instanceof TableHandle) {
        tableHandle=(TableHandle)cellHandle;
        break;
      }
    }
    if (tableHandle != null) {
      tableHandle.getGroups().add(handle,tableHandle.getGroups().getCount());
    }
  }
 else   if (container instanceof DesignElementHandle) {
    ((DesignElementHandle)container).addElement(handle,DEUtil.getDefaultSlotID(container));
  }
 else   if (container instanceof SlotHandle) {
    ((SlotHandle)container).add(handle);
  }
}
Program: 67086
Project: 67086
Buggy source:
private void openReportDocument() throws EngineException {
  try {
    if (archiveWriter == null) {
      openArchive();
    }
    String[] exts=executionContext.getEngineExtensions();
    writer=new ReportDocumentWriter(engine,archiveWriter,exts);
    executionContext.setReportDocWriter(writer);
    DocumentDataSource ds=executionContext.getDataSource();
    if (ds != null && ds.isReportletDocument()) {
      writer.saveReportletDocument(ds.getBookmark(),ds.getInstanceID());
    }
  }
 catch (  IOException ex) {
    throw new EngineException(MessageConstants.REPORT_ARCHIVE_OPEN_ERROR,ex);
  }
}

Fixed version (ground truth):
private void openReportDocument() throws EngineException {
  try {
    if (archiveWriter == null) {
      openArchive();
    }
    String[] exts=executionContext.getEngineExtensions();
    writer=new ReportDocumentWriter(engine,archiveWriter,exts);
    executionContext.setReportDocWriter(writer);
    DocumentDataSource ds=executionContext.getDataSource();
    if (ds != null) {
      if (ds.isReportletDocument()) {
        writer.saveReportletDocument(ds.getBookmark(),ds.getInstanceID());
      }
 else {
        writer.removeReportletDoucment();
      }
    }
  }
 catch (  IOException ex) {
    throw new EngineException(MessageConstants.REPORT_ARCHIVE_OPEN_ERROR,ex);
  }
}
Program: 67087
Project: 67087
Buggy source:
public void flush() throws BirtException {
  if (page != null) {
    context.getPageHintManager().addTableColumnHints(columnHints);
    context.getPageHintManager().generatePageRowHints(getTableKeys());
    updatePageNumber();
    page.flush();
    pageBreakEvent();
    if (!page.finished) {
      context.setPageNumber(context.getPageNumber() + 1);
      context.setPageCount(context.getPageCount() + 1);
    }
    generator.reset();
    context.getPageHintManager().clearPageHint();
    currentNode=null;
  }
}

Fixed version (ground truth):
public void flush() throws BirtException {
  if (page != null) {
    context.getPageHintManager().addTableColumnHints(columnHints);
    context.getPageHintManager().generatePageRowHints(getTableKeys());
    updatePageContent();
    page.flush();
    pageBreakEvent();
    if (!page.finished) {
      context.setPageNumber(context.getPageNumber() + 1);
      context.setPageCount(context.getPageCount() + 1);
    }
    generator.reset();
    context.getPageHintManager().clearPageHint();
    currentNode=null;
  }
}
Program: 67088
Project: 67088
Buggy source:
protected void handlePageBreakInterval(){
  GroupDesign groupDesign=(GroupDesign)design;
  if (groupDesign.getGroupLevel() == listingExecutor.pageBreakLevel) {
    listingExecutor.next();
    if (listingExecutor.needSoftBreakAfter()) {
      listingExecutor.softBreakBefore=true;
      listingExecutor.pageRowCount=0;
    }
 else     if (listingExecutor.softBreakBefore) {
      IStyle style=content.getStyle();
      if (style != null) {
        CSSValue pageBreak=style.getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE);
        if (pageBreak == null || IStyle.AUTO_VALUE.equals(pageBreak)) {
          style.setProperty(IStyle.STYLE_PAGE_BREAK_BEFORE,IStyle.SOFT_VALUE);
        }
      }
      listingExecutor.softBreakBefore=false;
      listingExecutor.previous();
      listingExecutor.addAfterBreak=true;
    }
  }
}

Fixed version (ground truth):
protected void handlePageBreakInterval(){
  GroupDesign groupDesign=(GroupDesign)design;
  if (groupDesign.getGroupLevel() == listingExecutor.pageBreakLevel) {
    if (listingExecutor.softBreakBefore) {
      IStyle style=content.getStyle();
      if (style != null) {
        CSSValue pageBreak=style.getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE);
        if (pageBreak == null || IStyle.AUTO_VALUE.equals(pageBreak)) {
          style.setProperty(IStyle.STYLE_PAGE_BREAK_BEFORE,IStyle.SOFT_VALUE);
        }
      }
      listingExecutor.softBreakBefore=false;
      listingExecutor.addAfterBreak=true;
      listingExecutor.pageRowCount=0;
    }
    listingExecutor.next();
    if (listingExecutor.needSoftBreakAfter()) {
      listingExecutor.softBreakBefore=true;
    }
  }
}
Program: 67089
Project: 67089
Buggy source:
protected void handlePageBreakInterval(){
  if (listExecutor.breakOnDetailBand) {
    BandDesign band=(BandDesign)design;
    if (band.getBandType() == BandDesign.BAND_DETAIL) {
      listExecutor.next();
      if (listExecutor.needSoftBreakAfter()) {
        listExecutor.softBreakBefore=true;
        listExecutor.pageRowCount=0;
      }
 else       if (listExecutor.softBreakBefore) {
        IStyle style=content.getStyle();
        if (style != null) {
          CSSValue pageBreak=style.getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE);
          if (pageBreak == null || IStyle.AUTO_VALUE.equals(pageBreak)) {
            style.setProperty(IStyle.STYLE_PAGE_BREAK_BEFORE,IStyle.SOFT_VALUE);
          }
        }
        listExecutor.softBreakBefore=false;
        listExecutor.previous();
        listExecutor.addAfterBreak=true;
      }
    }
  }
}

Fixed version (ground truth):
protected void handlePageBreakInterval(){
  if (listExecutor.breakOnDetailBand) {
    BandDesign band=(BandDesign)design;
    if (band.getBandType() == BandDesign.BAND_DETAIL) {
      if (listExecutor.softBreakBefore) {
        IStyle style=content.getStyle();
        if (style != null) {
          CSSValue pageBreak=style.getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE);
          if (pageBreak == null || IStyle.AUTO_VALUE.equals(pageBreak)) {
            style.setProperty(IStyle.STYLE_PAGE_BREAK_BEFORE,IStyle.SOFT_VALUE);
          }
        }
        listExecutor.softBreakBefore=false;
        listExecutor.addAfterBreak=true;
        listExecutor.pageRowCount=0;
      }
      listExecutor.next();
      if (listExecutor.needSoftBreakAfter()) {
        listExecutor.softBreakBefore=true;
      }
    }
  }
}
Program: 67090
Project: 67090
Buggy source:
protected void handlePageBreakInterval(){
  if (tableExecutor.breakOnDetailBand) {
    BandDesign band=(BandDesign)design;
    if (band.getBandType() == BandDesign.BAND_DETAIL) {
      tableExecutor.next();
      if (tableExecutor.needSoftBreakAfter()) {
        tableExecutor.softBreakBefore=true;
        tableExecutor.pageRowCount=0;
      }
 else       if (tableExecutor.softBreakBefore) {
        IStyle style=content.getStyle();
        if (style != null) {
          CSSValue pageBreak=style.getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE);
          if (pageBreak == null || IStyle.AUTO_VALUE.equals(pageBreak)) {
            style.setProperty(IStyle.STYLE_PAGE_BREAK_BEFORE,IStyle.SOFT_VALUE);
          }
        }
        tableExecutor.softBreakBefore=false;
        tableExecutor.previous();
        tableExecutor.addAfterBreak=true;
      }
    }
  }
}

Fixed version (ground truth):
protected void handlePageBreakInterval(){
  if (tableExecutor.breakOnDetailBand) {
    BandDesign band=(BandDesign)design;
    if (band.getBandType() == BandDesign.BAND_DETAIL) {
      if (tableExecutor.softBreakBefore) {
        IStyle style=content.getStyle();
        if (style != null) {
          CSSValue pageBreak=style.getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE);
          if (pageBreak == null || IStyle.AUTO_VALUE.equals(pageBreak)) {
            style.setProperty(IStyle.STYLE_PAGE_BREAK_BEFORE,IStyle.SOFT_VALUE);
          }
        }
        tableExecutor.softBreakBefore=false;
        tableExecutor.addAfterBreak=true;
        tableExecutor.pageRowCount=0;
      }
      tableExecutor.next();
      if (tableExecutor.needSoftBreakAfter()) {
        tableExecutor.softBreakBefore=true;
      }
    }
  }
}
Program: 67091
Project: 67091
Buggy source:
/** 
 * Remove all available computed column if it has been pre-calculated by computerColumnHelper.
 */
private void removeAvailableComputedColumns(){
  if (iccState != null) {
    for (int i=0; i < iccState.getCount(); i++) {
      if (iccState.isValueAvailable(i)) {
        for (int k=0; k < this.populator.getQuery().getFetchEvents().size(); k++) {
          if (this.populator.getQuery().getFetchEvents().get(k) instanceof ComputedColumnHelper) {
            ComputedColumnHelper helper=(ComputedColumnHelper)this.populator.getQuery().getFetchEvents().get(k);
            helper.getComputedColumnList().remove(iccState.getComputedColumn(i));
            break;
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Remove all available computed column if it has been pre-calculated by computerColumnHelper.
 */
private void removeAvailableComputedColumns(){
  if (iccState != null) {
    for (int i=0; i < iccState.getCount(); i++) {
      if (iccState.isValueAvailable(i)) {
        for (int k=0; k < this.populator.getQuery().getFetchEvents().size(); k++) {
          if (this.populator.getQuery().getFetchEvents().get(k) instanceof ComputedColumnHelper) {
            ComputedColumnHelper helper=(ComputedColumnHelper)this.populator.getQuery().getFetchEvents().get(k);
            helper.removeAvailableComputedColumn(iccState.getComputedColumn(i));
            break;
          }
        }
      }
    }
  }
}
Program: 67092
Project: 67092
Buggy source:
public ComputedColumnHelperInstance(DataSetRuntime dataSet,List computedColumns,Mode mode,ScriptContext cx) throws DataException {
  this.ccList=new ArrayList();
  for (int i=0; i < computedColumns.size(); i++)   this.ccList.add(computedColumns.get(i));
  this.isPrepared=false;
  this.dataSet=dataSet;
  this.mode=mode;
  this.cx=cx.newContext(this.dataSet.getScriptScope());
}

Fixed version (ground truth):
public ComputedColumnHelperInstance(DataSetRuntime dataSet,List computedColumns,Mode mode,ScriptContext cx) throws DataException {
  this.ccList=new ArrayList();
  this.removedCCName=new ArrayList();
  for (int i=0; i < computedColumns.size(); i++)   this.ccList.add(computedColumns.get(i));
  this.isPrepared=false;
  this.dataSet=dataSet;
  this.mode=mode;
  this.cx=cx.newContext(this.dataSet.getScriptScope());
}
Program: 67098
Project: 67098
Buggy source:
private static void populateSummaryBinding(IQueryDefinition queryDefn,IResultClass rsMeta) throws DataException {
  Set<String> nameSet=new HashSet<String>();
  for (int i=1; i < rsMeta.getFieldCount(); i++) {
    nameSet.add(rsMeta.getFieldName(i));
  }
  Iterator<IBinding> bindingIt=queryDefn.getBindings().values().iterator();
  while (bindingIt.hasNext()) {
    IBinding binding=bindingIt.next();
    if (nameSet.contains(binding.getBindingName())) {
      binding.setAggrFunction(null);
      binding.getAggregatOns().clear();
      binding.getArguments().clear();
      binding.setExpression(new ScriptExpression(ExpressionUtil.createDataSetRowExpression(binding.getBindingName())));
    }
  }
}

Fixed version (ground truth):
private static void populateSummaryBinding(IQueryDefinition queryDefn,IResultClass rsMeta) throws DataException {
  Set<String> nameSet=new HashSet<String>();
  for (int i=1; i <= rsMeta.getFieldCount(); i++) {
    nameSet.add(rsMeta.getFieldName(i));
  }
  Iterator<IBinding> bindingIt=queryDefn.getBindings().values().iterator();
  while (bindingIt.hasNext()) {
    IBinding binding=bindingIt.next();
    if (nameSet.contains(binding.getBindingName())) {
      binding.setAggrFunction(null);
      binding.getAggregatOns().clear();
      binding.getArguments().clear();
      binding.setExpression(new ScriptExpression(ExpressionUtil.createDataSetRowExpression(binding.getBindingName())));
    }
  }
}
Program: 67099
Project: 67099
Buggy source:
/** 
 * Whether query is running based on the result set of report document or the data set.
 * @param dataEngine
 * @param queryDefn
 * @return true, running on result set
 * @throws DataException
 */
private static int runQueryOnRS(DataEngineImpl dataEngine,IQueryDefinition queryDefn) throws DataException {
  String queryResultID=queryDefn.getQueryResultsID();
  String rootQueryResultID=QueryResultIDUtil.get1PartID(queryResultID);
  String parentQueryResultID=null;
  if (rootQueryResultID != null)   parentQueryResultID=QueryResultIDUtil.get2PartID(queryResultID);
 else   rootQueryResultID=queryResultID;
  QueryResultInfo queryResultInfo=new QueryResultInfo(rootQueryResultID,parentQueryResultID,null,null,-1);
  RDLoad rdLoad=RDUtil.newLoad(dataEngine.getSession().getTempDir(),dataEngine.getContext(),queryResultInfo);
  IBaseQueryDefinition previousQueryDefn=rdLoad.loadQueryDefn(StreamManager.ROOT_STREAM,StreamManager.PARENT_SCOPE);
  if (QueryCompUtil.isIVQueryDefnEqual(dataEngine.getContext().getMode(),previousQueryDefn,queryDefn)) {
    return BASED_ON_PRESENTATION;
  }
 else {
    if (queryDefn.isSummaryQuery()) {
      IResultClass rsMeta=rdLoad.loadExprDataResultSet(true).getResultClass();
      populateSummaryBinding(queryDefn,rsMeta);
    }
    return BASED_ON_DATASET;
  }
}

Fixed version (ground truth):
/** 
 * Whether query is running based on the result set of report document or the data set.
 * @param dataEngine
 * @param queryDefn
 * @return true, running on result set
 * @throws DataException
 */
private static int runQueryOnRS(DataEngineImpl dataEngine,IQueryDefinition queryDefn) throws DataException {
  String queryResultID=queryDefn.getQueryResultsID();
  String rootQueryResultID=QueryResultIDUtil.get1PartID(queryResultID);
  String parentQueryResultID=null;
  if (rootQueryResultID != null)   parentQueryResultID=QueryResultIDUtil.get2PartID(queryResultID);
 else   rootQueryResultID=queryResultID;
  QueryResultInfo queryResultInfo=new QueryResultInfo(rootQueryResultID,parentQueryResultID,null,null,-1);
  RDLoad rdLoad=RDUtil.newLoad(dataEngine.getSession().getTempDir(),dataEngine.getContext(),queryResultInfo);
  IBaseQueryDefinition previousQueryDefn=rdLoad.loadQueryDefn(StreamManager.ROOT_STREAM,StreamManager.PARENT_SCOPE);
  if (QueryCompUtil.isIVQueryDefnEqual(dataEngine.getContext().getMode(),previousQueryDefn,queryDefn)) {
    return BASED_ON_PRESENTATION;
  }
 else {
    if (queryDefn.isSummaryQuery()) {
      IResultClass rsMeta=rdLoad.loadResultClass();
      populateSummaryBinding(queryDefn,rsMeta);
    }
    return BASED_ON_DATASET;
  }
}
Program: 67100
Project: 67100
Buggy source:
public void generatePageRowHints(Collection<String> keys){
  lastPageUnresolvedRowHints.clear();
  Iterator<String> iter=keys.iterator();
  while (iter.hasNext()) {
    String key=iter.next();
    UnresolvedRowHint hint=parallelPagesUnresolvedRowHints.get(key);
    if (hint != null) {
      lastPageUnresolvedRowHints.put(key,hint);
    }
  }
}

Fixed version (ground truth):
public void generatePageRowHints(Collection<String> keys){
  pageRowHint.clear();
  Iterator<String> iter=keys.iterator();
  while (iter.hasNext()) {
    String key=iter.next();
    UnresolvedRowHint hint=hints.get(key);
    if (hint != null) {
      pageRowHint.put(key,hint);
    }
  }
}
Program: 67101
Project: 67101
Buggy source:
public HashMap<String,UnresolvedRowHint> getUnresolvedRowHints(){
  return lastPageUnresolvedRowHints;
}

Fixed version (ground truth):
public HashMap<String,UnresolvedRowHint> getUnresolvedRowHints(){
  return pageRowHint;
}
Program: 67102
Project: 67102
Buggy source:
public void addUnresolvedRowHint(String key,UnresolvedRowHint hint){
  currentPageUnresolvedRowHints.put(key,hint);
}

Fixed version (ground truth):
public void addUnresolvedRowHint(String key,UnresolvedRowHint hint){
  currentHints.put(key,hint);
}
Program: 67103
Project: 67103
Buggy source:
public UnresolvedRowHint getUnresolvedRowHint(String key){
  if (parallelPagesUnresolvedRowHints.size() > 0) {
    return parallelPagesUnresolvedRowHints.get(key);
  }
  return null;
}

Fixed version (ground truth):
public UnresolvedRowHint getUnresolvedRowHint(String key){
  if (hints.size() > 0) {
    return hints.get(key);
  }
  return null;
}
Program: 67104
Project: 67104
Buggy source:
public void setLayoutPageHint(IPageHint pageHint){
  if (pageHint != null) {
    context.pageNumber=pageHint.getPageNumber();
    context.masterPage=pageHint.getMasterPage();
    int count=pageHint.getTableColumnHintCount();
    for (int i=0; i < count; i++) {
      columnHints.add(pageHint.getTableColumnHint(i));
    }
    count=pageHint.getUnresolvedRowCount();
    if (count > 0) {
      for (int i=0; i < count; i++) {
        UnresolvedRowHint hint=pageHint.getUnresolvedRowHint(i);
        String key=getHintMapKey(hint.getTableId());
        parallelPagesUnresolvedRowHints.put(key,hint);
      }
    }
    for (int i=0; i < pageHint.getSectionCount(); i++) {
      PageSection section=pageHint.getSection(i);
      if (section instanceof SizeBasedPageSection) {
        SizeBasedPageSection sizeBasedSection=(SizeBasedPageSection)section;
        if (sizeBasedSection.start.dimension != -1) {
          InstanceID startID=sizeBasedSection.starts[sizeBasedSection.starts.length - 1].getInstanceID();
          if (startID != null) {
            sizeBasedContentMapping.put(startID.toUniqueString(),sizeBasedSection.start);
          }
        }
        if (sizeBasedSection.end.dimension != -1) {
          InstanceID endID=sizeBasedSection.ends[sizeBasedSection.ends.length - 1].getInstanceID();
          if (endID != null) {
            sizeBasedContentMapping.put(endID.toUniqueString(),sizeBasedSection.end);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public void setLayoutPageHint(IPageHint pageHint){
  if (pageHint != null) {
    context.pageNumber=pageHint.getPageNumber();
    context.masterPage=pageHint.getMasterPage();
    int count=pageHint.getTableColumnHintCount();
    for (int i=0; i < count; i++) {
      columnHints.add(pageHint.getTableColumnHint(i));
    }
    count=pageHint.getUnresolvedRowCount();
    if (count > 0) {
      for (int i=0; i < count; i++) {
        UnresolvedRowHint hint=pageHint.getUnresolvedRowHint(i);
        String key=getHintMapKey(hint.getTableId());
        hints.put(key,hint);
      }
    }
    for (int i=0; i < pageHint.getSectionCount(); i++) {
      PageSection section=pageHint.getSection(i);
      if (section instanceof SizeBasedPageSection) {
        SizeBasedPageSection sizeBasedSection=(SizeBasedPageSection)section;
        if (sizeBasedSection.start.dimension != -1) {
          InstanceID startID=sizeBasedSection.starts[sizeBasedSection.starts.length - 1].getInstanceID();
          if (startID != null) {
            sizeBasedContentMapping.put(startID.toUniqueString(),sizeBasedSection.start);
          }
        }
        if (sizeBasedSection.end.dimension != -1) {
          InstanceID endID=sizeBasedSection.ends[sizeBasedSection.ends.length - 1].getInstanceID();
          if (endID != null) {
            sizeBasedContentMapping.put(endID.toUniqueString(),sizeBasedSection.end);
          }
        }
      }
    }
  }
}
Program: 67105
Project: 67105
Buggy source:
public void resetRowHint(){
  if (!context.emptyPage) {
    parallelPagesUnresolvedRowHints.clear();
    parallelPagesUnresolvedRowHints.putAll(currentPageUnresolvedRowHints);
    currentPageUnresolvedRowHints.clear();
  }
}

Fixed version (ground truth):
public void resetRowHint(){
  if (!context.emptyPage) {
    hints.clear();
    hints.putAll(currentHints);
    currentHints.clear();
  }
}
Program: 67106
Project: 67106
Buggy source:
protected void end(boolean finished) throws BirtException {
  if (!finished) {
    context.getPageHintManager().resetRowHint();
  }
  if (emitter != null) {
    context.getPageBufferManager().endContainer(pageContent,finished,emitter,true);
    context.getBufferFactory().close();
  }
  context.setEmptyPage(false);
}

Fixed version (ground truth):
protected void end(boolean finished) throws BirtException {
  if (emitter != null) {
    context.getPageBufferManager().endContainer(pageContent,finished,emitter,true);
    context.getBufferFactory().close();
  }
  if (!finished) {
    context.getPageHintManager().resetRowHint();
  }
  context.setEmptyPage(false);
}
Program: 67107
Project: 67107
Buggy source:
protected void handlePageBreakInterval(){
  GroupDesign groupDesign=(GroupDesign)design;
  if (groupDesign.getGroupLevel() == listingExecutor.pageBreakLevel) {
    listingExecutor.next();
    if (listingExecutor.needSoftBreakAfter()) {
      IStyle style=content.getStyle();
      if (style != null) {
        CSSValue pageBreak=style.getProperty(IStyle.STYLE_PAGE_BREAK_AFTER);
        if (pageBreak == null || IStyle.AUTO_VALUE.equals(pageBreak)) {
          style.setProperty(IStyle.STYLE_PAGE_BREAK_AFTER,IStyle.SOFT_VALUE);
        }
      }
    }
  }
}

Fixed version (ground truth):
protected void handlePageBreakInterval(){
  GroupDesign groupDesign=(GroupDesign)design;
  if (groupDesign.getGroupLevel() == listingExecutor.pageBreakLevel) {
    listingExecutor.next();
    if (listingExecutor.needSoftBreakAfter()) {
      listingExecutor.softBreakBefore=true;
      listingExecutor.pageRowCount=0;
    }
 else     if (listingExecutor.softBreakBefore) {
      IStyle style=content.getStyle();
      if (style != null) {
        CSSValue pageBreak=style.getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE);
        if (pageBreak == null || IStyle.AUTO_VALUE.equals(pageBreak)) {
          style.setProperty(IStyle.STYLE_PAGE_BREAK_BEFORE,IStyle.SOFT_VALUE);
        }
      }
      listingExecutor.softBreakBefore=false;
      listingExecutor.previous();
      listingExecutor.addAfterBreak=true;
    }
  }
}
Program: 67108
Project: 67108
Buggy source:
protected void handlePageBreakInterval(){
  if (listExecutor.breakOnDetailBand) {
    BandDesign band=(BandDesign)design;
    if (band.getBandType() == BandDesign.BAND_DETAIL) {
      listExecutor.next();
      if (listExecutor.needSoftBreakAfter()) {
        IStyle style=content.getStyle();
        if (style != null) {
          CSSValue pageBreak=style.getProperty(IStyle.STYLE_PAGE_BREAK_AFTER);
          if (pageBreak == null || IStyle.AUTO_VALUE.equals(pageBreak)) {
            style.setProperty(IStyle.STYLE_PAGE_BREAK_AFTER,IStyle.SOFT_VALUE);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
protected void handlePageBreakInterval(){
  if (listExecutor.breakOnDetailBand) {
    BandDesign band=(BandDesign)design;
    if (band.getBandType() == BandDesign.BAND_DETAIL) {
      listExecutor.next();
      if (listExecutor.needSoftBreakAfter()) {
        listExecutor.softBreakBefore=true;
        listExecutor.pageRowCount=0;
      }
 else       if (listExecutor.softBreakBefore) {
        IStyle style=content.getStyle();
        if (style != null) {
          CSSValue pageBreak=style.getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE);
          if (pageBreak == null || IStyle.AUTO_VALUE.equals(pageBreak)) {
            style.setProperty(IStyle.STYLE_PAGE_BREAK_BEFORE,IStyle.SOFT_VALUE);
          }
        }
        listExecutor.softBreakBefore=false;
        listExecutor.previous();
        listExecutor.addAfterBreak=true;
      }
    }
  }
}
Program: 67109
Project: 67109
Buggy source:
public void onPageBreak(){
  pageRowCount=0;
}

Fixed version (ground truth):
public void onPageBreak(){
  pageRowCount=0;
  if (addAfterBreak) {
    next();
    addAfterBreak=false;
  }
}
Program: 67110
Project: 67110
Buggy source:
/** 
 * access the query and create the contents. the execution process is: <li> the cursor is at the begin of result set. <li> call listing's onStart event <li> create the header <li> for each row: <ul> <li> call onRow event. <li> if the row start some groups, create the group header for that group. <li> create the detail row. <li> if the row end some groups, create the group footer for that group. </ul> <li> create the footer. <li> call the onFinish event.
 */
public void close() throws BirtException {
  if (pageBreakInterval != -1) {
    context.removePageBreakListener(this);
  }
  rsetCursor=-1;
  needPageBreak=false;
  pageRowCount=0;
  pageBreakInterval=-1;
  executableElements=null;
  totalElements=0;
  currentElement=0;
  endOfListing=false;
  breakOnDetailBand=false;
  pageBreakLevel=-1;
  super.close();
}

Fixed version (ground truth):
/** 
 * access the query and create the contents. the execution process is: <li> the cursor is at the begin of result set. <li> call listing's onStart event <li> create the header <li> for each row: <ul> <li> call onRow event. <li> if the row start some groups, create the group header for that group. <li> create the detail row. <li> if the row end some groups, create the group footer for that group. </ul> <li> create the footer. <li> call the onFinish event.
 */
public void close() throws BirtException {
  if (pageBreakInterval != -1) {
    context.removePageBreakListener(this);
  }
  rsetCursor=-1;
  needPageBreak=false;
  pageRowCount=0;
  pageBreakInterval=-1;
  executableElements=null;
  totalElements=0;
  currentElement=0;
  endOfListing=false;
  breakOnDetailBand=false;
  pageBreakLevel=-1;
  softBreakBefore=false;
  addAfterBreak=false;
  super.close();
}