nus-yam/ex-repair huggingface dataset:
Program: 70232
Project: 70232
Buggy source:
protected void readCellField(DataInputStream in,CellDesign cell,short fieldType) throws IOException {
switch (fieldType) {
case FIELD_COLUMN:
    int column=IOUtil.readInt(in);
  cell.setColumn(column);
break;
case FIELD_COL_SPAN:
int colSpan=IOUtil.readInt(in);
cell.setColSpan(colSpan);
break;
case FIELD_ROW_SPAN:
int rowSpan=IOUtil.readInt(in);
cell.setRowSpan(rowSpan);
break;
case FIELD_DROP:
String drop=IOUtil.readString(in);
cell.setDrop(drop);
break;
case FIELD_DISPLAY_GROUP_ICON:
boolean displayGroupIcon=IOUtil.readBool(in);
cell.setDisplayGroupIcon(displayGroupIcon);
break;
case FIELD_DIAGONAL_NUMBER:
int diagonalNumber=IOUtil.readInt(in);
cell.setDiagonalNumber(diagonalNumber);
break;
case FIELD_DIAGONAL_STYLE:
String diagonalStyle=IOUtil.readString(in);
cell.setDiagonalStyle(diagonalStyle);
break;
case FIELD_DIAGONAL_WIDTH:
DimensionType diagonalWidth=readDimension(in);
cell.setDiagonalWidth(diagonalWidth);
break;
case FIELD_ANTIDIAGONAL_NUMBER:
int antidiagonalNumber=IOUtil.readInt(in);
cell.setAntidiagonalNumber(antidiagonalNumber);
break;
case FIELD_ANTIDIAGONAL_STYLE:
String antidiagonalStyle=IOUtil.readString(in);
cell.setAntidiagonalStyle(antidiagonalStyle);
break;
case FIELD_ANTIDIAGONAL_WIDTH:
DimensionType antidiagonalWidth=readDimension(in);
cell.setAntidiagonalWidth(antidiagonalWidth);
break;
default :
readReportItemField(in,cell,fieldType);
}
}

Fixed version (ground truth):
protected void readCellField(DataInputStream in,CellDesign cell,short fieldType) throws IOException {
switch (fieldType) {
case FIELD_COLUMN:
    int column=IOUtil.readInt(in);
  cell.setColumn(column);
break;
case FIELD_COL_SPAN:
int colSpan=IOUtil.readInt(in);
cell.setColSpan(colSpan);
break;
case FIELD_ROW_SPAN:
int rowSpan=IOUtil.readInt(in);
cell.setRowSpan(rowSpan);
break;
case FIELD_DROP:
String drop=IOUtil.readString(in);
cell.setDrop(drop);
break;
case FIELD_DISPLAY_GROUP_ICON:
boolean displayGroupIcon=IOUtil.readBool(in);
cell.setDisplayGroupIcon(displayGroupIcon);
break;
case FIELD_DIAGONAL_NUMBER:
int diagonalNumber=IOUtil.readInt(in);
cell.setDiagonalNumber(diagonalNumber);
break;
case FIELD_DIAGONAL_STYLE:
String diagonalStyle=IOUtil.readString(in);
cell.setDiagonalStyle(diagonalStyle);
break;
case FIELD_DIAGONAL_WIDTH:
DimensionType diagonalWidth=readDimension(in);
cell.setDiagonalWidth(diagonalWidth);
break;
case FIELD_ANTIDIAGONAL_NUMBER:
int antidiagonalNumber=IOUtil.readInt(in);
cell.setAntidiagonalNumber(antidiagonalNumber);
break;
case FIELD_ANTIDIAGONAL_STYLE:
String antidiagonalStyle=IOUtil.readString(in);
cell.setAntidiagonalStyle(antidiagonalStyle);
break;
case FIELD_ANTIDIAGONAL_WIDTH:
DimensionType antidiagonalWidth=readDimension(in);
cell.setAntidiagonalWidth(antidiagonalWidth);
break;
case FIELD_HEADERS:
Expression<String> headers=readStringExpression(in);
cell.setHeaders(headers);
break;
case FIELD_SCOPE:
String scope=IOUtil.readString(in);
cell.setScope(scope);
break;
default :
readReportItemField(in,cell,fieldType);
}
}
Program: 70234
Project: 70234
Buggy source:
private void setupAuralInfomation(CellDesign cell,CellHandle handle){
  String bookmark=validateExpression(handle.getBookmark());
  cell.setBookmark(createExpression(bookmark));
  String headers=handle.getHeaders();
  cell.setHeaders(validateExpression(headers));
  String scope=handle.getScope();
  if (scope != null) {
    cell.setScope(scope);
  }
}

Fixed version (ground truth):
private void setupAuralInfomation(CellDesign cell,CellHandle handle){
  String bookmark=validateExpression(handle.getBookmark());
  cell.setBookmark(createExpression(bookmark));
  String headers=handle.getHeaders();
  cell.setHeaders(createExpression(validateExpression(headers)));
  String scope=handle.getScope();
  if (scope != null) {
    cell.setScope(scope);
  }
}
Program: 70235
Project: 70235
Buggy source:
protected void updateBackgroundImage(){
  BackgroundImageInfo bgi=boxStyle.getBackgroundImage();
  Image img=null;
  if (bgi != null) {
    if ((bgi.getXOffset() != 0 || bgi.getYOffset() != 0)) {
      String imageUrl=bgi.getUrl();
      try {
        img=Image.getInstance(new URL(bgi.getUrl()));
      }
 catch (      Exception e) {
        if (SvgFile.isSvg(imageUrl)) {
          try {
            img=Image.getInstance(SvgFile.transSvgToArray(imageUrl));
          }
 catch (          Exception ex) {
            logger.log(Level.WARNING,ex.getMessage(),ex);
          }
        }
 else {
          logger.log(Level.WARNING,e.getMessage(),e);
        }
      }
      int resolutionX=img.getDpiX();
      int resolutionY=img.getDpiY();
      if (0 == resolutionX || 0 == resolutionY) {
        resolutionX=96;
        resolutionY=96;
      }
      float imageWidth=img.plainWidth() / resolutionX * 72;
      float imageHeight=img.plainHeight() / resolutionY * 72;
      bgi.setXOffset(bgi.getXOffset() * (width - (int)(imageWidth * PDFConstants.LAYOUT_TO_PDF_RATIO)) / 100);
      bgi.setYOffset(bgi.getYOffset() * (height - (int)(imageHeight * PDFConstants.LAYOUT_TO_PDF_RATIO)) / 100);
    }
  }
}

Fixed version (ground truth):
protected void updateBackgroundImage(){
  BackgroundImageInfo bgi=boxStyle.getBackgroundImage();
  Image img=null;
  if (bgi != null) {
    if ((bgi.getXOffset() != 0 || bgi.getYOffset() != 0)) {
      String imageUrl=bgi.getUrl();
      try {
        img=Image.getInstance(new URL(bgi.getUrl()));
      }
 catch (      Exception e) {
        if (SvgFile.isSvg(imageUrl)) {
          try {
            img=Image.getInstance(SvgFile.transSvgToArray(imageUrl));
          }
 catch (          Exception ex) {
            logger.log(Level.WARNING,ex.getMessage(),ex);
          }
        }
 else {
          logger.log(Level.WARNING,e.getMessage(),e);
        }
      }
      if (img != null) {
        int resolutionX=img.getDpiX();
        int resolutionY=img.getDpiY();
        if (0 == resolutionX || 0 == resolutionY) {
          resolutionX=96;
          resolutionY=96;
        }
        float imageWidth=img.plainWidth() / resolutionX * 72;
        float imageHeight=img.plainHeight() / resolutionY * 72;
        bgi.setXOffset(bgi.getXOffset() * (width - (int)(imageWidth * PDFConstants.LAYOUT_TO_PDF_RATIO)) / 100);
        bgi.setYOffset(bgi.getYOffset() * (height - (int)(imageHeight * PDFConstants.LAYOUT_TO_PDF_RATIO)) / 100);
      }
    }
  }
}
Program: 70236
Project: 70236
Buggy source:
protected void checkPageBreak() throws BirtException {
  if (!isInInlineStacking && context.isAutoPageBreak()) {
    int aHeight=getAllocatedHeight();
    while (aHeight + parent.getAbsoluteBP() > context.getMaxBP()) {
      parent.autoPageBreak();
      aHeight=getAllocatedHeight();
    }
  }
}

Fixed version (ground truth):
protected boolean checkPageBreak() throws BirtException {
  boolean ret=false;
  if (!isInInlineStacking && context.isAutoPageBreak()) {
    int aHeight=getAllocatedHeight();
    while (aHeight + parent.getAbsoluteBP() > context.getMaxBP()) {
      parent.autoPageBreak();
      aHeight=getAllocatedHeight();
      ret=true;
    }
  }
  return ret;
}
Program: 70237
Project: 70237
Buggy source:
public void close() throws BirtException {
  getTableArea().addRow(this);
  updateBackgroundImage();
  checkPageBreak();
  parent.update(this);
  finished=true;
}

Fixed version (ground truth):
public void close() throws BirtException {
  TableArea table=getTableArea();
  table.addRow(this);
  updateBackgroundImage();
  boolean pb=checkPageBreak();
  if (pb) {
    table.addRow(this);
  }
  parent.update(this);
  finished=true;
}
Program: 70238
Project: 70238
Buggy source:
public void close() throws BirtException {
  int borderHeight=0;
  if (layout != null) {
    int height=layout.resolveAll();
    if (0 != height) {
      currentBP=currentBP + height;
    }
    borderHeight=layout.resolveBottomBorder();
    layout.remove(this);
  }
  setHeight(currentBP + getOffsetY() + borderHeight);
  updateBackgroundImage();
  if (parent != null) {
    checkPageBreak();
    parent.update(this);
  }
  finished=true;
}

Fixed version (ground truth):
public void close() throws BirtException {
  int borderHeight=0;
  if (layout != null) {
    int height=layout.resolveAll();
    if (0 != height) {
      currentBP=currentBP + height;
    }
    borderHeight=layout.resolveBottomBorder();
    layout.remove(this);
  }
  setHeight(currentBP + getOffsetY() + borderHeight);
  updateBackgroundImage();
  if (parent != null) {
    boolean pb=checkPageBreak();
    if (pb) {
      int height=layout.resolveAll();
      if (0 != height) {
        currentBP=currentBP + height;
      }
      borderHeight=layout.resolveBottomBorder();
      layout.remove(this);
    }
    parent.update(this);
  }
  finished=true;
}
Program: 70239
Project: 70239
Buggy source:
public ILayout createLayout(ContainerArea parent,LayoutContext context,IContent content){
switch (content.getContentType()) {
case IContent.DATA_CONTENT:
case IContent.LABEL_CONTENT:
case IContent.TEXT_CONTENT:
    if (PropertyUtil.isInlineElement(content)) {
      return new InlineTextArea(parent,context,content);
    }
 else {
      return new BlockTextArea(parent,context,content);
    }
case IContent.IMAGE_CONTENT:
  return new ImageAreaLayout(parent,context,(IImageContent)content);
case IContent.AUTOTEXT_CONTENT:
int type=((IAutoTextContent)content).getType();
if (type == IAutoTextContent.TOTAL_PAGE || type == IAutoTextContent.UNFILTERED_TOTAL_PAGE) {
context.addUnresolvedContent(content);
return new TemplateAreaLayout(parent,context,content);
}
 else {
if (PropertyUtil.isInlineElement(content)) {
  return new InlineTextArea(parent,context,content);
}
 else {
  return new BlockTextArea(parent,context,content);
}
}
default :
return null;
}
}

Fixed version (ground truth):
public ILayout createLayout(ContainerArea parent,LayoutContext context,IContent content){
switch (content.getContentType()) {
case IContent.DATA_CONTENT:
case IContent.LABEL_CONTENT:
case IContent.TEXT_CONTENT:
    if (PropertyUtil.isInlineElement(content)) {
      DimensionType width=content.getWidth();
      if (width != null) {
        return new BlockTextArea(parent,context,content);
      }
 else {
        return new InlineTextArea(parent,context,content);
      }
    }
 else {
      return new BlockTextArea(parent,context,content);
    }
case IContent.IMAGE_CONTENT:
  return new ImageAreaLayout(parent,context,(IImageContent)content);
case IContent.AUTOTEXT_CONTENT:
int type=((IAutoTextContent)content).getType();
if (type == IAutoTextContent.TOTAL_PAGE || type == IAutoTextContent.UNFILTERED_TOTAL_PAGE) {
context.addUnresolvedContent(content);
return new TemplateAreaLayout(parent,context,content);
}
 else {
if (PropertyUtil.isInlineElement(content)) {
  return new InlineTextArea(parent,context,content);
}
 else {
  return new BlockTextArea(parent,context,content);
}
}
default :
return null;
}
}
Program: 70240
Project: 70240
Buggy source:
/** 
 * 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 void updateRow(RowArea rowArea,boolean isFixedLayout){
  RowArea lastRow=(RowArea)rows.getCurrent();
  int height=rowArea.getSpecifiedHeight();
  if (!isFixedLayout || height == 0) {
    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);
        rowArea.setCell(dummyCell);
        int delta=dummyCell.getDelta();
        if (dummyCell.getRowSpan() == 1) {
          height=Math.max(height,dummyCell.getCell().getHeight() - delta);
        }
        i=i + upperCell.getColSpan() - 1;
      }
 else {
        CellArea cell=rowArea.getCell(i);
        if (cell != null && cell.getRowSpan() == 1) {
          height=Math.max(height,cell.getHeight());
          i=i + cell.getColSpan() - 1;
        }
      }
    }
  }
  updateRowHeight(rowArea,height,isFixedLayout);
}

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 void updateRow(RowArea rowArea,boolean isFixedLayout){
  RowArea lastRow=(RowArea)rows.getCurrent();
  int height=rowArea.getSpecifiedHeight();
  if (!isFixedLayout || height == 0) {
    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);
        rowArea.setCell(dummyCell);
        int delta=dummyCell.getDelta();
        if (dummyCell.getRowSpan() == 1) {
          height=Math.max(height,dummyCell.getCell().getHeight() - delta);
        }
        i=i + upperCell.getColSpan() - 1;
      }
 else {
        CellArea cell=rowArea.getCell(i);
        if (cell != null && cell.getRowSpan() == 1) {
          height=Math.max(height,cell.getHeight());
          i=i + cell.getColSpan() - 1;
        }
      }
    }
  }
 else {
    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);
        rowArea.setCell(dummyCell);
        i=i + upperCell.getColSpan() - 1;
      }
    }
  }
  updateRowHeight(rowArea,height,isFixedLayout);
}
Program: 70241
Project: 70241
Buggy source:
protected String format(Object oText) throws ChartException {
  DecimalFormat df=null;
  if (fs == null && oText instanceof Number) {
    String sPattern=ValueFormatter.getNumericPattern(((Number)oText).doubleValue());
    df=dfCache.get(sPattern);
  }
  if (oText instanceof Calendar) {
    oText=new CDateTime((Calendar)oText);
  }
 else   if (oText instanceof Date) {
    oText=new CDateTime((Date)oText);
  }
  try {
    return ValueFormatter.format(oText,fs,lgData.rtc.getULocale(),df);
  }
 catch (  ChartException e) {
    return oText.toString();
  }
}

Fixed version (ground truth):
protected String format(Object oText) throws ChartException {
  DecimalFormat df=null;
  if (fs == null && oText instanceof Number) {
    String sPattern=ValueFormatter.getNumericPattern(((Number)oText).doubleValue());
    df=dfCache.get(sPattern);
  }
  try {
    return ValueFormatter.format(oText,fs,lgData.rtc.getULocale(),df);
  }
 catch (  ChartException e) {
    return oText.toString();
  }
}
Program: 70242
Project: 70242
Buggy source:
@Override public String format(Object obj){
  if (obj instanceof Calendar) {
    CDateTime cd=new CDateTime((Calendar)obj);
    return formatCDateTime(cd);
  }
 else   if (obj instanceof Date) {
    CDateTime cd=new CDateTime((Date)obj);
    return formatCDateTime(cd);
  }
 else {
    return super.format(obj);
  }
}

Fixed version (ground truth):
@Override public String format(Object obj){
  if (obj instanceof CDateTime) {
    return formatCDateTime((CDateTime)obj);
  }
 else {
    return super.format(obj);
  }
}
Program: 70244
Project: 70244
Buggy source:
/** 
 * Evaluate data for all expressions, include base series, optional Y series grouping and value series.
 * @param idre
 * @param columns
 * @param areValueSeries
 * @return
 * @since 2.3
 */
public List<Object[]> evaluateRowSet(IDataRowExpressionEvaluator idre,final Object[] columns){
  List<Object[]> liResultSet=new ArrayList<Object[]>();
  final int iColumnCount=columns.length;
  Object[] oaTuple;
  final int MAX_ROW_COUNT=ChartUtil.getSupportedMaxRowCount(rtc);
  if (idre.first()) {
    int count=0;
    do {
      if (MAX_ROW_COUNT > 0 && count++ >= MAX_ROW_COUNT) {
        break;
      }
      oaTuple=new Object[iColumnCount];
      for (int i=0; i < columns.length; i++) {
        oaTuple[i]=idre.evaluate((String)columns[i]);
      }
      liResultSet.add(oaTuple);
    }
 while (idre.next());
  }
  return liResultSet;
}

Fixed version (ground truth):
/** 
 * Evaluate data for all expressions, include base series, optional Y series grouping and value series.
 * @param idre
 * @param columns
 * @param areValueSeries
 * @return
 * @since 2.3
 */
public List<Object[]> evaluateRowSet(IDataRowExpressionEvaluator idre,final Object[] columns){
  List<Object[]> liResultSet=new ArrayList<Object[]>();
  final int iColumnCount=columns.length;
  Object[] oaTuple;
  final int MAX_ROW_COUNT=ChartUtil.getSupportedMaxRowCount(rtc);
  if (idre.first()) {
    int count=0;
    do {
      if (MAX_ROW_COUNT > 0 && count++ >= MAX_ROW_COUNT) {
        break;
      }
      oaTuple=new Object[iColumnCount];
      for (int i=0; i < columns.length; i++) {
        Object value=idre.evaluate((String)columns[i]);
        if (value instanceof Date) {
          value=new CDateTime((Date)value);
        }
 else         if (value instanceof Calendar) {
          value=new CDateTime((Calendar)value);
        }
        oaTuple[i]=value;
      }
      liResultSet.add(oaTuple);
    }
 while (idre.next());
  }
  return liResultSet;
}
Program: 70245
Project: 70245
Buggy source:
/** 
 * Format object into specified data format. 
 * @param obj object will be formated as date time.
 * @param groupingUnitType the grouping unit type. 
 * @return instance of <code>CDateTime</code>.
 * @since 2.3
 */
static CDateTime formatGroupedDateTime(Object obj,GroupingUnitType groupingUnitType){
  int cunit=groupingUnit2CDateUnit(groupingUnitType);
  CDateTime date=null;
  if (obj instanceof CDateTime) {
    date=(CDateTime)obj;
  }
 else   if (obj instanceof Calendar) {
    date=new CDateTime((Calendar)obj);
  }
 else   if (obj instanceof Date) {
    date=new CDateTime((Date)obj);
  }
 else {
    date=new CDateTime(0);
  }
  date.clearBelow(cunit);
  return date;
}

Fixed version (ground truth):
/** 
 * Format object into specified data format. 
 * @param obj object will be formated as date time.
 * @param groupingUnitType the grouping unit type. 
 * @return instance of <code>CDateTime</code>.
 * @since 2.3
 */
static CDateTime formatGroupedDateTime(Object obj,GroupingUnitType groupingUnitType){
  int cunit=groupingUnit2CDateUnit(groupingUnitType);
  CDateTime date=null;
  if (obj instanceof CDateTime) {
    date=(CDateTime)obj;
  }
 else {
    date=new CDateTime(0);
  }
  date.clearBelow(cunit);
  return date;
}
Program: 70247
Project: 70247
Buggy source:
/** 
 * Reset value of grouped column by grouping setting.
 * @param resultSet row data list.
 * @param columnIndex grouped column index.
 * @param seriesGrouping series grouping setting.
 */
private void resetGroupedData(List resultSet,int columnIndex,SeriesGrouping seriesGrouping){
  if (seriesGrouping.getGroupType() == DataType.DATE_TIME_LITERAL) {
    CDateTime baseReference=null;
    for (Iterator iter=resultSet.iterator(); iter.hasNext(); ) {
      Object[] oaTuple=(Object[])iter.next();
      Object obj=oaTuple[columnIndex];
      if (obj instanceof CDateTime) {
        baseReference=(CDateTime)obj;
      }
 else       if (obj instanceof Calendar) {
        baseReference=new CDateTime((Calendar)obj);
      }
 else       if (obj instanceof Date) {
        baseReference=new CDateTime((Date)obj);
      }
 else {
        baseReference=new CDateTime(0);
      }
      oaTuple[columnIndex]=baseReference;
    }
  }
}

Fixed version (ground truth):
/** 
 * Reset value of grouped column by grouping setting.
 * @param resultSet row data list.
 * @param columnIndex grouped column index.
 * @param seriesGrouping series grouping setting.
 */
private void resetGroupedData(List resultSet,int columnIndex,SeriesGrouping seriesGrouping){
  if (seriesGrouping.getGroupType() == DataType.DATE_TIME_LITERAL) {
    CDateTime baseReference=null;
    for (Iterator iter=resultSet.iterator(); iter.hasNext(); ) {
      Object[] oaTuple=(Object[])iter.next();
      Object obj=oaTuple[columnIndex];
      if (obj instanceof CDateTime) {
        baseReference=(CDateTime)obj;
      }
 else {
        baseReference=new CDateTime(0);
      }
      oaTuple[columnIndex]=baseReference;
    }
  }
}
Program: 70249
Project: 70249
Buggy source:
/** 
 * support body auto resize, remove invalid header and footer
 * @param page
 */
protected void updateBodySize(){
  if (header != null && header.getHeight() >= root.getHeight()) {
    removeHeader();
    header=null;
  }
  if (footer != null && footer.getHeight() >= root.getHeight()) {
    removeHeader();
    footer=null;
  }
  if (header != null && footer != null && footer.getHeight() + header.getHeight() >= root.getHeight()) {
    removeHeader();
  }
  body.setHeight(root.getContentHeight() - (header == null ? 0 : header.getHeight()) - (footer == null ? 0 : footer.getHeight()));
  body.setPosition(body.getX(),(header == null ? 0 : header.getHeight()) + root.getBoxStyle().getTopBorderWidth());
  if (footer != null) {
    footer.setPosition(footer.getX(),(header == null ? 0 : header.getHeight()) + root.getBoxStyle().getTopBorderWidth() + (body == null ? 0 : body.getHeight()));
  }
}

Fixed version (ground truth):
/** 
 * support body auto resize, remove invalid header and footer
 * @param page
 */
protected void updateBodySize(){
  if (header != null && header.getHeight() >= root.getHeight()) {
    removeHeader();
    header=null;
  }
  if (footer != null && footer.getHeight() >= root.getHeight()) {
    removeFooter();
    footer=null;
  }
  if (header != null && footer != null && footer.getHeight() + header.getHeight() >= root.getHeight()) {
    removeHeader();
  }
  body.setHeight(root.getContentHeight() - (header == null ? 0 : header.getHeight()) - (footer == null ? 0 : footer.getHeight()));
  body.setPosition(body.getX(),(header == null ? 0 : header.getHeight()) + root.getBoxStyle().getTopBorderWidth());
  if (footer != null) {
    footer.setPosition(footer.getX(),(header == null ? 0 : header.getHeight()) + root.getBoxStyle().getTopBorderWidth() + (body == null ? 0 : body.getHeight()));
  }
}
Program: 70250
Project: 70250
Buggy source:
protected void writeFields(DataOutputStream out) throws IOException {
  super.writeFields(out);
  if (rowSpan != -1) {
    IOUtil.writeShort(out,FIELD_ROW_SPAN);
    IOUtil.writeInt(out,rowSpan);
  }
  if (colSpan != -1) {
    IOUtil.writeShort(out,FIELD_COL_SPAN);
    IOUtil.writeInt(out,colSpan);
  }
  if (column != -1) {
    IOUtil.writeShort(out,FIELD_COLUMN);
    IOUtil.writeInt(out,column);
  }
  if (displayGroupIcon != null) {
    IOUtil.writeShort(out,FIELD_DISPLAY_GROUP_ICON);
    IOUtil.writeBool(out,displayGroupIcon.booleanValue());
  }
  if (drop != null) {
    IOUtil.writeShort(out,FIELD_DROP);
    IOUtil.writeString(out,drop);
  }
  if (headers != null) {
    IOUtil.writeShort(out,FIELD_HEADERS);
    IOUtil.writeString(out,headers);
  }
}

Fixed version (ground truth):
protected void writeFields(DataOutputStream out) throws IOException {
  super.writeFields(out);
  if (rowSpan != -1) {
    IOUtil.writeShort(out,FIELD_ROW_SPAN);
    IOUtil.writeInt(out,rowSpan);
  }
  if (colSpan != -1) {
    IOUtil.writeShort(out,FIELD_COL_SPAN);
    IOUtil.writeInt(out,colSpan);
  }
  if (column != -1) {
    IOUtil.writeShort(out,FIELD_COLUMN);
    IOUtil.writeInt(out,column);
  }
  if (displayGroupIcon != null) {
    IOUtil.writeShort(out,FIELD_DISPLAY_GROUP_ICON);
    IOUtil.writeBool(out,displayGroupIcon.booleanValue());
  }
  if (drop != null) {
    IOUtil.writeShort(out,FIELD_DROP);
    IOUtil.writeString(out,drop);
  }
  if (headers != null) {
    IOUtil.writeShort(out,FIELD_HEADERS);
    IOUtil.writeString(out,headers);
  }
  if (scope != null) {
    IOUtil.writeShort(out,FIELD_SCOPE);
    IOUtil.writeString(out,scope);
  }
}
Program: 70251
Project: 70251
Buggy source:
public boolean needSave(){
  if (rowSpan != -1 || colSpan != -1 || column != -1) {
    return true;
  }
  if (displayGroupIcon != null || headers != null) {
    return true;
  }
  return super.needSave();
}

Fixed version (ground truth):
public boolean needSave(){
  if (rowSpan != -1 || colSpan != -1 || column != -1) {
    return true;
  }
  if (displayGroupIcon != null || headers != null || scope != null) {
    return true;
  }
  return super.needSave();
}
Program: 70252
Project: 70252
Buggy source:
protected void readField(int version,int filedId,DataInputStream in,ClassLoader loader) throws IOException {
switch (filedId) {
case FIELD_ROW_SPAN:
    rowSpan=IOUtil.readInt(in);
  break;
case FIELD_COL_SPAN:
colSpan=IOUtil.readInt(in);
break;
case FIELD_COLUMN:
column=IOUtil.readInt(in);
break;
case FIELD_START_OF_GROUP:
IOUtil.readBool(in);
break;
case FIELD_DISPLAY_GROUP_ICON:
displayGroupIcon=Boolean.valueOf(IOUtil.readBool(in));
break;
case FIELD_DROP:
drop=IOUtil.readString(in);
break;
case FIELD_HEADERS:
headers=IOUtil.readString(in);
break;
default :
super.readField(version,filedId,in,loader);
break;
}
}

Fixed version (ground truth):
protected void readField(int version,int filedId,DataInputStream in,ClassLoader loader) throws IOException {
switch (filedId) {
case FIELD_ROW_SPAN:
    rowSpan=IOUtil.readInt(in);
  break;
case FIELD_COL_SPAN:
colSpan=IOUtil.readInt(in);
break;
case FIELD_COLUMN:
column=IOUtil.readInt(in);
break;
case FIELD_START_OF_GROUP:
IOUtil.readBool(in);
break;
case FIELD_DISPLAY_GROUP_ICON:
displayGroupIcon=Boolean.valueOf(IOUtil.readBool(in));
break;
case FIELD_DROP:
drop=IOUtil.readString(in);
break;
case FIELD_HEADERS:
headers=IOUtil.readString(in);
break;
case FIELD_SCOPE:
scope=IOUtil.readString(in);
break;
default :
super.readField(version,filedId,in,loader);
break;
}
}
Program: 70253
Project: 70253
Buggy source:
public String getScope(){
  if (cellDesign != null) {
    return cellDesign.getScope();
  }
  return null;
}

Fixed version (ground truth):
public String getScope(){
  if (scope != null) {
    return scope;
  }
 else   if (cellDesign != null) {
    return cellDesign.getScope();
  }
  return null;
}
Program: 70254
Project: 70254
Buggy source:
public void startImage(IImageContent image){
  IStyle style=image.getComputedStyle();
  InlineFlag inlineFlag=getInlineFlag(style);
  String uri=image.getURI();
  String mimeType=image.getMIMEType();
  String extension=image.getExtension();
  String altText=image.getAltText();
  if (FlashFile.isFlash(mimeType,uri,extension)) {
    if (altText == null) {
      altText=messageFlashObjectNotSupported;
    }
    wordWriter.drawImage(null,0.0,0.0,null,style,inlineFlag,altText,uri);
    return;
  }
  Image imageInfo=EmitterUtil.parseImage(image,image.getImageSource(),uri,mimeType,extension);
  byte[] data=imageInfo.getData();
  if (data == null || data.length == 0) {
    wordWriter.drawImage(null,0.0,0.0,null,style,inlineFlag,altText,uri);
    return;
  }
  double height=WordUtil.convertImageSize(image.getHeight(),imageInfo.getHeight());
  double width=WordUtil.convertImageSize(image.getWidth(),imageInfo.getWidth());
  writeBookmark(image);
  writeToc(image);
  HyperlinkInfo hyper=getHyperlink(image);
  wordWriter.drawImage(data,height,width,hyper,style,inlineFlag,altText,uri);
}

Fixed version (ground truth):
public void startImage(IImageContent image){
  IStyle style=image.getComputedStyle();
  InlineFlag inlineFlag=getInlineFlag(style);
  String uri=image.getURI();
  String mimeType=image.getMIMEType();
  String extension=image.getExtension();
  String altText=image.getAltText();
  context.addContainer(false);
  if (FlashFile.isFlash(mimeType,uri,extension)) {
    if (altText == null) {
      altText=messageFlashObjectNotSupported;
    }
    wordWriter.drawImage(null,0.0,0.0,null,style,inlineFlag,altText,uri);
    return;
  }
  Image imageInfo=EmitterUtil.parseImage(image,image.getImageSource(),uri,mimeType,extension);
  byte[] data=imageInfo.getData();
  if (data == null || data.length == 0) {
    wordWriter.drawImage(null,0.0,0.0,null,style,inlineFlag,altText,uri);
    return;
  }
  double height=WordUtil.convertImageSize(image.getHeight(),imageInfo.getHeight());
  double width=WordUtil.convertImageSize(image.getWidth(),imageInfo.getWidth());
  writeBookmark(image);
  writeToc(image);
  HyperlinkInfo hyper=getHyperlink(image);
  wordWriter.drawImage(data,height,width,hyper,style,inlineFlag,altText,uri);
}
Program: 70255
Project: 70255
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=getPreviewData();
        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(){
      ColumnBindingInfo[] headers=null;
      List<?> dataList=null;
      try {
        headers=getDataServiceProvider().getPreviewHeadersInfo();
        dataList=getPreviewData();
        final ColumnBindingInfo[] headerInfo=headers;
        final List<?> data=dataList;
        Display.getDefault().syncExec(new Runnable(){
          public void run(){
            updateTablePreview(headerInfo,data);
            if (errorMsg != null && errorMsg.equals(WizardBase.getErrors())) {
              WizardBase.removeException();
            }
          }
        }
);
      }
 catch (      Exception e) {
        final ColumnBindingInfo[] headerInfo=headers;
        final List<?> data=dataList;
        errorMsg=e.getMessage();
        Display.getDefault().syncExec(new Runnable(){
          public void run(){
            updateTablePreview(headerInfo,data);
            WizardBase.showException(errorMsg);
          }
        }
);
      }
    }
  }
;
  new Thread(runnable).start();
}
Program: 70256
Project: 70256
Buggy source:
/** 
 */
private void refreshColumnsListView(){
  if (dataProvider.getDataSetFromHandle() == null) {
    return;
  }
  if (isCubeMode()) {
    return;
  }
  Runnable runnable=new Runnable(){
    public void run(){
      ColumnBindingInfo[] headers=null;
      List<?> dataList=null;
      try {
        headers=getDataServiceProvider().getPreviewHeadersInfo();
        if (dataProvider.isLivePreviewEnabled()) {
          dataList=getPreviewData();
        }
        final ColumnBindingInfo[] headerInfo=headers;
        final List<?> data=dataList;
        Display.getDefault().syncExec(new Runnable(){
          public void run(){
            updateColumnsTableViewer(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(){
            updateColumnsTableViewer(headerInfo,data);
            WizardBase.showException(msg);
          }
        }
);
      }
    }
  }
;
  new Thread(runnable).start();
}

Fixed version (ground truth):
/** 
 */
private void refreshColumnsListView(){
  if (dataProvider.getDataSetFromHandle() == null) {
    return;
  }
  if (isCubeMode()) {
    return;
  }
  Runnable runnable=new Runnable(){
    public void run(){
      ColumnBindingInfo[] headers=null;
      List<?> dataList=null;
      try {
        headers=getDataServiceProvider().getPreviewHeadersInfo();
        if (dataProvider.isLivePreviewEnabled()) {
          dataList=getPreviewData();
        }
        final ColumnBindingInfo[] headerInfo=headers;
        final List<?> data=dataList;
        Display.getDefault().syncExec(new Runnable(){
          public void run(){
            updateColumnsTableViewer(headerInfo,data);
            if (errorMsg != null && errorMsg.equals(WizardBase.getErrors())) {
              WizardBase.removeException();
            }
          }
        }
);
      }
 catch (      Exception e) {
        final ColumnBindingInfo[] headerInfo=headers;
        final List<?> data=dataList;
        errorMsg=e.getMessage();
        Display.getDefault().syncExec(new Runnable(){
          public void run(){
            updateColumnsTableViewer(headerInfo,data);
            WizardBase.showException(errorMsg);
          }
        }
);
      }
    }
  }
;
  new Thread(runnable).start();
}
Program: 70257
Project: 70257
Buggy source:
/** 
 * Sets initial width to new object
 * @param object new object
 */
public static void setInitWidth(Object object){
  int percentAll=100;
  try {
    if (object instanceof TableHandle) {
      TableHandle table=(TableHandle)object;
      table.setWidth(percentAll + DesignChoiceConstants.UNITS_PERCENTAGE);
    }
 else     if (object instanceof GridHandle) {
      GridHandle grid=(GridHandle)object;
      grid.setWidth(percentAll + DesignChoiceConstants.UNITS_PERCENTAGE);
    }
 else     return;
  }
 catch (  SemanticException e) {
    ExceptionHandler.handle(e);
  }
}

Fixed version (ground truth):
/** 
 * Sets initial width to new object
 * @param object new object
 */
public static void setInitWidth(Object object){
}
Program: 70259
Project: 70259
Buggy source:
/** 
 * Returns the defined width in model in Pixel.
 * @return
 */
public String getDefinedWidth(){
  DimensionHandle handle=((ExtendedItemHandle)getAdapter(DesignElementHandle.class)).getWidth();
  if (handle.getUnits() == null || handle.getUnits().length() == 0) {
    return DEFAULT_WIDTH;
  }
 else   if (DesignChoiceConstants.UNITS_PERCENTAGE.equals(handle.getUnits())) {
    return handle.getMeasure() + DesignChoiceConstants.UNITS_PERCENTAGE;
  }
 else {
    int px=(int)DEUtil.convertoToPixel(handle);
    if (px <= 0) {
      return null;
    }
    return String.valueOf(px);
  }
}

Fixed version (ground truth):
/** 
 * Returns the defined width in model in Pixel.
 * @return
 */
public String getDefinedWidth(){
  return DEFAULT_WIDTH;
}
Program: 70261
Project: 70261
Buggy source:
public void testRerenderTask() throws Exception {
  IReportRunnable report=engine.openReportDesign(REPORT_DESIGN);
  IRunTask runTask=engine.createRunTask(report);
  runTask.run(REPORT_DOCUMENT);
  runTask.close();
  IReportDocument reportDoc=engine.openReportDocument(REPORT_DOCUMENT);
  IReportRunnable pRunnable=reportDoc.getPreparedRunnable();
  IRenderTask task=engine.createRenderTask(reportDoc,pRunnable);
  IRenderOption option=new HTMLRenderOption();
  ByteArrayOutputStream out=new ByteArrayOutputStream();
  option.setOutputStream(out);
  task.setRenderOption(option);
  task.render();
  String outputString=out.toString();
  assertTrue(outputString.indexOf("String_Node_Str") > 0);
  task.close();
  IReportRunnable bRunnable=reportDoc.getReportRunnable();
  task=engine.createRenderTask(reportDoc,bRunnable);
  out=new ByteArrayOutputStream();
  option.setOutputStream(out);
  task.setRenderOption(option);
  task.render();
  outputString=out.toString();
  assertTrue(outputString.indexOf("String_Node_Str") > 0);
  task.close();
  reportDoc.close();
}

Fixed version (ground truth):
public void testRerenderTask() throws Exception {
  IReportRunnable report=engine.openReportDesign(REPORT_DESIGN);
  IRunTask runTask=engine.createRunTask(report);
  runTask.run(REPORT_DOCUMENT);
  runTask.close();
  IReportDocument reportDoc=engine.openReportDocument(REPORT_DOCUMENT);
  IReportRunnable pRunnable=reportDoc.getPreparedRunnable();
  IRenderTask task=engine.createRenderTask(reportDoc,pRunnable);
  IRenderOption option=new HTMLRenderOption();
  ByteArrayOutputStream out=new ByteArrayOutputStream();
  option.setOutputStream(out);
  task.setRenderOption(option);
  task.render();
  String outputString=out.toString();
  assertTrue(outputString.indexOf("String_Node_Str") > 0);
  task.close();
  reportDoc.close();
}
Program: 70264
Project: 70264
Buggy source:
protected void drawBackgroundImage(float x,float y,float width,float height,int repeat,String imageUrl,float absPosX,float absPosY) throws IOException {
  writer.drawBackgroundImage(imageUrl,x,y,width,height,absPosX,absPosY,repeat);
}

Fixed version (ground truth):
protected void drawBackgroundImage(float x,float y,float width,float height,float imageWidth,float imageHeight,int repeat,String imageUrl,float absPosX,float absPosY) throws IOException {
  writer.drawBackgroundImage(imageUrl,x,y,width,height,imageWidth,imageHeight,absPosX,absPosY,repeat);
}
Program: 70266
Project: 70266
Buggy source:
protected void drawBackgroundImage(float x,float y,float width,float height,int repeat,String imageUrl,float absPosX,float absPosY) throws IOException {
  writer.drawBackgroundImage(imageUrl,x,y,width,height,absPosX,absPosY,repeat);
}

Fixed version (ground truth):
protected void drawBackgroundImage(float x,float y,float width,float height,float imageWidth,float imageHeight,int repeat,String imageUrl,float absPosX,float absPosY) throws IOException {
  writer.drawBackgroundImage(imageUrl,x,y,width,height,imageWidth,imageHeight,absPosX,absPosY,repeat);
}
Program: 70267
Project: 70267
Buggy source:
public static DimensionType parserUnit(String value,String defaultUnits){
  if (value != null) {
    try {
      DimensionValue val=DimensionValue.parse(value);
      String units=val.getUnits();
      if (null == units || "String_Node_Str".equals(units)) {
        units=defaultUnits;
      }
      return new DimensionType(val.getMeasure(),units);
    }
 catch (    PropertyValueException e) {
      log.log(Level.SEVERE,e.getMessage());
    }
  }
  return new DimensionType(0,DimensionType.UNITS_CM);
}

Fixed version (ground truth):
public static DimensionType parserUnit(String value,String defaultUnits){
  if (value != null) {
    try {
      DimensionValue val=DimensionValue.parse(value);
      String units=val.getUnits();
      if (null == units || "String_Node_Str".equals(units)) {
        units=defaultUnits;
      }
      return new DimensionType(val.getMeasure(),units);
    }
 catch (    PropertyValueException e) {
      log.log(Level.SEVERE,e.getMessage());
    }
  }
  return null;
}
Program: 70268
Project: 70268
Buggy source:
protected abstract void drawBackgroundImage(float x,float y,float width,float height,int repeat,String imageUrl,float absPosX,float absPosY) throws IOException ;

Fixed version (ground truth):
protected abstract void drawBackgroundImage(float x,float y,float width,float height,float imageWidth,float imageHeight,int repeat,String imageUrl,float absPosX,float absPosY) throws IOException ;
Program: 70269
Project: 70269
Buggy source:
void drawBackgroundImage(int x,int y,int width,int height,int repeat,String imageUrl,int absPosX,int absPosY) throws IOException ;

Fixed version (ground truth):
void drawBackgroundImage(int x,int y,int width,int height,int imageWidth,int imageHeight,int repeat,String imageUrl,int absPosX,int absPosY) throws IOException ;
Program: 70270
Project: 70270
Buggy source:
/** 
 * draw background image for the container
 * @param containerStyle the style of the container we draw background image for
 * @param imageUrl the url of background image 
 * @param startX the absolute horizontal position of the container
 * @param startY the absolute vertical position of the container
 * @param width container width
 * @param height container height
 */
private void drawBackgroundImage(BackgroundImageInfo bi,int startX,int startY,int width,int height){
  try {
    pageGraphic.drawBackgroundImage(startX,startY,width,height,bi.getRepeatedMode(),bi.getUrl(),getScaledValue(bi.getXOffset()),getScaledValue(bi.getYOffset()));
  }
 catch (  IOException e) {
    log(e,Level.WARNING);
  }
}

Fixed version (ground truth):
/** 
 * draw background image for the container
 * @param containerStyle the style of the container we draw background image for
 * @param imageUrl the url of background image 
 * @param startX the absolute horizontal position of the container
 * @param startY the absolute vertical position of the container
 * @param width container width
 * @param height container height
 */
private void drawBackgroundImage(BackgroundImageInfo bi,int startX,int startY,int width,int height){
  try {
    pageGraphic.drawBackgroundImage(startX,startY,width,height,bi.getWidth(),bi.getHeight(),bi.getRepeatedMode(),bi.getUrl(),getScaledValue(bi.getXOffset()),getScaledValue(bi.getYOffset()));
  }
 catch (  IOException e) {
    log(e,Level.WARNING);
  }
}
Program: 70272
Project: 70272
Buggy source:
protected void buildLogicContainerProperties(IContent content,LayoutContext context){
  IStyle style=content.getStyle();
  if (style != null && !style.isEmpty()) {
    boxStyle=new BoxStyle();
    IStyle cs=content.getComputedStyle();
    Color color=PropertyUtil.getColor(cs.getProperty(IStyle.STYLE_BACKGROUND_COLOR));
    if (color != null) {
      boxStyle.setBackgroundColor(color);
    }
    String url=style.getBackgroundImage();
    if (url != null) {
      boxStyle.setBackgroundImage(new BackgroundImageInfo(getImageUrl(url),cs.getProperty(IStyle.STYLE_BACKGROUND_REPEAT),getDimensionValue(cs.getProperty(IStyle.STYLE_BACKGROUND_POSITION_X),100),getDimensionValue(cs.getProperty(IStyle.STYLE_BACKGROUND_POSITION_Y),100)));
    }
    if (!isInInlineStacking) {
      pageBreakAfter=cs.getProperty(IStyle.STYLE_PAGE_BREAK_AFTER);
      pageBreakInside=cs.getProperty(IStyle.STYLE_PAGE_BREAK_INSIDE);
      pageBreakBefore=cs.getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE);
    }
  }
 else {
    hasStyle=false;
    boxStyle=BoxStyle.DEFAULT;
    localProperties=LocalProperties.DEFAULT;
  }
  bookmark=content.getBookmark();
  action=content.getHyperlinkAction();
}

Fixed version (ground truth):
protected void buildLogicContainerProperties(IContent content,LayoutContext context){
  IStyle style=content.getStyle();
  if (style != null && !style.isEmpty()) {
    boxStyle=new BoxStyle();
    IStyle cs=content.getComputedStyle();
    Color color=PropertyUtil.getColor(cs.getProperty(IStyle.STYLE_BACKGROUND_COLOR));
    if (color != null) {
      boxStyle.setBackgroundColor(color);
    }
    String url=style.getBackgroundImage();
    if (url != null) {
      boxStyle.setBackgroundImage(new BackgroundImageInfo(getImageUrl(url),cs.getProperty(IStyle.STYLE_BACKGROUND_REPEAT),getDimensionValue(cs.getProperty(IStyle.STYLE_BACKGROUND_POSITION_X),100),getDimensionValue(cs.getProperty(IStyle.STYLE_BACKGROUND_POSITION_Y),100),0,0));
    }
    if (!isInInlineStacking) {
      pageBreakAfter=cs.getProperty(IStyle.STYLE_PAGE_BREAK_AFTER);
      pageBreakInside=cs.getProperty(IStyle.STYLE_PAGE_BREAK_INSIDE);
      pageBreakBefore=cs.getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE);
    }
  }
 else {
    hasStyle=false;
    boxStyle=BoxStyle.DEFAULT;
    localProperties=LocalProperties.DEFAULT;
  }
  bookmark=content.getBookmark();
  action=content.getHyperlinkAction();
}
Program: 70275
Project: 70275
Buggy source:
/** 
 * return the extra value text, if it exists and is visible
 * @param cm
 * @param se
 * @return Value Text
 * @throws ChartException
 */
private static String getValueText(Chart cm,Series se) throws ChartException {
  String strValueText=null;
  if (cm.getLegend().isShowValue()) {
    DataSetIterator dsiBase=createDataSetIterator(se,cm);
    if (dsiBase.hasNext()) {
      Object obj=dsiBase.next();
      while (!isValidValue(obj) && dsiBase.hasNext()) {
        obj=dsiBase.next();
      }
      strValueText=String.valueOf(obj);
    }
  }
  return strValueText;
}

Fixed version (ground truth):
/** 
 * return the extra value text, if it exists and is visible
 * @param cm
 * @param se
 * @return Value Text
 * @throws ChartException
 */
private static String getValueText(Chart cm,Series se) throws ChartException {
  String strValueText=null;
  if (cm.getLegend().isShowValue()) {
    DataSetIterator dsiBase=createDataSetIterator(se,cm);
    if (dsiBase.hasNext()) {
      Object obj=dsiBase.next();
      while (!isValidValue(obj) && dsiBase.hasNext()) {
        obj=dsiBase.next();
      }
      try {
        strValueText=ValueFormatter.format(obj,null,ULocale.getDefault(),null);
      }
 catch (      ChartException ex) {
        strValueText=String.valueOf(obj);
      }
    }
  }
  return strValueText;
}
Program: 70277
Project: 70277
Buggy source:
/** 
 * return the extra value text, if it exists and is visible
 * @param cm
 * @param se
 * @return Value Text
 * @throws ChartException
 */
private static String getValueText(Chart cm,Series se,RunTimeContext rtc) throws ChartException {
  String strValueText=null;
  if (cm.getLegend().isShowValue()) {
    DataSetIterator dsiBase=createDataSetIterator(se,cm);
    if (dsiBase.hasNext()) {
      Object obj=dsiBase.next();
      while (!isValidValue(obj) && dsiBase.hasNext()) {
        obj=dsiBase.next();
      }
      try {
        strValueText=ValueFormatter.format(obj,null,rtc.getULocale(),null);
      }
 catch (      ChartException ex) {
        strValueText=String.valueOf(obj);
      }
    }
  }
  return strValueText;
}

Fixed version (ground truth):
/** 
 * return the extra value text, if it exists and is visible
 * @param cm
 * @param se
 * @return Value Text
 * @throws ChartException
 */
private String getValueText(Series se) throws ChartException {
  String strValueText=null;
  if (lgData.cm.getLegend().isShowValue()) {
    DataSetIterator dsiBase=createDataSetIterator(se,lgData.cm);
    if (dsiBase.hasNext()) {
      Object obj=dsiBase.next();
      while (!isValidValue(obj) && dsiBase.hasNext()) {
        obj=dsiBase.next();
      }
      try {
        strValueText=ValueFormatter.format(obj,null,lgData.rtc.getULocale(),null);
      }
 catch (      ChartException ex) {
        strValueText=String.valueOf(obj);
      }
    }
  }
  return strValueText;
}
Program: 70278
Project: 70278
Buggy source:
protected ContentProvider(LegendData lgData){
  this.lgData=lgData;
  this.bNeedInvert=needInvert(lgData.bPaletteByCategory,lgData.cm,lgData.seda);
}

Fixed version (ground truth):
protected ContentProvider(LegendData lgData){
  this.lgData=lgData;
  this.bNeedInvert=needInvert(lgData.bPaletteByCategory,lgData.cm,lgData.seda);
  this.dfCache=new ChartUtil.CacheDecimalFormat(lgData.rtc.getULocale());
}
Program: 70279
Project: 70279
Buggy source:
private LegendItemHints visitSeries() throws ChartException {
  if (itSeries.hasNext()) {
    Series se=itSeries.next();
    String sItem=formatItemText(se.getSeriesIdentifier());
    String sValue=bShowValue ? getValueText(lgData.cm,se,lgData.rtc) : null;
    return LegendItemHints.newEntry(sItem,sValue,sed,se,itSeries.getIndex());
  }
 else {
    this.status=Status.WAIT_SD;
    if (bSeparator && alSeries.size() > 0 && itSed.hasNext()) {
      return LegendItemHints.createSeperator();
    }
 else {
      return visitSed();
    }
  }
}

Fixed version (ground truth):
private LegendItemHints visitSeries() throws ChartException {
  if (itSeries.hasNext()) {
    Series se=itSeries.next();
    String sItem=formatItemText(se.getSeriesIdentifier());
    String sValue=bShowValue ? getValueText(se) : null;
    return LegendItemHints.newEntry(sItem,sValue,sed,se,itSeries.getIndex());
  }
 else {
    this.status=Status.WAIT_SD;
    if (bSeparator && alSeries.size() > 0 && itSed.hasNext()) {
      return LegendItemHints.createSeperator();
    }
 else {
      return visitSed();
    }
  }
}