nus-yam/ex-repair huggingface dataset:
Program: 71327
Project: 71327
Buggy source:
public LegendData(IDisplayServer xs,Chart cm,SeriesDefinition[] seda,RunTimeContext rtc){
  this.xs=xs;
  this.cm=cm;
  this.lg=cm.getLegend();
  this.seda=seda;
  this.rtc=rtc;
  this.bPaletteByCategory=(lg.getItemType().getValue() == LegendItemType.CATEGORIES);
  this.la=LabelImpl.create();
  la.setEllipsis(1);
  la.setCaption(TextImpl.copyInstance(lg.getText()));
  la.getCaption().setValue("String_Node_Str");
  ITextMetrics itm=xs.getTextMetrics(la);
  this.dItemHeight=itm.getFullHeight();
  itm.dispose();
  ClientArea ca=lg.getClientArea();
  dSeparatorThickness=lg.getSeparator() != null ? lg.getSeparator().getThickness() : ca.getOutline().getThickness();
  dScale=xs.getDpiResolution() / 72d;
  insCa=ca.getInsets().scaledInstance(dScale);
  maxWrappingSize=lg.getWrappingSize() * dScale;
  dHorizontalSpacing=3 * dScale;
  dVerticalSpacing=3 * dScale;
  dSafeSpacing=3 * dScale;
  dHorizonalReservedSpace=insCa.getLeft() + insCa.getRight() + 1.5 * dItemHeight + dHorizontalSpacing;
}

Fixed version (ground truth):
public LegendData(IDisplayServer xs,Chart cm,SeriesDefinition[] seda,RunTimeContext rtc){
  this.xs=xs;
  this.cm=cm;
  this.lg=cm.getLegend();
  this.seda=seda;
  this.rtc=rtc;
  this.bPaletteByCategory=(lg.getItemType().getValue() == LegendItemType.CATEGORIES);
  this.la=LabelImpl.create();
  la.setEllipsis(lg.isSetEllipsis() ? lg.getEllipsis() : 1);
  la.setCaption(TextImpl.copyInstance(lg.getText()));
  la.getCaption().setValue("String_Node_Str");
  ITextMetrics itm=xs.getTextMetrics(la);
  this.dItemHeight=itm.getFullHeight();
  itm.dispose();
  ClientArea ca=lg.getClientArea();
  dSeparatorThickness=lg.getSeparator() != null ? lg.getSeparator().getThickness() : ca.getOutline().getThickness();
  dScale=xs.getDpiResolution() / 72d;
  insCa=ca.getInsets().scaledInstance(dScale);
  maxWrappingSize=lg.getWrappingSize() * dScale;
  dHorizontalSpacing=3 * dScale;
  dVerticalSpacing=3 * dScale;
  dSafeSpacing=3 * dScale;
  dHorizonalReservedSpace=insCa.getLeft() + insCa.getRight() + 1.5 * dItemHeight + dHorizontalSpacing;
}
Program: 71328
Project: 71328
Buggy source:
private void updateEllipsisWidth(){
  la.getCaption().setValue(EllipsisHelper.ELLIPSIS_STRING);
  itm.reuse(la);
  dEllipsisWidth=itm.getFullWidth();
}

Fixed version (ground truth):
private void updateEllipsisWidth(ITextMetrics itm){
  la.getCaption().setValue(EllipsisHelper.ELLIPSIS_STRING);
  itm.reuse(la);
  dEllipsisWidth=itm.getFullWidth();
}
Program: 71329
Project: 71329
Buggy source:
private String formatItemText(Object oText) throws ChartException {
  String str;
  if (snFormat != null) {
    str=snFormat.format(oText);
  }
 else {
    str=format(oText);
  }
  return lgData.rtc.externalizedMessage(str);
}

Fixed version (ground truth):
private String formatItemText(Object oText) throws ChartException {
  String str;
  if (snFormat != SeriesNameFormat.DEFAULT_FORMAT) {
    str=snFormat.format(oText);
  }
 else {
    str=format(oText);
  }
  return lgData.rtc.externalizedMessage(str);
}
Program: 71330
Project: 71330
Buggy source:
/** 
 * Compute the size of a label.
 * @param xs
 * @param la
 * @return
 * @throws ChartException
 */
public static final BoundingBox computeLabelSize(IDisplayServer xs,Label la) throws ChartException {
  try {
    return Methods.computeBox(xs,IConstants.ABOVE,la,0,0);
  }
 catch (  IllegalArgumentException uiex) {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.RENDERING,uiex);
  }
}

Fixed version (ground truth):
/** 
 * Compute the size of a label.
 * @param xs
 * @param la
 * @param dWrapping
 * @param fontHeight , pre-computed font height
 * @return
 * @throws ChartException
 */
public static final BoundingBox computeLabelSize(IDisplayServer xs,Label la,double dWrapping,Double fontHeight) throws ChartException {
  try {
    return computeBox(xs,IConstants.ABOVE,la,0,0,dWrapping,fontHeight);
  }
 catch (  IllegalArgumentException uiex) {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.RENDERING,uiex);
  }
}
Program: 71331
Project: 71331
Buggy source:
public static SeriesNameFormat getSeriesNameFormat(SeriesDefinition sd,ULocale loc){
  if (sd != null && sd.getQuery() != null && sd.getQuery().getGrouping() != null) {
    SeriesGrouping sg=sd.getQuery().getGrouping();
    if (sg.getGroupType() == DataType.DATE_TIME_LITERAL) {
      return new SeriesNameDateFormat(sg.getGroupingUnit(),loc);
    }
  }
  return null;
}

Fixed version (ground truth):
public static SeriesNameFormat getSeriesNameFormat(SeriesDefinition sd,ULocale loc){
  if (sd != null && sd.getQuery() != null && sd.getQuery().getGrouping() != null) {
    SeriesGrouping sg=sd.getQuery().getGrouping();
    if (sg.getGroupType() == DataType.DATE_TIME_LITERAL) {
      return new SeriesNameDateFormat(sg.getGroupingUnit(),loc);
    }
  }
  return DEFAULT_FORMAT;
}
Program: 71335
Project: 71335
Buggy source:
public boolean add(Object o) throws IOException {
  writeObject(o);
  size++;
  if (size % bufferSize == 0) {
    segmentOffsets.add(new Integer(getOffset()));
  }
  return true;
}

Fixed version (ground truth):
public boolean add(Object o) throws IOException {
  if (size >= currentCacheStartIndex && size < (currentCacheStartIndex + bufferSize)) {
    buffer[size - currentCacheStartIndex]=o;
  }
  writeObject(o);
  size++;
  if (size % bufferSize == 0) {
    segmentOffsets.add(new Integer(getOffset()));
  }
  return true;
}
Program: 71336
Project: 71336
Buggy source:
/** 
 * @throws IOException
 */
public BaseDiskArray() throws IOException {
  this.currentCacheStartIndex=-1;
  this.size=0;
  this.buffer=new Object[bufferSize];
  this.segmentOffsets=new ArrayList();
  this.segmentOffsets.add(new Integer(0));
  createRandomAccessFile();
}

Fixed version (ground truth):
/** 
 * @throws IOException
 */
public BaseDiskArray() throws IOException {
  this.currentCacheStartIndex=0;
  this.size=0;
  this.buffer=new Object[bufferSize];
  this.segmentOffsets=new ArrayList();
  this.segmentOffsets.add(new Integer(0));
  createRandomAccessFile();
}
Program: 71337
Project: 71337
Buggy source:
public Object get(int index) throws IOException {
  RangeCheck(index);
  if (currentCacheStartIndex < 0 || index < currentCacheStartIndex || index > (currentCacheStartIndex + bufferSize - 1)) {
    int readSize=bufferSize;
    if ((index / bufferSize) == segmentOffsets.size() - 1) {
      readSize=size % bufferSize;
    }
    currentCacheStartIndex=(index / bufferSize) * bufferSize;
    readObjects(getSegmentOffset(index),readSize);
  }
  return buffer[index % bufferSize];
}

Fixed version (ground truth):
public Object get(int index) throws IOException {
  RangeCheck(index);
  if (index < currentCacheStartIndex || index > (currentCacheStartIndex + bufferSize - 1)) {
    int readSize=bufferSize;
    if ((index / bufferSize) == segmentOffsets.size() - 1) {
      readSize=size % bufferSize;
    }
    currentCacheStartIndex=(index / bufferSize) * bufferSize;
    readObjects(getSegmentOffset(index),readSize);
  }
  return buffer[index % bufferSize];
}
Program: 71340
Project: 71340
Buggy source:
private void switchDataTable(){
  if (isCubeMode()) {
    return;
  }
  Runnable runnable=new Runnable(){
    public void run(){
      ColumnBindingInfo[] headers=null;
      List dataList=null;
      try {
        headers=getDataServiceProvider().getPreviewHeadersInfo();
        dataList=getDataServiceProvider().getPreviewData();
        getDataServiceProvider().setPredefinedExpressions(headers);
        final ColumnBindingInfo[] headerInfo=headers;
        final List data=dataList;
        Display.getDefault().syncExec(new Runnable(){
          public void run(){
            updateTablePreview(headerInfo,data);
          }
        }
);
      }
 catch (      Exception e) {
        final ColumnBindingInfo[] headerInfo=headers;
        final List data=dataList;
        final String msg=e.getMessage();
        Display.getDefault().syncExec(new Runnable(){
          public void run(){
            updateTablePreview(headerInfo,data);
            WizardBase.showException(msg);
          }
        }
);
      }
    }
  }
;
  new Thread(runnable).start();
}

Fixed version (ground truth):
private void switchDataTable(){
  if (isCubeMode()) {
    return;
  }
  Runnable runnable=new Runnable(){
    public void run(){
      if (bIsGettingPreviewData) {
        return;
      }
      ColumnBindingInfo[] headers=null;
      List dataList=null;
      try {
        headers=getDataServiceProvider().getPreviewHeadersInfo();
        bIsGettingPreviewData=true;
        dataList=getDataServiceProvider().getPreviewData();
        bIsGettingPreviewData=false;
        getDataServiceProvider().setPredefinedExpressions(headers);
        final ColumnBindingInfo[] headerInfo=headers;
        final List data=dataList;
        Display.getDefault().syncExec(new Runnable(){
          public void run(){
            updateTablePreview(headerInfo,data);
          }
        }
);
      }
 catch (      Exception e) {
        final ColumnBindingInfo[] headerInfo=headers;
        final List data=dataList;
        final String msg=e.getMessage();
        Display.getDefault().syncExec(new Runnable(){
          public void run(){
            updateTablePreview(headerInfo,data);
            WizardBase.showException(msg);
          }
        }
);
      }
    }
  }
;
  new Thread(runnable).start();
}
Program: 71343
Project: 71343
Buggy source:
/** 
 * Computes min, max value, step size and step number of the Axis
 * @param oMinValue min value in data points. Double or CDateTime type.
 * @param oMaxValue max value in data points. Double or CDateTime type.
 */
public final void updateAxisMinMax(Object oMinValue,Object oMaxValue){
  if (rtc.getScale() != null && rtc.getScale().isShared()) {
    updateContext(rtc.getScale());
    return;
  }
  ScaleContext sct;
  if ((iType & LOGARITHMIC) == LOGARITHMIC) {
    if ((iType & PERCENT) == PERCENT) {
      oMaximum=new Double(100);
      oMinimum=new Double(1);
      setStep(new Double(10));
      bMaximumFixed=true;
      bMinimumFixed=true;
      bStepFixed=true;
      return;
    }
    sct=new ScaleContext(iMarginPercent,iType,oMinValue,oMaxValue,oStep);
  }
 else   if ((iType & DATE_TIME) == DATE_TIME) {
    int iUnit=asInteger(oUnit);
    sct=new ScaleContext(iMarginPercent,iType,iUnit,oMinValue,oMaxValue,oStep);
  }
 else {
    sct=new ScaleContext(iMarginPercent,iType,oMinValue,oMaxValue,oStep);
  }
  if ((iType & DATE_TIME) == DATE_TIME) {
    sct.setFixedValue(bMinimumFixed,bMaximumFixed,oMinimumFixed,oMaximumFixed);
  }
 else {
    sct.setFixedValue(bMinimumFixed,bMaximumFixed,oMinimum,oMaximum);
  }
  sct.setFixedStep(bStepFixed,oStepNumber);
  sct.computeMinMax();
  updateContext(sct);
  tmpSC=sct;
  updateSharedScaleContext(rtc,iType,tmpSC);
}

Fixed version (ground truth):
/** 
 * Computes min, max value, step size and step number of the Axis
 * @param oMinValue min value in data points. Double or CDateTime type.
 * @param oMaxValue max value in data points. Double or CDateTime type.
 */
public final void updateAxisMinMax(Object oMinValue,Object oMaxValue){
  if (rtc.getSharedScale() != null && rtc.getSharedScale().isShared()) {
    updateContext(rtc.getSharedScale().getScaleContext());
    return;
  }
  ScaleContext sct;
  if ((iType & LOGARITHMIC) == LOGARITHMIC) {
    if ((iType & PERCENT) == PERCENT) {
      oMaximum=new Double(100);
      oMinimum=new Double(1);
      setStep(new Double(10));
      bMaximumFixed=true;
      bMinimumFixed=true;
      bStepFixed=true;
      return;
    }
    sct=new ScaleContext(iMarginPercent,iType,oMinValue,oMaxValue,oStep);
  }
 else   if ((iType & DATE_TIME) == DATE_TIME) {
    int iUnit=asInteger(oUnit);
    sct=new ScaleContext(iMarginPercent,iType,iUnit,oMinValue,oMaxValue,oStep);
  }
 else {
    sct=new ScaleContext(iMarginPercent,iType,oMinValue,oMaxValue,oStep);
  }
  if ((iType & DATE_TIME) == DATE_TIME) {
    sct.setFixedValue(bMinimumFixed,bMaximumFixed,oMinimumFixed,oMaximumFixed);
  }
 else {
    sct.setFixedValue(bMinimumFixed,bMaximumFixed,oMinimum,oMaximum);
  }
  sct.setFixedStep(bStepFixed,oStepNumber);
  sct.computeMinMax();
  updateContext(sct);
  tmpSC=sct;
  updateSharedScaleContext(rtc,iType,tmpSC);
}
Program: 71346
Project: 71346
Buggy source:
private boolean isSharedScale(){
  return rtc.getScale() != null && rtc.getScale().isShared();
}

Fixed version (ground truth):
private boolean isSharedScale(){
  return rtc.getSharedScale() != null && rtc.getSharedScale().isShared();
}
Program: 71347
Project: 71347
Buggy source:
/** 
 * A default zero-arg public constructor used for object creation.
 */
public RunTimeContext(){
  stateStore=new HashMap();
}

Fixed version (ground truth):
/** 
 * A default zero-arg public constructor used for object creation.
 */
public RunTimeContext(){
  stateStore=new HashMap<Object,Object>(2);
}
Program: 71348
Project: 71348
Buggy source:
private ScaleContext createSharedScaleFromSampleData(){
  Double min=Double.MAX_VALUE, max=-Double.MAX_VALUE;
  SampleData sd=cm.getSampleData();
  if (sd == null || sd.getBaseSampleData().size() == 0 || sd.getOrthogonalSampleData().size() == 0) {
    return null;
  }
  OrthogonalSampleData osd=(OrthogonalSampleData)sd.getOrthogonalSampleData().get(0);
  String sData=osd.getDataSetRepresentation();
  List<Double> lData=parseSampleData(sData);
  if (lData == null) {
    return null;
  }
  for (int i=0; i < lData.size(); i++) {
    double v=lData.get(i);
    min=Math.min(min,v);
    max=Math.max(max,v);
  }
  return ScaleContext.createSimpleScale(min,max);
}

Fixed version (ground truth):
private SharedScaleContext createSharedScaleFromSampleData(){
  Double min=Double.MAX_VALUE, max=-Double.MAX_VALUE;
  SampleData sd=cm.getSampleData();
  if (sd == null || sd.getBaseSampleData().size() == 0 || sd.getOrthogonalSampleData().size() == 0) {
    return null;
  }
  OrthogonalSampleData osd=(OrthogonalSampleData)sd.getOrthogonalSampleData().get(0);
  String sData=osd.getDataSetRepresentation();
  List<Double> lData=parseSampleData(sData);
  if (lData == null) {
    return null;
  }
  for (int i=0; i < lData.size(); i++) {
    double v=lData.get(i);
    min=Math.min(min,v);
    max=Math.max(max,v);
  }
  return SharedScaleContext.createInstance(min,max);
}
Program: 71349
Project: 71349
Buggy source:
private void showChart(Dimension dSize){
  Bounds bo=BoundsImpl.create(0,0,dSize.width,dSize.height);
  bo.scale(72d / idr.getDisplayServer().getDpiResolution());
  idr.setProperty(IDeviceRenderer.GRAPHICS_CONTEXT,gc);
  Generator gr=Generator.instance();
  ChartAdapter.beginIgnoreNotifications();
  cm.clearSections(IConstants.RUN_TIME);
  cm.createSampleRuntimeSeries();
  ChartAdapter.endIgnoreNotifications();
  try {
    Chart cmRunTime=(Chart)EcoreUtil.copy(cm);
    removeScaleInfoForSample(cmRunTime);
    RunTimeContext rtc=new RunTimeContext();
    rtc.setScriptingEnabled(false);
    rtc.setMessageLookup(new BIRTDesignerMessageLookup(crii.getHandle()));
    rtc.setRightToLeft(crii.isLayoutDirectionRTL());
    rtc.setRightToLeftText(crii.getHandle().isDirectionRTL());
    rtc.setResourceFinder(crii);
    rtc.setExternalizer(crii);
    boolean bPlotChart=ChartXTabUtil.isPlotChart(crii.getHandle());
    if (bPlotChart) {
      rtc.setScale(createSharedScaleFromSampleData());
    }
    gr.render(idr,gr.build(idr.getDisplayServer(),cmRunTime,bo,null,rtc,new ChartReportStyleProcessor(crii.getHandle(),true)));
  }
 catch (  ChartException gex) {
    showException(gc,gex);
  }
}

Fixed version (ground truth):
private void showChart(Dimension dSize){
  Bounds bo=BoundsImpl.create(0,0,dSize.width,dSize.height);
  bo.scale(72d / idr.getDisplayServer().getDpiResolution());
  idr.setProperty(IDeviceRenderer.GRAPHICS_CONTEXT,gc);
  Generator gr=Generator.instance();
  ChartAdapter.beginIgnoreNotifications();
  cm.clearSections(IConstants.RUN_TIME);
  cm.createSampleRuntimeSeries();
  ChartAdapter.endIgnoreNotifications();
  try {
    Chart cmRunTime=(Chart)EcoreUtil.copy(cm);
    removeScaleInfoForSample(cmRunTime);
    RunTimeContext rtc=new RunTimeContext();
    rtc.setScriptingEnabled(false);
    rtc.setMessageLookup(new BIRTDesignerMessageLookup(crii.getHandle()));
    rtc.setRightToLeft(crii.isLayoutDirectionRTL());
    rtc.setRightToLeftText(crii.getHandle().isDirectionRTL());
    rtc.setResourceFinder(crii);
    rtc.setExternalizer(crii);
    boolean bPlotChart=ChartXTabUtil.isPlotChart(crii.getHandle());
    if (bPlotChart) {
      rtc.setSharedScale(createSharedScaleFromSampleData());
    }
    gr.render(idr,gr.build(idr.getDisplayServer(),cmRunTime,bo,null,rtc,new ChartReportStyleProcessor(crii.getHandle(),true)));
  }
 catch (  ChartException gex) {
    showException(gc,gex);
  }
}
Program: 71350
Project: 71350
Buggy source:
public void setModelObject(ExtendedItemHandle eih){
  handle=(ExtendedItemHandle)eih.getElementProperty(ChartReportItemUtil.PROPERTY_HOST_CHART);
  IReportItem item=getReportItem(handle);
  if (item == null) {
    return;
  }
  cm=(Chart)((ChartReportItemImpl)item).getProperty(ChartReportItemUtil.PROPERTY_CHART);
  setChartModelObject(item);
}

Fixed version (ground truth):
public void setModelObject(ExtendedItemHandle eih){
  handle=(ExtendedItemHandle)eih.getElementProperty(ChartReportItemConstants.PROPERTY_HOST_CHART);
  IReportItem item=getReportItem(handle);
  if (item == null) {
    return;
  }
  cm=(Chart)((ChartReportItemImpl)item).getProperty(ChartReportItemConstants.PROPERTY_CHART);
  setChartModelObject(item);
}
Program: 71351
Project: 71351
Buggy source:
@Override protected IDataRowExpressionEvaluator createEvaluator(IBaseResultSet set) throws ChartException {
  if (rtc.getScale() == null || !rtc.getScale().isShared()) {
    return super.createEvaluator(set);
  }
  final boolean bDatetypeAxis;
  if (cm instanceof ChartWithAxes) {
    ChartWithAxes cwa=(ChartWithAxes)cm;
    Axis yAxis=cwa.getOrthogonalAxes(cwa.getBaseAxes()[0],true)[0];
    bDatetypeAxis=yAxis.getType() == AxisType.DATE_TIME_LITERAL;
  }
 else {
    bDatetypeAxis=false;
  }
  return new IDataRowExpressionEvaluator(){
    private int count=1;
    public void close(){
    }
    public Object evaluate(    String expression){
      return bDatetypeAxis ? Calendar.getInstance() : new Integer(1);
    }
    public Object evaluateGlobal(    String expression){
      return evaluate(expression);
    }
    public boolean first(){
      return true;
    }
    public boolean next(){
      return count-- > 0;
    }
  }
;
}

Fixed version (ground truth):
@Override protected IDataRowExpressionEvaluator createEvaluator(IBaseResultSet set) throws ChartException {
  if (rtc.getSharedScale() == null || !rtc.getSharedScale().isShared()) {
    return super.createEvaluator(set);
  }
  final boolean bDatetypeAxis;
  if (cm instanceof ChartWithAxes) {
    ChartWithAxes cwa=(ChartWithAxes)cm;
    Axis yAxis=cwa.getOrthogonalAxes(cwa.getBaseAxes()[0],true)[0];
    bDatetypeAxis=yAxis.getType() == AxisType.DATE_TIME_LITERAL;
  }
 else {
    bDatetypeAxis=false;
  }
  return new IDataRowExpressionEvaluator(){
    private int count=1;
    public void close(){
    }
    public Object evaluate(    String expression){
      return bDatetypeAxis ? Calendar.getInstance() : new Integer(1);
    }
    public Object evaluateGlobal(    String expression){
      return evaluate(expression);
    }
    public boolean first(){
      return true;
    }
    public boolean next(){
      return count-- > 0;
    }
  }
;
}
Program: 71352
Project: 71352
Buggy source:
/** 
 * 1) Creates row wrapper. 2) For the null cell in the row wrapper, fills the responsible position with dummy cell or empty cell. 3) Updates the height of the row and the cells in the row.
 * @param rowArea current rowArea.
 */
private Row updateRow(RowArea rowArea,int specifiedHeight){
  int height=specifiedHeight;
  Row lastRow=(Row)rows.getCurrent();
  Row row=new Row(rowArea,startCol,endCol);
  for (int i=startCol; i <= endCol; i++) {
    CellArea upperCell=null;
    if (lastRow != null) {
      upperCell=lastRow.getCell(i);
    }
    if (upperCell != null && (upperCell.getRowSpan() > 1)) {
      DummyCell dummyCell=createDummyCell(upperCell);
      row.addArea(dummyCell);
      int delta=dummyCell.getDelta();
      if (dummyCell.getRowSpan() == 1) {
        height=Math.max(height,delta);
      }
      i=i + upperCell.getColSpan() - 1;
    }
 else {
      CellArea cell=row.getCell(i);
      if (cell == null) {
        if (unresolvedRow != null) {
          upperCell=unresolvedRow.getCell(i);
        }
        cell=createEmptyCell(upperCell,i,row,lastRow);
      }
      if (cell.getRowSpan() == 1) {
        height=Math.max(height,cell.getHeight());
      }
      i=i + cell.getColSpan() - 1;
    }
  }
  updateRowHeight(row,height);
  return row;
}

Fixed version (ground truth):
/** 
 * 1) Creates row wrapper. 2) For the null cell in the row wrapper, fills the relevant position with dummy cell or empty cell. 3) Updates the height of the row and the cells in the row.
 * @param rowArea current rowArea.
 */
private Row updateRow(RowArea rowArea,int specifiedHeight){
  int height=specifiedHeight;
  Row lastRow=(Row)rows.getCurrent();
  Row row=new Row(rowArea,startCol,endCol);
  boolean usedResolvedRow=false;
  for (int i=startCol; i <= endCol; i++) {
    CellArea upperCell=null;
    if (lastRow != null) {
      upperCell=lastRow.getCell(i);
    }
    if (upperCell != null && (upperCell.getRowSpan() > 1)) {
      DummyCell dummyCell=createDummyCell(upperCell);
      row.addArea(dummyCell);
      int delta=dummyCell.getDelta();
      if (dummyCell.getRowSpan() == 1) {
        height=Math.max(height,delta);
      }
      i=i + upperCell.getColSpan() - 1;
    }
 else {
      CellArea cell=row.getCell(i);
      if (cell == null) {
        if (unresolvedRow != null) {
          upperCell=unresolvedRow.getCell(i);
          usedResolvedRow=true;
        }
        cell=createEmptyCell(upperCell,i,row,lastRow);
      }
      if (cell.getRowSpan() == 1) {
        height=Math.max(height,cell.getHeight());
      }
      i=i + cell.getColSpan() - 1;
    }
  }
  if (usedResolvedRow) {
    unresolvedRow=null;
  }
  updateRowHeight(row,height);
  return row;
}
Program: 71354
Project: 71354
Buggy source:
protected void repeatHeader(){
  if (bandStatus == IBandContent.BAND_GROUP_HEADER) {
    return;
  }
  if (!((IGroupContent)content).isHeaderRepeat()) {
    return;
  }
  IBandContent header=context.getWrappedGroupHeader(content.getInstanceID());
  if (header == null || header.getChildren().isEmpty()) {
    return;
  }
  TableRegionLayout rLayout=tableLM.getTableRegionLayout();
  rLayout.initialize(header);
  rLayout.layout();
  TableArea tableRegion=(TableArea)header.getExtension(IContent.LAYOUT_EXTENSION);
  if (tableRegion != null && tableRegion.getAllocatedHeight() < getCurrentMaxContentHeight()) {
    Iterator iter=tableRegion.getChildren();
    TableContext tableContext=(TableContext)tableLM.contextList.getLast();
    while (iter.hasNext()) {
      ContainerArea area=(ContainerArea)iter.next();
      Iterator rowIter=area.getChildren();
      while (rowIter.hasNext()) {
        AbstractArea row=(AbstractArea)rowIter.next();
        if (row instanceof RowArea) {
          tableContext.layout.addRow((RowArea)row);
        }
      }
    }
    iter=tableRegion.getChildren();
    while (iter.hasNext()) {
      AbstractArea area=(AbstractArea)iter.next();
      addArea(area);
    }
  }
  content.setExtension(IContent.LAYOUT_EXTENSION,null);
}

Fixed version (ground truth):
protected void repeatHeader(){
  if (bandStatus == IBandContent.BAND_GROUP_HEADER) {
    return;
  }
  if (!((IGroupContent)content).isHeaderRepeat()) {
    return;
  }
  IBandContent header=context.getWrappedGroupHeader(content.getInstanceID());
  if (header == null || header.getChildren().isEmpty()) {
    return;
  }
  TableRegionLayout rLayout=tableLM.getTableRegionLayout();
  rLayout.initialize(header);
  rLayout.layout();
  TableArea tableRegion=(TableArea)header.getExtension(IContent.LAYOUT_EXTENSION);
  if (tableRegion != null && tableRegion.getAllocatedHeight() < getCurrentMaxContentHeight()) {
    TableContext tableContext=(TableContext)tableLM.contextList.getLast();
    tableContext.layout.addRows(rLayout.getTableAreaLayout().getRows());
    Iterator iter=tableRegion.getChildren();
    while (iter.hasNext()) {
      AbstractArea area=(AbstractArea)iter.next();
      addArea(area);
    }
  }
  content.setExtension(IContent.LAYOUT_EXTENSION,null);
}
Program: 71355
Project: 71355
Buggy source:
protected void repeatHeader(){
  if (bandStatus == IBandContent.BAND_HEADER) {
    return;
  }
  ITableBandContent header=context.getWrappedTableHeader(content.getInstanceID());
  if (header == null || !tableContent.isHeaderRepeat()) {
    return;
  }
  if (header.getChildren().isEmpty()) {
    return;
  }
  TableRegionLayout rLayout=getTableRegionLayout();
  rLayout.initialize(header);
  rLayout.layout();
  TableArea tableRegion=(TableArea)header.getExtension(IContent.LAYOUT_EXTENSION);
  if (tableRegion != null && tableRegion.getAllocatedHeight() < getCurrentMaxContentHeight()) {
    Iterator iter=tableRegion.getChildren();
    TableContext tableContext=(TableContext)contextList.getLast();
    while (iter.hasNext()) {
      ContainerArea area=(ContainerArea)iter.next();
      Iterator rowIter=area.getChildren();
      while (rowIter.hasNext()) {
        AbstractArea row=(AbstractArea)rowIter.next();
        if (row instanceof RowArea) {
          tableContext.layout.addRow((RowArea)row);
        }
      }
    }
    iter=tableRegion.getChildren();
    while (iter.hasNext()) {
      AbstractArea area=(AbstractArea)iter.next();
      addArea(area);
    }
  }
  content.setExtension(IContent.LAYOUT_EXTENSION,null);
}

Fixed version (ground truth):
protected void repeatHeader(){
  if (bandStatus == IBandContent.BAND_HEADER) {
    return;
  }
  ITableBandContent header=context.getWrappedTableHeader(content.getInstanceID());
  if (header == null || !tableContent.isHeaderRepeat()) {
    return;
  }
  if (header.getChildren().isEmpty()) {
    return;
  }
  TableRegionLayout rLayout=getTableRegionLayout();
  rLayout.initialize(header);
  rLayout.layout();
  TableArea tableRegion=(TableArea)header.getExtension(IContent.LAYOUT_EXTENSION);
  if (tableRegion != null && tableRegion.getAllocatedHeight() < getCurrentMaxContentHeight()) {
    TableContext tableContext=(TableContext)contextList.getLast();
    tableContext.layout.addRows(rLayout.getTableAreaLayout().getRows());
    Iterator iter=tableRegion.getChildren();
    while (iter.hasNext()) {
      AbstractArea area=(AbstractArea)iter.next();
      addArea(area);
    }
  }
  content.setExtension(IContent.LAYOUT_EXTENSION,null);
}
Program: 71356
Project: 71356
Buggy source:
public void startForeign(IForeignContent foreign){
  layoutEmitter.startForeign(foreign);
}

Fixed version (ground truth):
public void startForeign(IForeignContent foreign){
  layoutEmitter.startForeign(foreign);
  if (isInHeader()) {
    IContainerContent pContent=(IContainerContent)parentContents.peek();
    pContent.getChildren().add(foreign);
  }
}
Program: 71357
Project: 71357
Buggy source:
/** 
 * @param inputStream
 * @param queryDefn
 * @throws DataException
 */
private static void loadBaseQueryDefn(InputStream inputStream,BaseQueryDefinition queryDefn,int version) throws DataException {
  try {
    queryDefn.getBindings().putAll(loadBinding(inputStream,version));
    queryDefn.getFilters().addAll(FilterDefnUtil.loadFilterDefn(inputStream));
    queryDefn.getGroups().addAll(GroupDefnUtil.loadGroupDefn(inputStream,queryDefn,version));
    queryDefn.getSorts().addAll(loadSorts(inputStream,version));
    queryDefn.setMaxRows(IOUtil.readInt(inputStream));
    queryDefn.setUsesDetails(IOUtil.readBool(inputStream));
    queryDefn.getSubqueries().addAll(loadSubQuery(inputStream,queryDefn,version));
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_LOAD_ERROR,e);
  }
}

Fixed version (ground truth):
/** 
 * @param inputStream
 * @param queryDefn
 * @throws DataException
 */
private static void loadBaseQueryDefn(InputStream inputStream,BaseQueryDefinition queryDefn,int version) throws DataException {
  try {
    queryDefn.getBindings().putAll(loadBinding(inputStream,version));
    queryDefn.getFilters().addAll(FilterDefnUtil.loadFilterDefn(inputStream));
    queryDefn.getGroups().addAll(GroupDefnUtil.loadGroupDefn(inputStream,queryDefn,version));
    queryDefn.getSorts().addAll(loadSorts(inputStream,version));
    queryDefn.setMaxRows(IOUtil.readInt(inputStream));
    queryDefn.setUsesDetails(IOUtil.readBool(inputStream));
    queryDefn.getSubqueries().addAll(loadSubQuery(inputStream,queryDefn,version));
    queryDefn.setQueryExecutionHints(loadQueryExecutionHints(inputStream,version));
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_LOAD_ERROR,e);
  }
}
Program: 71358
Project: 71358
Buggy source:
/** 
 * @param outputStream
 * @param queryDefn
 * @throws DataException
 * @throws IOException
 */
static void saveBaseQueryDefn(OutputStream outputStream,IBaseQueryDefinition queryDefn,int version) throws DataException {
  try {
    saveBinding(outputStream,queryDefn.getBindings(),version);
    FilterDefnUtil.saveFilterDefn(outputStream,queryDefn.getFilters());
    GroupDefnUtil.saveGroupDefn(outputStream,queryDefn.getGroups(),version);
    saveSorts(outputStream,queryDefn.getSorts(),version);
    IOUtil.writeInt(outputStream,queryDefn.getMaxRows());
    IOUtil.writeBool(outputStream,queryDefn.usesDetails());
    saveSubQuery(outputStream,queryDefn.getSubqueries(),version);
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e);
  }
}

Fixed version (ground truth):
/** 
 * @param outputStream
 * @param queryDefn
 * @throws DataException
 * @throws IOException
 */
static void saveBaseQueryDefn(OutputStream outputStream,IBaseQueryDefinition queryDefn,int version) throws DataException {
  try {
    saveBinding(outputStream,queryDefn.getBindings(),version);
    FilterDefnUtil.saveFilterDefn(outputStream,queryDefn.getFilters());
    GroupDefnUtil.saveGroupDefn(outputStream,queryDefn.getGroups(),version);
    saveSorts(outputStream,queryDefn.getSorts(),version);
    IOUtil.writeInt(outputStream,queryDefn.getMaxRows());
    IOUtil.writeBool(outputStream,queryDefn.usesDetails());
    saveSubQuery(outputStream,queryDefn.getSubqueries(),version);
    saveQueryExecutionHints(outputStream,queryDefn.getQueryExecutionHints(),version);
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e);
  }
}
Program: 71359
Project: 71359
Buggy source:
/** 
 * @return
 */
public static int getLatestVersion(){
  return VERSION_2_3_2;
}

Fixed version (ground truth):
/** 
 * @return
 */
public static int getLatestVersion(){
  return VERSION_2_3_2_1;
}
Program: 71360
Project: 71360
Buggy source:
/** 
 * Computes min, max value, step size and step number of the Axis
 * @param oMinValue min value in data points. Double or CDateTime type.
 * @param oMaxValue max value in data points. Double or CDateTime type.
 */
public final void updateAxisMinMax(Object oMinValue,Object oMaxValue){
  if (rtc.getScale() != null && rtc.getScale().isShared()) {
    updateContext(rtc.getScale());
    return;
  }
  if (rtc.getScale() != null) {
    oMinValue=rtc.getScale().getMin();
    oMaxValue=rtc.getScale().getMax();
  }
  ScaleContext sct;
  if ((iType & LOGARITHMIC) == LOGARITHMIC) {
    if ((iType & PERCENT) == PERCENT) {
      oMaximum=new Double(100);
      oMinimum=new Double(1);
      setStep(new Double(10));
      bMaximumFixed=true;
      bMinimumFixed=true;
      bStepFixed=true;
      return;
    }
    sct=new ScaleContext(iMarginPercent,iType,oMinValue,oMaxValue,oStep);
  }
 else   if ((iType & DATE_TIME) == DATE_TIME) {
    int iUnit=asInteger(oUnit);
    sct=new ScaleContext(iMarginPercent,iType,iUnit,oMinValue,oMaxValue,oStep);
  }
 else {
    sct=new ScaleContext(iMarginPercent,iType,oMinValue,oMaxValue,oStep);
  }
  if ((iType & DATE_TIME) == DATE_TIME) {
    sct.setFixedValue(bMinimumFixed,bMaximumFixed,oMinimumFixed,oMaximumFixed);
  }
 else {
    sct.setFixedValue(bMinimumFixed,bMaximumFixed,oMinimum,oMaximum);
  }
  sct.setFixedStep(bStepFixed,oStepNumber);
  sct.computeMinMax();
  updateContext(sct);
  tmpSC=sct;
  updateSharedScaleContext(rtc,iType,tmpSC);
}

Fixed version (ground truth):
/** 
 * Computes min, max value, step size and step number of the Axis
 * @param oMinValue min value in data points. Double or CDateTime type.
 * @param oMaxValue max value in data points. Double or CDateTime type.
 */
public final void updateAxisMinMax(Object oMinValue,Object oMaxValue){
  if (rtc.getScale() != null && rtc.getScale().isShared()) {
    updateContext(rtc.getScale());
    return;
  }
  ScaleContext sct;
  if ((iType & LOGARITHMIC) == LOGARITHMIC) {
    if ((iType & PERCENT) == PERCENT) {
      oMaximum=new Double(100);
      oMinimum=new Double(1);
      setStep(new Double(10));
      bMaximumFixed=true;
      bMinimumFixed=true;
      bStepFixed=true;
      return;
    }
    sct=new ScaleContext(iMarginPercent,iType,oMinValue,oMaxValue,oStep);
  }
 else   if ((iType & DATE_TIME) == DATE_TIME) {
    int iUnit=asInteger(oUnit);
    sct=new ScaleContext(iMarginPercent,iType,iUnit,oMinValue,oMaxValue,oStep);
  }
 else {
    sct=new ScaleContext(iMarginPercent,iType,oMinValue,oMaxValue,oStep);
  }
  if ((iType & DATE_TIME) == DATE_TIME) {
    sct.setFixedValue(bMinimumFixed,bMaximumFixed,oMinimumFixed,oMaximumFixed);
  }
 else {
    sct.setFixedValue(bMinimumFixed,bMaximumFixed,oMinimum,oMaximum);
  }
  sct.setFixedStep(bStepFixed,oStepNumber);
  sct.computeMinMax();
  updateContext(sct);
  tmpSC=sct;
  updateSharedScaleContext(rtc,iType,tmpSC);
}
Program: 71363
Project: 71363
Buggy source:
public void setModelObject(ExtendedItemHandle eih){
  IReportItem item=getReportItem(eih);
  if (item == null) {
    return;
  }
  cm=(Chart)((ChartReportItemImpl)item).getProperty(ChartReportItemUtil.PROPERTY_CHART);
  handle=eih;
  setChartModelObject(item);
}

Fixed version (ground truth):
public void setModelObject(ExtendedItemHandle eih){
  IReportItem item=getReportItem(eih);
  if (item == null) {
    return;
  }
  cm=(Chart)((ChartReportItemImpl)item).getProperty(ChartReportItemConstants.PROPERTY_CHART);
  handle=eih;
  setChartModelObject(item);
}
Program: 71366
Project: 71366
Buggy source:
protected void setChartModelObject(IReportItem item){
  Object of=handle.getProperty(ChartReportItemUtil.PROPERTY_OUTPUT);
  if (of instanceof String) {
    outputFormat=(String)of;
  }
  of=item.getProperty(ChartReportItemUtil.PROPERTY_SCALE);
  if (of instanceof ScaleContext) {
    if (rtc == null) {
      rtc=new RunTimeContext();
    }
    rtc.setScale((ScaleContext)of);
  }
}

Fixed version (ground truth):
protected void setChartModelObject(IReportItem item){
  Object of=handle.getProperty(ChartReportItemConstants.PROPERTY_OUTPUT);
  if (of instanceof String) {
    outputFormat=(String)of;
  }
  of=item.getProperty(ChartReportItemConstants.PROPERTY_SCALE);
  if (of instanceof ScaleContext) {
    if (rtc == null) {
      rtc=new RunTimeContext();
    }
    rtc.setScale((ScaleContext)of);
  }
}
Program: 71367
Project: 71367
Buggy source:
public void gotoFirstPage(){
  int size=contextList.size();
  if (size == 1) {
    return;
  }
 else {
    int index=contextList.indexOf(currentContext);
    if (index > 0) {
      currentContext=contextList.get(0);
      parent.step(0 - index);
    }
  }
}

Fixed version (ground truth):
public void gotoFirstPage(){
  int size=contextList.size();
  if (size == 1) {
    return;
  }
 else {
    int index=contextList.indexOf(currentContext);
    if (index > 0) {
      setCurrentContext(0);
      parent.step(0 - index);
    }
  }
}
Program: 71368
Project: 71368
Buggy source:
public void autoPageBreak(){
  if (parent != null) {
    parent.autoPageBreak();
  }
  int size=contextList.size();
  if (size == 0 || size > 0 && currentContext == contextList.getLast()) {
    initialize();
  }
 else {
    int index=contextList.indexOf(currentContext) + 1;
    if (index >= 0 && index < contextList.size()) {
      currentContext=contextList.get(index);
    }
  }
}

Fixed version (ground truth):
public void autoPageBreak(){
  if (parent != null) {
    parent.autoPageBreak();
  }
  int size=contextList.size();
  if (size == 0 || size > 0 && currentContext == contextList.getLast()) {
    initialize();
  }
 else {
    int index=contextList.indexOf(currentContext) + 1;
    if (index >= 0 && index < contextList.size()) {
      setCurrentContext(index);
    }
  }
}
Program: 71369
Project: 71369
Buggy source:
public void step(int step){
  if (currentContext != null) {
    int index=contextList.indexOf(currentContext) + step;
    if (index >= 0 && index < contextList.size()) {
      currentContext=contextList.get(index);
      if (parent != null) {
        parent.step(step);
      }
    }
  }
}

Fixed version (ground truth):
public void step(int step){
  if (currentContext != null) {
    int index=contextList.indexOf(currentContext) + step;
    if (index >= 0 && index < contextList.size()) {
      setCurrentContext(index);
      if (parent != null) {
        parent.step(step);
      }
    }
  }
}
Program: 71370
Project: 71370
Buggy source:
public void gotoLastPage(){
  int size=contextList.size();
  if (size == 1) {
    return;
  }
 else {
    int index=contextList.indexOf(currentContext);
    if (index != size - 1) {
      currentContext=contextList.get(size - 1);
      parent.step(size - 1 - index);
    }
  }
}

Fixed version (ground truth):
public void gotoLastPage(){
  int size=contextList.size();
  if (size == 1) {
    return;
  }
 else {
    int index=contextList.indexOf(currentContext);
    if (index != size - 1) {
      setCurrentContext(size - 1);
      parent.step(size - 1 - index);
    }
  }
}
Program: 71371
Project: 71371
Buggy source:
public IResultSet executeQuery() throws OdaException {
  logger.logp(java.util.logging.Level.FINE,CallStatement.class.getName(),"String_Node_Str","String_Node_Str");
  if (this.cachedResultSet != null) {
    IResultSet ret=this.cachedResultSet;
    this.cachedResultSet=null;
    this.isExecuted=false;
    return ret;
  }
  if (!maxRowsUpToDate) {
    try {
      assertNotNull(callStat);
      callStat.setMaxRows(maxrows);
    }
 catch (    SQLException e1) {
    }
    maxRowsUpToDate=true;
  }
  registerOutputParameter();
  java.sql.ResultSet rs=null;
  try {
    this.callStat.execute();
    this.isExecuted=true;
    rs=this.callStat.getResultSet();
    if (rs == null && callStat.getUpdateCount() != -1) {
      while (true) {
        int rowCount=callStat.getUpdateCount();
        if (rowCount != -1) {
          if (callStat.getMoreResults() == false && callStat.getUpdateCount() == -1)           break;
          continue;
        }
 else {
          rs=callStat.getResultSet();
          break;
        }
      }
    }
    if (rs != null)     return new ResultSet(rs);
    this.populateOutputParamResultSet();
    java.sql.ResultSet resultSet=this.outputParameterResultSetsMap.size() == 0 ? null : this.outputParameterResultSetsMap.values().iterator().next();
    if (resultSet != null)     return new ResultSet(resultSet);
 else     return new SPResultSet(null);
  }
 catch (  SQLException e) {
    throw new JDBCException(ResourceConstants.RESULTSET_CANNOT_RETURN,e);
  }
}

Fixed version (ground truth):
public IResultSet executeQuery() throws OdaException {
  logger.logp(java.util.logging.Level.FINE,CallStatement.class.getName(),"String_Node_Str","String_Node_Str");
  if (this.cachedResultSet != null) {
    IResultSet ret=this.cachedResultSet;
    this.cachedResultSet=null;
    return ret;
  }
  if (!maxRowsUpToDate) {
    try {
      assertNotNull(callStat);
      callStat.setMaxRows(maxrows);
    }
 catch (    SQLException e1) {
    }
    maxRowsUpToDate=true;
  }
  registerOutputParameter();
  java.sql.ResultSet rs=null;
  try {
    this.callStat.execute();
    this.isExecuted=true;
    rs=this.callStat.getResultSet();
    if (rs == null && callStat.getUpdateCount() != -1) {
      while (true) {
        int rowCount=callStat.getUpdateCount();
        if (rowCount != -1) {
          if (callStat.getMoreResults() == false && callStat.getUpdateCount() == -1)           break;
          continue;
        }
 else {
          rs=callStat.getResultSet();
          break;
        }
      }
    }
    if (rs != null)     return new ResultSet(rs);
    this.populateOutputParamResultSet();
    java.sql.ResultSet resultSet=this.outputParameterResultSetsMap.size() == 0 ? null : this.outputParameterResultSetsMap.values().iterator().next();
    if (resultSet != null)     return new ResultSet(resultSet);
 else     return new SPResultSet(null);
  }
 catch (  SQLException e) {
    throw new JDBCException(ResourceConstants.RESULTSET_CANNOT_RETURN,e);
  }
}
Program: 71375
Project: 71375
Buggy source:
/** 
 * Reset grouping units items.
 * @param grouping
 * @param isGroupingEnableUI
 * @since BIRT 2.3
 */
private void resetGroupingUnitsCombo(boolean isGroupingEnableUI){
  NameSet ns;
  ns=LiteralHelper.getGroupingUnitTypeSet(fGrouping.getGroupType());
  if (ns != null) {
    cmbUnit.setItems(ns.getDisplayNames());
    if (isGroupingEnableUI && fGrouping.getGroupType() != null && (fGrouping.getGroupType() == DataType.DATE_TIME_LITERAL || fGrouping.getGroupType() == DataType.TEXT_LITERAL) && fGrouping.getGroupingUnit() != null) {
      String name=ChartUtil.getGroupingUnitName(fGrouping);
      if (name != null) {
        String displayName=ns.getDisplayNameByName(name);
        if (displayName == null) {
          cmbUnit.select(0);
        }
 else {
          cmbUnit.setText(name);
        }
      }
 else {
        cmbUnit.select(0);
      }
    }
  }
 else {
    cmbUnit.removeAll();
  }
  lblUnit.setEnabled(isGroupingEnableUI && (isDateTimeGrouping(cmbType.getText()) || isTextGrouping(cmbType.getText())));
  cmbUnit.setEnabled(lblUnit.getEnabled());
}

Fixed version (ground truth):
/** 
 * Reset grouping units items.
 * @param grouping
 * @param isGroupingEnableUI
 * @since BIRT 2.3
 */
private void resetGroupingUnitsCombo(boolean isGroupingEnableUI){
  NameSet ns;
  ns=LiteralHelper.getGroupingUnitTypeSet(fGrouping.getGroupType());
  if (ns != null) {
    cmbUnit.setItems(ns.getDisplayNames());
    if (isGroupingEnableUI && fGrouping.getGroupType() != null && (fGrouping.getGroupType() == DataType.DATE_TIME_LITERAL || fGrouping.getGroupType() == DataType.TEXT_LITERAL) && fGrouping.getGroupingUnit() != null) {
      String name=ChartUtil.getGroupingUnitName(fGrouping);
      if (name != null) {
        String displayName=ns.getDisplayNameByName(name);
        if (displayName == null) {
          cmbUnit.select(0);
        }
 else {
          cmbUnit.setText(displayName);
        }
      }
 else {
        cmbUnit.select(0);
      }
    }
  }
 else {
    cmbUnit.removeAll();
  }
  lblUnit.setEnabled(isGroupingEnableUI && (isDateTimeGrouping(cmbType.getText()) || isTextGrouping(cmbType.getText())));
  cmbUnit.setEnabled(lblUnit.getEnabled());
}
Program: 71376
Project: 71376
Buggy source:
/** 
 * @param s
 * @return
 */
private String[] splitOnBreaks(String s,double maxSize,Font ft){
  List al=new ArrayList();
  int i=0, j;
  do {
    j=s.indexOf('\n',i);
    if (j == -1) {
      j=s.length();
    }
    String ss=s.substring(i,j);
    if (ss != null && ss.length() > 0) {
      al.add(ss);
    }
    i=j + 1;
  }
 while (j != -1 && j < s.length());
  if (maxSize > 0) {
    List nal=new ArrayList();
    for (Iterator itr=al.iterator(); itr.hasNext(); ) {
      String ns=(String)itr.next();
      AttributedString as=new AttributedString(ns,ft.getAttributes());
      LineBreakMeasurer lbm=new LineBreakMeasurer(as.getIterator(),g2d.getFontRenderContext());
      while (lbm.getPosition() < ns.length()) {
        int next=lbm.nextOffset((float)maxSize);
        String ss=ns.substring(lbm.getPosition(),next);
        lbm.setPosition(next);
        nal.add(ss);
      }
    }
    al=nal;
  }
  final int n=al.size();
  if (n == 1 || n == 0) {
    return null;
  }
  final String[] sa=new String[n];
  for (i=0; i < al.size(); i++) {
    sa[i]=(String)al.get(i);
  }
  return sa;
}

Fixed version (ground truth):
/** 
 * @param s
 * @return
 */
private String[] splitOnBreaks(String s,double maxSize,Font ft){
  List<String> al=new ArrayList<String>();
  int i=0, j;
  do {
    j=s.indexOf('\n',i);
    if (j == -1) {
      j=s.length();
    }
    String ss=s.substring(i,j);
    if (ss != null && ss.length() > 0) {
      al.add(ss);
    }
    i=j + 1;
  }
 while (j != -1 && j < s.length());
  if (maxSize > 0) {
    List<String> nal=new ArrayList<String>();
    for (Iterator<String> itr=al.iterator(); itr.hasNext(); ) {
      String ns=(String)itr.next();
      AttributedString as=new AttributedString(ns,ft.getAttributes());
      LineBreakMeasurer lbm=new LineBreakMeasurer(as.getIterator(),g2d.getFontRenderContext());
      while (lbm.getPosition() < ns.length()) {
        int next=lbm.nextOffset((float)maxSize);
        String ss=ns.substring(lbm.getPosition(),next);
        lbm.setPosition(next);
        nal.add(ss);
      }
    }
    al=nal;
  }
  final int n=al.size();
  if (n == 1 || n == 0) {
    return null;
  }
  final String[] sa=new String[n];
  for (i=0; i < al.size(); i++) {
    sa[i]=(String)al.get(i);
  }
  return sa;
}
Program: 71377
Project: 71377
Buggy source:
/** 
 * @param s
 * @return
 */
private String[] splitOnBreaks(String s,double maxSize){
  List al=new ArrayList();
  int i=0, j;
  do {
    j=s.indexOf('\n',i);
    if (j == -1) {
      j=s.length();
    }
    String ss=s.substring(i,j);
    if (ss != null && ss.length() > 0) {
      al.add(ss);
    }
    i=j + 1;
  }
 while (j != -1 && j < s.length());
  if (maxSize > 0) {
    List nal=new ArrayList();
    for (Iterator itr=al.iterator(); itr.hasNext(); ) {
      String ns=(String)itr.next();
      AttributedString as=new AttributedString(ns,fm.getFont().getAttributes());
      LineBreakMeasurer lbm=new LineBreakMeasurer(as.getIterator(),g2d.getFontRenderContext());
      while (lbm.getPosition() < ns.length()) {
        int next=lbm.nextOffset((float)maxSize);
        String ss=ns.substring(lbm.getPosition(),next);
        lbm.setPosition(next);
        nal.add(ss);
      }
    }
    al=nal;
  }
  final int n=al.size();
  if (n == 1 || n == 0) {
    return null;
  }
  final String[] sa=new String[n];
  for (i=0; i < al.size(); i++) {
    sa[i]=(String)al.get(i);
  }
  return sa;
}

Fixed version (ground truth):
/** 
 * @param s
 * @return
 */
private String[] splitOnBreaks(String s,double maxSize){
  List<String> al=new ArrayList<String>();
  int i=0, j;
  do {
    j=s.indexOf('\n',i);
    if (j == -1) {
      j=s.length();
    }
    String ss=s.substring(i,j);
    if (ss != null && ss.length() > 0) {
      al.add(ss);
    }
    i=j + 1;
  }
 while (j != -1 && j < s.length());
  if (maxSize > 0) {
    List<String> nal=new ArrayList<String>();
    for (Iterator<String> itr=al.iterator(); itr.hasNext(); ) {
      String ns=(String)itr.next();
      AttributedString as=new AttributedString(ns,fm.getFont().getAttributes());
      LineBreakMeasurer lbm=new LineBreakMeasurer(as.getIterator(),g2d.getFontRenderContext());
      while (lbm.getPosition() < ns.length()) {
        int next=lbm.nextOffset((float)maxSize);
        String ss=ns.substring(lbm.getPosition(),next);
        lbm.setPosition(next);
        nal.add(ss);
      }
    }
    al=nal;
  }
  final int n=al.size();
  if (n == 1 || n == 0) {
    return null;
  }
  final String[] sa=new String[n];
  for (i=0; i < al.size(); i++) {
    sa[i]=(String)al.get(i);
  }
  return sa;
}
Program: 71379
Project: 71379
Buggy source:
private void cleanUpTriggers(){
  for (Iterator itr=_lhmAllTriggers.values().iterator(); itr.hasNext(); ) {
    List ralist=(List)itr.next();
    if (ralist != null) {
      for (Iterator sitr=ralist.iterator(); sitr.hasNext(); ) {
        RegionAction ra=(RegionAction)sitr.next();
        ra.dispose();
      }
    }
  }
  _lhmAllTriggers.clear();
}

Fixed version (ground truth):
private void cleanUpTriggers(){
  for (Iterator<List<RegionAction>> itr=_lhmAllTriggers.values().iterator(); itr.hasNext(); ) {
    List<RegionAction> ralist=itr.next();
    if (ralist != null) {
      for (Iterator<RegionAction> sitr=ralist.iterator(); sitr.hasNext(); ) {
        RegionAction ra=(RegionAction)sitr.next();
        ra.dispose();
      }
    }
  }
  _lhmAllTriggers.clear();
}