nus-yam/ex-repair huggingface dataset:
Program: 71519
Project: 71519
Buggy source:
/** 
 * Set the ResourceIdentifiers instance to the data source handle
 * @param source
 */
private void setResourceIDtoDataSourceHandle(OdaDataSourceHandle source){
  if (dteSession.getDataSessionContext().getAppContext() == null) {
    dteSession.getDataSessionContext().setAppContext(new HashMap());
  }
  dteSession.getDataSessionContext().getAppContext().put(ResourceIdentifiers.ODA_APP_CONTEXT_KEY_CONSUMER_RESOURCE_IDS,createResourceIdentifiers(source.getModuleHandle()));
}

Fixed version (ground truth):
/** 
 * Set the ResourceIdentifiers instance to the data source handle
 * @param source
 */
private void setResourceIDtoDataSourceHandle(OdaDataSourceHandle source){
  if (dteSession.getDataSessionContext().getAppContext() == null) {
    dteSession.getDataSessionContext().setAppContext(new HashMap());
  }
  if (!dteSession.getDataSessionContext().getAppContext().containsKey(ResourceIdentifiers.ODA_APP_CONTEXT_KEY_CONSUMER_RESOURCE_IDS))   dteSession.getDataSessionContext().getAppContext().put(ResourceIdentifiers.ODA_APP_CONTEXT_KEY_CONSUMER_RESOURCE_IDS,createResourceIdentifiers(source.getModuleHandle()));
}
Program: 71520
Project: 71520
Buggy source:
public void resetRowHint(){
  hints.clear();
  hints.putAll(currentHints);
  currentHints.clear();
}

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

Fixed version (ground truth):
protected void end(boolean finished){
  if (emitter != null) {
    context.getPageBufferManager().endContainer(pageContent,finished,emitter,true);
    context.getBufferFactory().close();
  }
  context.resetRowHint();
  context.setEmptyPage(false);
}
Program: 71522
Project: 71522
Buggy source:
public void endPage(IContent content,boolean finished,IContentEmitter emitter){
  ((AbstractNode)currentNode).setFinished(finished);
  if (currentNode.isStarted()) {
    currentNode.end();
    pageBreakEvent();
    if (!finished) {
      context.setPageNumber(context.getPageNumber() + 1);
      context.setPageCount(context.getPageCount() + 1);
    }
  }
 else {
    if (finished) {
      if (context.getPageNumber() == 1) {
        currentNode.flush();
        pageBreakEvent();
      }
 else {
        context.setPageNumber(context.getPageNumber() - 1);
        context.setPageCount(context.getPageCount() - 1);
      }
    }
  }
  this.finished=true;
  generator.reset();
  context.clearPageHint();
  currentNode=null;
}

Fixed version (ground truth):
public void endPage(IContent content,boolean finished,IContentEmitter emitter){
  ((AbstractNode)currentNode).setFinished(finished);
  if (currentNode.isStarted()) {
    currentNode.end();
    pageBreakEvent();
    if (!finished) {
      context.setPageNumber(context.getPageNumber() + 1);
      context.setPageCount(context.getPageCount() + 1);
    }
  }
 else {
    context.setEmptyPage(true);
    if (finished) {
      if (context.getPageNumber() == 1) {
        currentNode.flush();
        pageBreakEvent();
      }
 else {
        context.setPageNumber(context.getPageNumber() - 1);
        context.setPageCount(context.getPageCount() - 1);
      }
    }
  }
  this.finished=true;
  generator.reset();
  context.clearPageHint();
  currentNode=null;
}
Program: 71523
Project: 71523
Buggy source:
public void defineCube(CubeHandle cubeHandle) throws BirtException {
  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)     this.defineDataSet(baseDataSet);
    this.defineDataSet(baseDataSet);
  }
  if (!cubeHandleMap.containsKey(cubeHandle.getQualifiedName())) {
    this.cubeHandleMap.put(cubeHandle.getQualifiedName(),cubeHandle);
  }
}

Fixed version (ground truth):
public void defineCube(CubeHandle cubeHandle) throws BirtException {
  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)     this.defineDataSet(baseDataSet);
  }
  if (!cubeHandleMap.containsKey(cubeHandle.getQualifiedName())) {
    this.cubeHandleMap.put(cubeHandle.getQualifiedName(),cubeHandle);
  }
}
Program: 71524
Project: 71524
Buggy source:
private IResultClass createCustomDataSetMetaData(BaseQuery query,IResultClass meta) throws DataException {
  List projectedColumns=new ArrayList();
  if (query.getFetchEvents() != null) {
    for (int i=0; i < meta.getFieldCount(); i++) {
      projectedColumns.add(new ResultFieldMetadata(i,meta.getFieldName(i + 1),meta.getFieldLabel(i + 1),meta.getFieldValueClass(i + 1),meta.getFieldNativeTypeName(i + 1),false));
    }
    for (int j=0; j < query.getFetchEvents().size(); j++) {
      if (query.getFetchEvents().get(j) instanceof ComputedColumnHelper) {
        ComputedColumnHelper helper=(ComputedColumnHelper)query.getFetchEvents().get(j);
        helper.setModel(TransformationConstants.RESULT_SET_MODEL);
        for (int i=0; i < helper.getComputedColumnList().size(); i++) {
          projectedColumns.add(new ResultFieldMetadata(i + 1 + meta.getFieldCount(),((IComputedColumn)helper.getComputedColumnList().get(i)).getName(),((IComputedColumn)helper.getComputedColumnList().get(i)).getName(),DataType.getClass(((IComputedColumn)helper.getComputedColumnList().get(i)).getDataType()),null,true));
        }
      }
      meta=new ResultClass(projectedColumns);
    }
  }
  return meta;
}

Fixed version (ground truth):
private IResultClass createCustomDataSetMetaData(BaseQuery query,IResultClass meta) throws DataException {
  List projectedColumns=new ArrayList();
  if (query.getFetchEvents() != null) {
    for (int i=0; i < meta.getFieldCount(); i++) {
      ResultFieldMetadata rfMeta=new ResultFieldMetadata(i,meta.getFieldName(i + 1),meta.getFieldLabel(i + 1),meta.getFieldValueClass(i + 1),meta.getFieldNativeTypeName(i + 1),false);
      rfMeta.setAlias(meta.getFieldAlias(i + 1));
      projectedColumns.add(rfMeta);
    }
    for (int j=0; j < query.getFetchEvents().size(); j++) {
      if (query.getFetchEvents().get(j) instanceof ComputedColumnHelper) {
        ComputedColumnHelper helper=(ComputedColumnHelper)query.getFetchEvents().get(j);
        helper.setModel(TransformationConstants.RESULT_SET_MODEL);
        for (int i=0; i < helper.getComputedColumnList().size(); i++) {
          projectedColumns.add(new ResultFieldMetadata(i + 1 + meta.getFieldCount(),((IComputedColumn)helper.getComputedColumnList().get(i)).getName(),((IComputedColumn)helper.getComputedColumnList().get(i)).getName(),DataType.getClass(((IComputedColumn)helper.getComputedColumnList().get(i)).getDataType()),null,true));
        }
      }
      meta=new ResultClass(projectedColumns);
    }
  }
  return meta;
}
Program: 71526
Project: 71526
Buggy source:
/** 
 * @return
 */
private List getSelectValueList(){
  if (needRefreshList == false) {
    return selValueList;
  }
  CubeHandle cube=null;
  if (designHandle instanceof ExtendedItemHandle) {
    cube=((ExtendedItemHandle)designHandle).getCube();
  }
  if (cube == null || (!(cube instanceof TabularCubeHandle)) || expression.getText().length() == 0) {
    return new ArrayList();
  }
  Iterator iter=null;
  IBaseCubeQueryDefinition cubeQueryDefn=null;
  DataRequestSession session=null;
  try {
    session=DataRequestSession.newSession(new DataSessionContext(DataSessionContext.MODE_DIRECT_PRESENTATION));
    IReportItem item=((ExtendedItemHandle)designHandle).getReportItem();
    Chart cm=context.getModel();
    cubeQueryDefn=new ChartCubeQueryHelper((ExtendedItemHandle)designHandle,cm).createCubeQuery(null);
    iter=session.getCubeQueryUtil().getMemberValueIterator((TabularCubeHandle)cube,getExpression(expression.getText()),(ICubeQueryDefinition)cubeQueryDefn);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,e.getMessage(),e);
  }
  selValueList=new ArrayList();
  while (iter != null && iter.hasNext()) {
    Object obj=iter.next();
    if (obj != null) {
      if (selValueList.indexOf(obj) < 0) {
        selValueList.add(obj);
      }
    }
  }
  needRefreshList=false;
  return selValueList;
}

Fixed version (ground truth):
/** 
 * @return
 */
private List getSelectValueList(){
  if (needRefreshList == false) {
    return selValueList;
  }
  CubeHandle cube=null;
  if (designHandle instanceof ExtendedItemHandle) {
    cube=((ExtendedItemHandle)designHandle).getCube();
  }
  if (cube == null || (!(cube instanceof TabularCubeHandle)) || expression.getText().length() == 0) {
    return new ArrayList();
  }
  Iterator iter=null;
  IBaseCubeQueryDefinition cubeQueryDefn=null;
  DataRequestSession session=null;
  try {
    session=DataRequestSession.newSession(new DataSessionContext(DataSessionContext.MODE_DIRECT_PRESENTATION));
    IReportItem item=((ExtendedItemHandle)designHandle).getReportItem();
    Chart cm=null;
    if (context != null && context.getModel() != null) {
      cm=context.getModel();
    }
 else {
      cm=(Chart)((ChartReportItemImpl)item).getProperty(ChartReportItemUtil.PROPERTY_CHART);
    }
    cubeQueryDefn=new ChartCubeQueryHelper((ExtendedItemHandle)designHandle,cm).createCubeQuery(null);
    iter=session.getCubeQueryUtil().getMemberValueIterator((TabularCubeHandle)cube,getExpression(expression.getText()),(ICubeQueryDefinition)cubeQueryDefn);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,e.getMessage(),e);
  }
  selValueList=new ArrayList();
  while (iter != null && iter.hasNext()) {
    Object obj=iter.next();
    if (obj != null) {
      if (selValueList.indexOf(obj) < 0) {
        selValueList.add(obj);
      }
    }
  }
  needRefreshList=false;
  return selValueList;
}
Program: 71527
Project: 71527
Buggy source:
public void endRow(IRowContent rowContent){
  if (isRowHidden) {
    return;
  }
  if (rowHint != null && !formalized && !LayoutUtil.isRepeatableRow(rowContent)) {
    Row row=rows[rowCount - 1];
    Cell[] cells=row.cells;
    for (int cellId=0; cellId < realColCount; cellId++) {
      Cell cell=cells[cellId];
      if (cell != null) {
        if (cell.status == Cell.CELL_EMPTY || (cell.status == Cell.CELL_USED) && (rowHint.isDropColumn(cellId))) {
          IReportContent report=rowContent.getReportContent();
          ICellContent cellContent=report.createCellContent();
          rowHint.initUnresolvedCell(cellContent,rowContent.getInstanceID(),cellId);
          cellContent.setParent(rowContent);
          int rowSpan=cellContent.getRowSpan();
          int colSpan=cellContent.getColSpan();
          Cell newCell=Cell.createCell(row.rowId,cellId,rowSpan,colSpan,new CellContent(cellContent,null));
          row.cells[cellId]=newCell;
          for (int i=cellId + 1; i < cellId + colSpan; i++) {
            row.cells[i]=Cell.createSpanCell(row.rowId,i,newCell);
          }
        }
      }
    }
    formalized=true;
    rowHint=null;
  }
}

Fixed version (ground truth):
public void endRow(IRowContent rowContent){
  if (isRowHidden) {
    return;
  }
  if (rowHint != null && !formalized && !LayoutUtil.isRepeatableRow(rowContent)) {
    Row row=rows[rowCount - 1];
    Cell[] cells=row.cells;
    for (int cellId=0; cellId < realColCount; cellId++) {
      Cell cell=cells[cellId];
      if (cell != null) {
        if (cell.status == Cell.CELL_EMPTY || (cell.status == Cell.CELL_USED) && (rowHint.isDropColumn(cellId))) {
          IReportContent report=rowContent.getReportContent();
          ICellContent cellContent=report.createCellContent();
          rowHint.initUnresolvedCell(cellContent,rowContent.getInstanceID(),cellId);
          cellContent.setParent(rowContent);
          int rowSpan=cellContent.getRowSpan();
          int colSpan=cellContent.getColSpan();
          Cell newCell=Cell.createCell(row.rowId,cellId,rowSpan,colSpan,new CellContent(cellContent,null));
          row.cells[cellId]=newCell;
          int end=Math.min(realColCount,cellId + colSpan);
          for (int i=cellId + 1; i < end; i++) {
            row.cells[i]=Cell.createSpanCell(row.rowId,i,newCell);
          }
        }
      }
    }
    formalized=true;
    rowHint=null;
  }
}
Program: 71528
Project: 71528
Buggy source:
/** 
 */
public void testLike(){
  String[] script=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  boolean[] result=new boolean[]{true,true,true,true,true,false};
  for (int i=0; i < script.length; i++) {
    assertTrue(((Boolean)cx.evaluateString(scope,script[i],"String_Node_Str",1,null)).booleanValue() == result[i]);
    System.out.println(i);
  }
}

Fixed version (ground truth):
/** 
 */
public void testLike(){
  String[] script=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  boolean[] result=new boolean[]{true,true,true,true,true,false,false,false,true,false,true,false};
  for (int i=0; i < script.length; i++) {
    assertTrue(((Boolean)cx.evaluateString(scope,script[i],"String_Node_Str",1,null)).booleanValue() == result[i]);
  }
}
Program: 71529
Project: 71529
Buggy source:
/** 
 */
public void testNotLike(){
  String[] script=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  boolean[] result=new boolean[]{false,false,false,false,false,true};
  for (int i=0; i < script.length; i++) {
    assertTrue(((Boolean)cx.evaluateString(scope,script[i],"String_Node_Str",1,null)).booleanValue() == result[i]);
    System.out.println(i);
  }
}

Fixed version (ground truth):
/** 
 */
public void testNotLike(){
  String[] script=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  boolean[] result=new boolean[]{false,false,false,false,false,true,true,true,false,true,false,true};
  for (int i=0; i < script.length; i++) {
    assertTrue(((Boolean)cx.evaluateString(scope,script[i],"String_Node_Str",1,null)).booleanValue() == result[i]);
  }
}
Program: 71530
Project: 71530
Buggy source:
/** 
 * @param obj1
 * @param obj2
 * @return true x matches SQL pattern y
 * @throws BirtException
 * @throws DataException
 */
private static boolean like(Object obj1,Object obj2){
  if (obj2 == null) {
    throw new java.lang.IllegalArgumentException("String_Node_Str");
  }
  if (obj1 == null) {
    return false;
  }
  String str=obj1.toString();
  String pattern=obj2.toString();
  pattern=pattern.replaceAll("String_Node_Str","String_Node_Str");
  pattern=pattern.replaceAll("String_Node_Str","String_Node_Str");
  return str.matches(pattern);
}

Fixed version (ground truth):
/** 
 * @param obj1
 * @param obj2
 * @return true x matches SQL pattern y
 * @throws BirtException
 * @throws DataException
 */
private static boolean like(Object obj1,Object obj2){
  if (obj2 == null) {
    throw new java.lang.IllegalArgumentException("String_Node_Str");
  }
  if (obj1 == null) {
    return false;
  }
  String str=obj1.toString();
  String pattern=toPatternString(obj2.toString());
  return str.matches(pattern);
}
Program: 71532
Project: 71532
Buggy source:
public int getCurrentResultIndex() throws DataException {
  return this.prototype.getCurrentResultIndex();
}

Fixed version (ground truth):
public int getCurrentResultIndex() throws DataException {
  return 0;
}
Program: 71533
Project: 71533
Buggy source:
/** 
 * Creates a new DtE API IParameterDefinition from a model's DataSetParameterHandle.
 */
IParameterDefinition newParam(DataSetParameterHandle modelParam){
  ParameterDefinition dteParam=new ParameterDefinition();
  dteParam.setName(modelParam.getName());
  if (modelParam.getPosition() != null)   dteParam.setPosition(modelParam.getPosition().intValue());
  if (modelParam.getNativeDataType() != null)   dteParam.setNativeType(modelParam.getNativeDataType().intValue());
  if (modelParam instanceof OdaDataSetParameterHandle) {
    dteParam.setNativeName(((OdaDataSetParameterHandle)modelParam).getNativeName());
  }
  dteParam.setType(DataAdapterUtil.modelDataTypeToCoreDataType(modelParam.getDataType()));
  dteParam.setInputMode(modelParam.isInput());
  dteParam.setOutputMode(modelParam.isOutput());
  dteParam.setNullable(modelParam.allowNull());
  dteParam.setInputOptional(modelParam.isOptional());
  dteParam.setDefaultInputValue(modelParam.getDefaultValue());
  return dteParam;
}

Fixed version (ground truth):
/** 
 * Creates a new DtE API IParameterDefinition from a model's DataSetParameterHandle.
 */
IParameterDefinition newParam(DataSetParameterHandle modelParam){
  ParameterDefinition dteParam=new ParameterDefinition();
  dteParam.setName(modelParam.getName());
  if (modelParam.getPosition() != null)   dteParam.setPosition(modelParam.getPosition().intValue());
  if (modelParam.getNativeDataType() != null)   dteParam.setNativeType(modelParam.getNativeDataType().intValue());
  if (modelParam instanceof OdaDataSetParameterHandle) {
    dteParam.setNativeName(((OdaDataSetParameterHandle)modelParam).getNativeName());
  }
  dteParam.setType(DataAdapterUtil.adaptModelDataType(modelParam.getDataType()));
  dteParam.setInputMode(modelParam.isInput());
  dteParam.setOutputMode(modelParam.isOutput());
  dteParam.setNullable(modelParam.allowNull());
  dteParam.setInputOptional(modelParam.isOptional());
  dteParam.setDefaultInputValue(modelParam.getDefaultValue());
  return dteParam;
}
Program: 71534
Project: 71534
Buggy source:
/** 
 * @return
 */
private List getSelectValueList(){
  if (needRefreshList == false) {
    return selValueList;
  }
  CubeHandle cube=null;
  if (designHandle instanceof ExtendedItemHandle) {
    cube=((ExtendedItemHandle)designHandle).getCube();
  }
  if (cube == null || (!(cube instanceof TabularCubeHandle)) || expression.getText().length() == 0) {
    return new ArrayList();
  }
  Iterator iter=null;
  IBaseCubeQueryDefinition cubeQueryDefn=null;
  DataRequestSession session=null;
  try {
    session=DataRequestSession.newSession(new DataSessionContext(DataSessionContext.MODE_DIRECT_PRESENTATION));
    IReportItem item=((ExtendedItemHandle)designHandle).getReportItem();
    Chart cm=(Chart)((ChartReportItemImpl)item).getProperty(ChartReportItemUtil.PROPERTY_CHART);
    cubeQueryDefn=new ChartCubeQueryHelper((ExtendedItemHandle)designHandle,cm).createCubeQuery(null);
    iter=session.getCubeQueryUtil().getMemberValueIterator((TabularCubeHandle)cube,getExpression(expression.getText()),(ICubeQueryDefinition)cubeQueryDefn);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,e.getMessage(),e);
  }
  selValueList=new ArrayList();
  while (iter != null && iter.hasNext()) {
    Object obj=iter.next();
    if (obj != null) {
      if (selValueList.indexOf(obj) < 0) {
        selValueList.add(obj);
      }
    }
  }
  needRefreshList=false;
  return selValueList;
}

Fixed version (ground truth):
/** 
 * @return
 */
private List getSelectValueList(){
  if (needRefreshList == false) {
    return selValueList;
  }
  CubeHandle cube=null;
  if (designHandle instanceof ExtendedItemHandle) {
    cube=((ExtendedItemHandle)designHandle).getCube();
  }
  if (cube == null || (!(cube instanceof TabularCubeHandle)) || expression.getText().length() == 0) {
    return new ArrayList();
  }
  Iterator iter=null;
  IBaseCubeQueryDefinition cubeQueryDefn=null;
  DataRequestSession session=null;
  try {
    session=DataRequestSession.newSession(new DataSessionContext(DataSessionContext.MODE_DIRECT_PRESENTATION));
    IReportItem item=((ExtendedItemHandle)designHandle).getReportItem();
    Chart cm=context.getModel();
    cubeQueryDefn=new ChartCubeQueryHelper((ExtendedItemHandle)designHandle,cm).createCubeQuery(null);
    iter=session.getCubeQueryUtil().getMemberValueIterator((TabularCubeHandle)cube,getExpression(expression.getText()),(ICubeQueryDefinition)cubeQueryDefn);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,e.getMessage(),e);
  }
  selValueList=new ArrayList();
  while (iter != null && iter.hasNext()) {
    Object obj=iter.next();
    if (obj != null) {
      if (selValueList.indexOf(obj) < 0) {
        selValueList.add(obj);
      }
    }
  }
  needRefreshList=false;
  return selValueList;
}
Program: 71535
Project: 71535
Buggy source:
/** 
 * Create the list of all the images to be displayed.
 * @param x the x-cordinator of the base image.
 * @param y the y-cordinator of the base image.
 * @return the list of all the images to be displayed.
 */
private ArrayList createImageList(int x,int y){
  Rectangle area=getClientArea();
  ArrayList yList=new ArrayList();
  if ((repeat & ImageConstants.REPEAT_Y) == 0) {
    yList.add(new Point(x,y));
  }
 else {
    int i=0;
    while (y + size.height * i + size.height > area.y) {
      yList.add(new Point(x,y + size.height * i));
      i--;
    }
    i=1;
    while (y + size.height * i < area.y + area.height) {
      yList.add(new Point(x,y + size.height * i));
      i++;
    }
  }
  ArrayList xyList=new ArrayList();
  Iterator iter=yList.iterator();
  while (iter.hasNext()) {
    Point point=(Point)iter.next();
    if ((repeat & ImageConstants.REPEAT_X) == 0) {
      xyList.add(point);
    }
 else {
      int i=0;
      while (point.x + size.width * i + size.width > area.x) {
        xyList.add(new Point(point.x + size.width * i,point.y));
        i--;
      }
      i=1;
      while (point.x + size.width * i < area.x + area.width) {
        xyList.add(new Point(point.x + size.width * i,point.y));
        i++;
      }
    }
  }
  yList.clear();
  return xyList;
}

Fixed version (ground truth):
/** 
 * Create the list of all the images to be displayed.
 * @param x the x-cordinator of the base image.
 * @param y the y-cordinator of the base image.
 * @return the list of all the images to be displayed.
 */
private ArrayList createImageList(int x,int y){
  Rectangle area=getBounds();
  ArrayList yList=new ArrayList();
  if ((repeat & ImageConstants.REPEAT_Y) == 0) {
    yList.add(new Point(x,y));
  }
 else {
    int i=0;
    while (y + size.height * i + size.height > area.y) {
      yList.add(new Point(x,y + size.height * i));
      i--;
    }
    i=1;
    while (y + size.height * i < area.y + area.height) {
      yList.add(new Point(x,y + size.height * i));
      i++;
    }
  }
  ArrayList xyList=new ArrayList();
  Iterator iter=yList.iterator();
  while (iter.hasNext()) {
    Point point=(Point)iter.next();
    if ((repeat & ImageConstants.REPEAT_X) == 0) {
      xyList.add(point);
    }
 else {
      int i=0;
      while (point.x + size.width * i + size.width > area.x) {
        xyList.add(new Point(point.x + size.width * i,point.y));
        i--;
      }
      i=1;
      while (point.x + size.width * i < area.x + area.width) {
        xyList.add(new Point(point.x + size.width * i,point.y));
        i++;
      }
    }
  }
  yList.clear();
  return xyList;
}
Program: 71536
Project: 71536
Buggy source:
protected void paintChildren(Graphics graphics){
  IFigure child;
  for (int i=0; i < this.getChildren().size(); i++) {
    child=(IFigure)this.getChildren().get(i);
    if (child.isVisible()) {
      graphics.setClip(getBounds().getCopy().intersect(child.getBounds()));
      child.paint(graphics);
      graphics.restoreState();
    }
  }
}

Fixed version (ground truth):
protected void paintChildren(Graphics graphics){
  IFigure child;
  for (int i=0; i < this.getChildren().size(); i++) {
    Rectangle clip=graphics.getClip(Rectangle.SINGLETON);
    child=(IFigure)this.getChildren().get(i);
    if (child.isVisible()) {
      Rectangle bounds=child.getBounds().getCopy();
      int extend=bounds.x + bounds.width - clip.x - clip.width;
      if (extend > 0) {
        clip.width=clip.width + extend;
      }
      if (child.intersects(clip)) {
        graphics.setClip(clip.getCopy());
        child.paint(graphics);
      }
      graphics.restoreState();
    }
  }
}
Program: 71538
Project: 71538
Buggy source:
private TextArea getNextTextArea(int maxLineWidth){
  if (null != wordVestige) {
    TextArea textArea=createTextArea(textContent,offset,lineBaseLevel,runLevel,fontInfo);
    textArea.setMaxWidth(maxLineWidth);
    textArea.setWidth(0);
    addWordIntoTextArea(textArea,wordVestige);
    return textArea;
  }
  if (null != remainWord) {
    TextArea textArea=createTextArea(textContent,offset,lineBaseLevel,runLevel,fontInfo);
    textArea.setMaxWidth(maxLineWidth);
    textArea.setWidth(0);
    addWordIntoTextArea(textArea,remainWord);
    remainWord=null;
    return textArea;
  }
  if (null == remainWords || !remainWords.hasWord()) {
    Chunk chunk=remainChunks.getNext();
    if (chunk == Chunk.HARD_LINE_BREAK) {
      FontHandler handler=new FontHandler(fontManager,textContent,false);
      TextArea textArea=(TextArea)AreaFactory.createTextArea(textContent,handler.getFontInfo(),true);
      textArea.setTextLength(1);
      hasLineBreak=true;
      return textArea;
    }
    fontInfo=chunk.getFontInfo();
    lineBaseLevel=chunk.getBaseLevel();
    runLevel=chunk.getRunLevel();
    remainWords=new WordRecognizerWrapper(chunk.getText(),locale);
  }
  TextArea textArea=createTextArea(textContent,offset,lineBaseLevel,runLevel,fontInfo);
  textArea.setMaxWidth(maxLineWidth);
  textArea.setWidth(0);
  addWordsIntoTextArea(textArea,remainWords);
  return textArea;
}

Fixed version (ground truth):
private TextArea getNextTextArea(int maxLineWidth){
  if (null != wordVestige) {
    TextArea textArea=createTextArea(textContent,offset,lineBaseLevel,runLevel,fontInfo);
    textArea.setMaxWidth(maxLineWidth);
    textArea.setWidth(0);
    addWordIntoTextArea(textArea,wordVestige);
    return textArea;
  }
  if (null != remainWord) {
    TextArea textArea=createTextArea(textContent,offset,lineBaseLevel,runLevel,fontInfo);
    textArea.setMaxWidth(maxLineWidth);
    textArea.setWidth(0);
    addWordIntoTextArea(textArea,remainWord);
    remainWord=null;
    return textArea;
  }
  if (null == remainWords || !remainWords.hasWord()) {
    Chunk chunk=remainChunks.getNext();
    if (chunk == Chunk.HARD_LINE_BREAK) {
      FontHandler handler=new FontHandler(fontManager,textContent,false);
      TextArea textArea=(TextArea)AreaFactory.createTextArea(textContent,handler.getFontInfo(),true);
      textArea.setTextLength(chunk.getLength());
      hasLineBreak=true;
      return textArea;
    }
    fontInfo=chunk.getFontInfo();
    lineBaseLevel=chunk.getBaseLevel();
    runLevel=chunk.getRunLevel();
    remainWords=new WordRecognizerWrapper(chunk.getText(),locale);
  }
  TextArea textArea=createTextArea(textContent,offset,lineBaseLevel,runLevel,fontInfo);
  textArea.setMaxWidth(maxLineWidth);
  textArea.setWidth(0);
  addWordsIntoTextArea(textArea,remainWords);
  return textArea;
}
Program: 71539
Project: 71539
Buggy source:
private Chunk buildChunk(){
  if (!fontSubstitution) {
    Chunk c=new Chunk(new String(chunkText),baseOffset,baseLevel,runLevel,fh.getFontInfo());
    chunkStartPos=chunkText.length;
    return c;
  }
  if (encounteredReturn) {
    encounteredReturn=false;
    chunkStartPos++;
    return Chunk.HARD_LINE_BREAK;
  }
  while (++currentPos < chunkText.length) {
    if (chunkText[currentPos] == '\n') {
      if (null == lastFontInfo) {
        chunkStartPos=currentPos + 1;
        return Chunk.HARD_LINE_BREAK;
      }
      encounteredReturn=true;
      Chunk c=new Chunk(new String(chunkText,chunkStartPos,currentPos - chunkStartPos),baseOffset + chunkStartPos,baseLevel,runLevel,lastFontInfo);
      chunkStartPos=currentPos;
      return c;
    }
    if (!fh.selectFont(chunkText[currentPos])) {
      chunkText[currentPos]=MISSING_CHAR;
    }
    if (fh.isFontChanged()) {
      if (null == lastFontInfo) {
        lastFontInfo=fh.getFontInfo();
        continue;
      }
      Chunk c=new Chunk(new String(chunkText,chunkStartPos,currentPos - chunkStartPos),baseOffset + chunkStartPos,baseLevel,runLevel,lastFontInfo);
      chunkStartPos=currentPos;
      lastFontInfo=fh.getFontInfo();
      return c;
    }
  }
  if (currentPos >= chunkText.length - 1) {
    Chunk c=new Chunk(new String(chunkText,chunkStartPos,chunkText.length - chunkStartPos),baseOffset + chunkStartPos,baseLevel,runLevel,lastFontInfo);
    chunkStartPos=currentPos + 1;
    return c;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
private Chunk buildChunk(){
  if (!fontSubstitution) {
    Chunk c=new Chunk(new String(chunkText),baseOffset,baseLevel,runLevel,fh.getFontInfo());
    chunkStartPos=chunkText.length;
    return c;
  }
  if (lineBreak != null) {
    Chunk result=lineBreak;
    lineBreak=null;
    chunkStartPos++;
    return result;
  }
  while (++currentPos < chunkText.length) {
    Chunk lineBreakChunk=processLineBreak();
    if (lineBreakChunk != null) {
      return lineBreakChunk;
    }
    if (!fh.selectFont(chunkText[currentPos])) {
      chunkText[currentPos]=MISSING_CHAR;
    }
    if (fh.isFontChanged()) {
      if (null == lastFontInfo) {
        lastFontInfo=fh.getFontInfo();
        continue;
      }
      Chunk c=new Chunk(new String(chunkText,chunkStartPos,currentPos - chunkStartPos),baseOffset + chunkStartPos,baseLevel,runLevel,lastFontInfo);
      chunkStartPos=currentPos;
      lastFontInfo=fh.getFontInfo();
      return c;
    }
  }
  if (currentPos >= chunkText.length - 1) {
    Chunk c=new Chunk(new String(chunkText,chunkStartPos,chunkText.length - chunkStartPos),baseOffset + chunkStartPos,baseLevel,runLevel,lastFontInfo);
    chunkStartPos=currentPos + 1;
    return c;
  }
 else {
    return null;
  }
}
Program: 71540
Project: 71540
Buggy source:
public Word getNextWord(){
  lastWord=currentWord;
  if (start > text.length() - 1) {
    return null;
  }
  for (int i=start; i < text.length(); i++) {
    Character c=new Character(text.charAt(i));
    if (excludedSplitChars.contains(c)) {
      currentWord=new Word(text,start,i + 1);
      start=i + 1;
      return currentWord;
    }
 else     if (includedSplitChars.contains(c)) {
      if (i == start) {
        currentWord=new Word(text,start,i + 1);
        start=i + 1;
        return currentWord;
      }
 else {
        currentWord=new Word(text,start,i);
        start=i;
        return currentWord;
      }
    }
  }
  currentWord=new Word(text,start,text.length());
  start=text.length();
  return currentWord;
}

Fixed version (ground truth):
public Word getNextWord(){
  lastWord=currentWord;
  if (start > text.length() - 1) {
    return null;
  }
  for (int i=start; i < text.length(); i++) {
    char c=text.charAt(i);
    if (c == SPACE) {
      currentWord=new Word(text,start,i + 1);
      start=i + 1;
      return currentWord;
    }
 else {
      int lineBreakLength=getLineBreakLength(text,i);
      if (lineBreakLength == 0)       continue;
      if (i == start) {
        currentWord=new Word(text,start,i + lineBreakLength);
        start=i + lineBreakLength;
        return currentWord;
      }
 else {
        currentWord=new Word(text,start,i);
        start=i;
        return currentWord;
      }
    }
  }
  currentWord=new Word(text,start,text.length());
  start=text.length();
  return currentWord;
}
Program: 71541
Project: 71541
Buggy source:
public void defineCube(CubeHandle cubeHandle) throws BirtException {
  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.defineDataSource(baseDataSource);
    this.defineDataSet(baseDataSet);
  }
  if (!cubeHandleMap.containsKey(cubeHandle.getQualifiedName())) {
    this.cubeHandleMap.put(cubeHandle.getQualifiedName(),cubeHandle);
  }
}

Fixed version (ground truth):
public void defineCube(CubeHandle cubeHandle) throws BirtException {
  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)     this.defineDataSet(baseDataSet);
    this.defineDataSet(baseDataSet);
  }
  if (!cubeHandleMap.containsKey(cubeHandle.getQualifiedName())) {
    this.cubeHandleMap.put(cubeHandle.getQualifiedName(),cubeHandle);
  }
}
Program: 71542
Project: 71542
Buggy source:
private void gendoc(IAction action){
  FormEditor editor=UIUtil.getActiveReportEditor(false);
  ModuleHandle model=SessionHandleAdapter.getInstance().getReportDesignHandle();
  if (editor != null) {
    if (model.needsSave()) {
      editor.doSave(null);
    }
  }
  Map options=new HashMap();
  options.put(WebViewer.RESOURCE_FOLDER_KEY,ReportPlugin.getDefault().getResourceFolder());
  options.put(WebViewer.SERVLET_NAME_KEY,WebViewer.VIEWER_DOCUMENT);
  Object adapter=ElementAdapterManager.getAdapter(action,IPreviewAction.class);
  if (adapter instanceof IPreviewAction) {
    IPreviewAction delegate=(IPreviewAction)adapter;
    delegate.setProperty(IPreviewConstants.REPORT_PREVIEW_OPTIONS,options);
    delegate.setProperty(IPreviewConstants.REPORT_FILE_PATH,model.getFileName());
    delegate.run();
    return;
  }
  WebViewer.display(model.getFileName(),options);
}

Fixed version (ground truth):
private void gendoc(IAction action){
  System.clearProperty(IPreviewConstants.MAX_DATASET_ROWS);
  System.clearProperty(IPreviewConstants.MAX_CUBE_ROW_LEVELS);
  System.clearProperty(IPreviewConstants.MAX_CUBE_COLUMN_LEVELS);
  FormEditor editor=UIUtil.getActiveReportEditor(false);
  ModuleHandle model=SessionHandleAdapter.getInstance().getReportDesignHandle();
  if (editor != null) {
    if (model.needsSave()) {
      editor.doSave(null);
    }
  }
  Map options=new HashMap();
  options.put(WebViewer.RESOURCE_FOLDER_KEY,ReportPlugin.getDefault().getResourceFolder());
  options.put(WebViewer.SERVLET_NAME_KEY,WebViewer.VIEWER_DOCUMENT);
  Object adapter=ElementAdapterManager.getAdapter(action,IPreviewAction.class);
  if (adapter instanceof IPreviewAction) {
    IPreviewAction delegate=(IPreviewAction)adapter;
    delegate.setProperty(IPreviewConstants.REPORT_PREVIEW_OPTIONS,options);
    delegate.setProperty(IPreviewConstants.REPORT_FILE_PATH,model.getFileName());
    delegate.run();
    return;
  }
  WebViewer.display(model.getFileName(),options);
}
Program: 71543
Project: 71543
Buggy source:
protected boolean prePreview(){
  System.clearProperty(IPreviewConstants.SID);
  return true;
}

Fixed version (ground truth):
protected boolean prePreview(){
  System.clearProperty(IPreviewConstants.SID);
  System.clearProperty(IPreviewConstants.MAX_DATASET_ROWS);
  System.clearProperty(IPreviewConstants.MAX_CUBE_ROW_LEVELS);
  System.clearProperty(IPreviewConstants.MAX_CUBE_COLUMN_LEVELS);
  return true;
}
Program: 71544
Project: 71544
Buggy source:
protected boolean prePreview(){
  System.clearProperty(IPreviewConstants.SID);
  return true;
}

Fixed version (ground truth):
protected boolean prePreview(){
  System.clearProperty(IPreviewConstants.SID);
  System.clearProperty(IPreviewConstants.MAX_DATASET_ROWS);
  System.clearProperty(IPreviewConstants.MAX_CUBE_ROW_LEVELS);
  System.clearProperty(IPreviewConstants.MAX_CUBE_COLUMN_LEVELS);
  return true;
}
Program: 71545
Project: 71545
Buggy source:
public void run(IAction action){
  IFile file=getSelectedFile();
  if (file != null) {
    String url=file.getLocation().toOSString();
    Map options=new HashMap();
    options.put(WebViewer.RESOURCE_FOLDER_KEY,ReportPlugin.getDefault().getResourceFolder(file.getProject()));
    options.put(WebViewer.SERVLET_NAME_KEY,WebViewer.VIEWER_DOCUMENT);
    Object adapter=ElementAdapterManager.getAdapter(action,IPreviewAction.class);
    if (adapter instanceof IPreviewAction) {
      IPreviewAction delegate=(IPreviewAction)adapter;
      delegate.setProperty(IPreviewConstants.REPORT_PREVIEW_OPTIONS,options);
      delegate.setProperty(IPreviewConstants.REPORT_FILE_PATH,url);
      delegate.run();
      return;
    }
    try {
      WebViewer.display(url,options);
    }
 catch (    Exception e) {
      ExceptionHandler.handle(e);
      return;
    }
  }
 else {
    action.setEnabled(false);
  }
}

Fixed version (ground truth):
public void run(IAction action){
  if (!preGenerate()) {
    return;
  }
  IFile file=getSelectedFile();
  if (file != null) {
    String url=file.getLocation().toOSString();
    Map options=new HashMap();
    options.put(WebViewer.RESOURCE_FOLDER_KEY,ReportPlugin.getDefault().getResourceFolder(file.getProject()));
    options.put(WebViewer.SERVLET_NAME_KEY,WebViewer.VIEWER_DOCUMENT);
    Object adapter=ElementAdapterManager.getAdapter(action,IPreviewAction.class);
    if (adapter instanceof IPreviewAction) {
      IPreviewAction delegate=(IPreviewAction)adapter;
      delegate.setProperty(IPreviewConstants.REPORT_PREVIEW_OPTIONS,options);
      delegate.setProperty(IPreviewConstants.REPORT_FILE_PATH,url);
      delegate.run();
      return;
    }
    try {
      WebViewer.display(url,options);
    }
 catch (    Exception e) {
      ExceptionHandler.handle(e);
      return;
    }
  }
 else {
    action.setEnabled(false);
  }
}
Program: 71546
Project: 71546
Buggy source:
protected boolean prePreview(){
  System.clearProperty(IPreviewConstants.SID);
  return true;
}

Fixed version (ground truth):
protected boolean prePreview(){
  System.clearProperty(IPreviewConstants.SID);
  System.clearProperty(IPreviewConstants.MAX_DATASET_ROWS);
  System.clearProperty(IPreviewConstants.MAX_CUBE_ROW_LEVELS);
  System.clearProperty(IPreviewConstants.MAX_CUBE_COLUMN_LEVELS);
  return true;
}
Program: 71547
Project: 71547
Buggy source:
protected boolean prePreview(){
  System.clearProperty(IPreviewConstants.SID);
  return true;
}

Fixed version (ground truth):
protected boolean prePreview(){
  System.clearProperty(IPreviewConstants.SID);
  System.clearProperty(IPreviewConstants.MAX_DATASET_ROWS);
  System.clearProperty(IPreviewConstants.MAX_CUBE_ROW_LEVELS);
  System.clearProperty(IPreviewConstants.MAX_CUBE_COLUMN_LEVELS);
  return true;
}
Program: 71548
Project: 71548
Buggy source:
/** 
 * Refresh swt browser
 */
public void display(){
  String uri=getFileUri();
  if (uri != null && uri.length() > 0) {
    if (this.options == null) {
      this.options=new HashMap<String,String>();
      this.options.put(WebViewer.SERVLET_NAME_KEY,InputParameterHtmlDialog.VIEWER_RUN);
      this.options.put(WebViewer.FORMAT_KEY,WebViewer.HTML);
    }
    this.options.put(WebViewer.RESOURCE_FOLDER_KEY,ReportPlugin.getDefault().getResourceFolder());
    this.options.put(WebViewer.MAX_ROWS_KEY,ViewerPlugin.getDefault().getPluginPreferences().getString(WebViewer.PREVIEW_MAXROW));
    this.options.put(WebViewer.MAX_CUBE_ROW_LEVELS_KEY,ViewerPlugin.getDefault().getPluginPreferences().getString(WebViewer.PREVIEW_MAXCUBEROWLEVEL));
    this.options.put(WebViewer.MAX_CUBE_COLUMN_LEVELS_KEY,ViewerPlugin.getDefault().getPluginPreferences().getString(WebViewer.PREVIEW_MAXCUBECOLUMNLEVEL));
    String extKey=ViewerPlugin.getDefault().getPluginPreferences().getString(WebViewer.APPCONTEXT_EXTENSION_KEY);
    if (extKey != null && extKey.length() > 0)     this.options.put(WebViewer.APPCONTEXT_EXTENSION_KEY,extKey);
    if (browser != null && !browser.isDisposed()) {
      WebViewer.display(uri,browser,this.options);
    }
 else {
      WebViewer.display(uri,this.options);
    }
  }
}

Fixed version (ground truth):
/** 
 * Refresh swt browser
 */
public void display(){
  String uri=getFileUri();
  if (uri != null && uri.length() > 0) {
    if (this.options == null) {
      this.options=new HashMap<String,String>();
      this.options.put(WebViewer.SERVLET_NAME_KEY,InputParameterHtmlDialog.VIEWER_RUN);
      this.options.put(WebViewer.FORMAT_KEY,WebViewer.HTML);
    }
    this.options.put(WebViewer.RESOURCE_FOLDER_KEY,ReportPlugin.getDefault().getResourceFolder());
    this.options.put(WebViewer.MAX_ROWS_KEY,ViewerPlugin.getDefault().getPluginPreferences().getString(WebViewer.PREVIEW_MAXROW));
    this.options.put(WebViewer.MAX_CUBE_ROW_LEVELS_KEY,ViewerPlugin.getDefault().getPluginPreferences().getString(WebViewer.PREVIEW_MAXCUBEROWLEVEL));
    this.options.put(WebViewer.MAX_CUBE_COLUMN_LEVELS_KEY,ViewerPlugin.getDefault().getPluginPreferences().getString(WebViewer.PREVIEW_MAXCUBECOLUMNLEVEL));
    String extKey=ViewerPlugin.getDefault().getPluginPreferences().getString(WebViewer.APPCONTEXT_EXTENSION_KEY);
    if (extKey != null && extKey.length() > 0) {
      this.options.put(WebViewer.APPCONTEXT_EXTENSION_KEY,extKey);
    }
    System.setProperty(IPreviewConstants.MAX_DATASET_ROWS,ViewerPlugin.getDefault().getPluginPreferences().getString(WebViewer.PREVIEW_MAXROW));
    System.setProperty(IPreviewConstants.MAX_CUBE_ROW_LEVELS,ViewerPlugin.getDefault().getPluginPreferences().getString(WebViewer.PREVIEW_MAXCUBEROWLEVEL));
    System.setProperty(IPreviewConstants.MAX_CUBE_COLUMN_LEVELS,ViewerPlugin.getDefault().getPluginPreferences().getString(WebViewer.PREVIEW_MAXCUBECOLUMNLEVEL));
    if (browser != null && !browser.isDisposed()) {
      WebViewer.display(uri,browser,this.options);
    }
 else {
      WebViewer.display(uri,this.options);
    }
  }
}
Program: 71549
Project: 71549
Buggy source:
/** 
 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
 */
protected void paintFigure(Graphics graphics){
  if (isOpaque()) {
    if (getBorder() instanceof BaseBorder) {
      graphics.fillRectangle(getBounds().getCopy().crop(((BaseBorder)getBorder()).getBorderInsets()));
    }
 else {
      graphics.fillRectangle(getBounds());
    }
  }
  Image image=getImage();
  if (image == null) {
    return;
  }
  int x, y;
  Rectangle area=getClientArea();
  graphics.getClip(PRIVATE_RECT);
  if (position != null && position.x != -1) {
    x=area.x + position.x;
  }
 else {
switch (alignment & PositionConstants.EAST_WEST) {
case PositionConstants.EAST:
      x=area.x + area.width - size.width;
    break;
case PositionConstants.WEST:
  x=area.x;
break;
default :
x=(area.width - size.width) / 2 + area.x;
break;
}
}
if (position != null && position.y != -1) {
y=area.y + position.y;
}
 else {
switch (alignment & PositionConstants.NORTH_SOUTH) {
case PositionConstants.NORTH:
y=area.y;
break;
case PositionConstants.SOUTH:
y=area.y + area.height - size.height;
break;
default :
y=(area.height - size.height) / 2 + area.y;
break;
}
}
ArrayList xyList=createImageList(x,y);
Iterator iter=xyList.iterator();
while (iter.hasNext()) {
Point point=(Point)iter.next();
graphics.drawImage(image,point);
}
xyList.clear();
graphics.setClip(PRIVATE_RECT);
}

Fixed version (ground truth):
/** 
 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
 */
protected void paintFigure(Graphics graphics){
  if (isOpaque()) {
    if (getBorder() instanceof BaseBorder) {
      graphics.fillRectangle(getBounds().getCopy().crop(((BaseBorder)getBorder()).getBorderInsets()));
    }
 else {
      graphics.fillRectangle(getBounds());
    }
  }
  Image image=getImage();
  if (image == null) {
    return;
  }
  int x, y;
  Rectangle area=getBounds();
  graphics.getClip(PRIVATE_RECT);
  if (position != null && position.x != -1) {
    x=area.x + position.x;
  }
 else {
switch (alignment & PositionConstants.EAST_WEST) {
case PositionConstants.EAST:
      x=area.x + area.width - size.width;
    break;
case PositionConstants.WEST:
  x=area.x;
break;
default :
x=(area.width - size.width) / 2 + area.x;
break;
}
}
if (position != null && position.y != -1) {
y=area.y + position.y;
}
 else {
switch (alignment & PositionConstants.NORTH_SOUTH) {
case PositionConstants.NORTH:
y=area.y;
break;
case PositionConstants.SOUTH:
y=area.y + area.height - size.height;
break;
default :
y=(area.height - size.height) / 2 + area.y;
break;
}
}
ArrayList xyList=createImageList(x,y);
Iterator iter=xyList.iterator();
while (iter.hasNext()) {
Point point=(Point)iter.next();
graphics.drawImage(image,point);
}
xyList.clear();
graphics.setClip(PRIVATE_RECT);
}
Program: 71550
Project: 71550
Buggy source:
/** 
 * Returns iterator of all filters.
 * @return
 */
private Iterator<FilterConditionHandle> getFiltersIterator(){
  List<FilterConditionHandle> filterList=new ArrayList<FilterConditionHandle>();
  PropertyHandle ph=null;
  if (this.getBoundDataSet() == null && this.getReportItemReference() == null) {
    ph=ChartReportItemUtil.getBindingHolder(itemHandle).getPropertyHandle(ExtendedItemHandle.FILTER_PROP);
    if (ph != null) {
      Iterator<FilterConditionHandle> filterIterator=ph.iterator();
      if (filterIterator != null) {
        while (filterIterator.hasNext()) {
          FilterConditionHandle filter=filterIterator.next();
          if (filter.getValue1().indexOf("String_Node_Str") < 0 && filter.getValue2().indexOf("String_Node_Str") < 0) {
            filterList.add(filter);
          }
        }
      }
    }
  }
  ph=itemHandle.getPropertyHandle(ExtendedItemHandle.FILTER_PROP);
  if (ph != null) {
    Iterator<FilterConditionHandle> filterIterator=ph.iterator();
    if (filterIterator != null) {
      while (filterIterator.hasNext()) {
        FilterConditionHandle filter=filterIterator.next();
        if (filter.getValue1().indexOf("String_Node_Str") < 0 && filter.getValue2().indexOf("String_Node_Str") < 0) {
          filterList.add(filter);
        }
      }
    }
  }
  return filterList.isEmpty() ? null : filterList.iterator();
}

Fixed version (ground truth):
/** 
 * Returns iterator of all filters.
 * @return
 */
private Iterator<FilterConditionHandle> getFiltersIterator(){
  List<FilterConditionHandle> filterList=new ArrayList<FilterConditionHandle>();
  PropertyHandle ph=null;
  if (this.getBoundDataSet() == null && this.getReportItemReference() == null) {
    ph=ChartReportItemUtil.getBindingHolder(itemHandle).getPropertyHandle(ExtendedItemHandle.FILTER_PROP);
    if (ph != null) {
      Iterator<FilterConditionHandle> filterIterator=ph.iterator();
      if (filterIterator != null) {
        while (filterIterator.hasNext()) {
          FilterConditionHandle filter=filterIterator.next();
          if ((filter.getValue1() == null || filter.getValue1().indexOf("String_Node_Str") < 0) && (filter.getValue2() == null || filter.getValue2().indexOf("String_Node_Str") < 0)) {
            filterList.add(filter);
          }
        }
      }
    }
  }
  ph=itemHandle.getPropertyHandle(ExtendedItemHandle.FILTER_PROP);
  if (ph != null) {
    Iterator<FilterConditionHandle> filterIterator=ph.iterator();
    if (filterIterator != null) {
      while (filterIterator.hasNext()) {
        FilterConditionHandle filter=filterIterator.next();
        if ((filter.getValue1() == null || filter.getValue1().indexOf("String_Node_Str") < 0) && (filter.getValue2() == null || filter.getValue2().indexOf("String_Node_Str") < 0)) {
          filterList.add(filter);
        }
      }
    }
  }
  return filterList.isEmpty() ? null : filterList.iterator();
}