nus-yam/ex-repair huggingface dataset:
Program: 76080
Project: 76080
Buggy source:
private FactTableRow createRow(int iValue){
  final int dimensionLen=3;
  final int measureLen=3;
  FactTableRow factTableRow=new FactTableRow();
  factTableRow.dimensionKeys=new DimensionKey[dimensionLen];
  for (int i=0; i < dimensionLen; i++) {
    factTableRow.dimensionKeys[i]=new DimensionKey(i);
    for (int j=0; j < i; j++) {
      factTableRow.dimensionKeys[i].keyValues[j]=new Integer(iValue + j);
    }
  }
  factTableRow.measures=new Object[measureLen];
  for (int i=0; i < measureLen; i++) {
    factTableRow.measures[i]=new Integer(iValue + i);
  }
  return factTableRow;
}

Fixed version (ground truth):
private FactTableRow createRow(int iValue){
  final int dimensionLen=3;
  final int measureLen=3;
  FactTableRow factTableRow=new FactTableRow();
  factTableRow.setDimensionKeys(new DimensionKey[dimensionLen]);
  for (int i=0; i < dimensionLen; i++) {
    factTableRow.getDimensionKeys()[i]=new DimensionKey(i);
    for (int j=0; j < i; j++) {
      factTableRow.getDimensionKeys()[i].getKeyValues()[j]=new Integer(iValue + j);
    }
  }
  factTableRow.setMeasures(new Object[measureLen]);
  for (int i=0; i < measureLen; i++) {
    factTableRow.getMeasures()[i]=new Integer(iValue + i);
  }
  return factTableRow;
}
Program: 76081
Project: 76081
Buggy source:
private FactTableRow createRow2(int iValue){
  final int dimensionLen=3;
  final int measureLen=3;
  FactTableRow factTableRow=new FactTableRow();
  factTableRow.dimensionKeys=new DimensionKey[dimensionLen];
  for (int i=0; i < dimensionLen; i++) {
    factTableRow.dimensionKeys[i]=new DimensionKey(i);
    for (int j=0; j < i; j++) {
      if (j != 1)       factTableRow.dimensionKeys[i].keyValues[j]=new Integer(iValue + j);
    }
  }
  factTableRow.measures=new Object[measureLen];
  for (int i=0; i < measureLen; i++) {
    factTableRow.measures[i]=new Integer(iValue + i);
  }
  return factTableRow;
}

Fixed version (ground truth):
private FactTableRow createRow2(int iValue){
  final int dimensionLen=3;
  final int measureLen=3;
  FactTableRow factTableRow=new FactTableRow();
  factTableRow.setDimensionKeys(new DimensionKey[dimensionLen]);
  for (int i=0; i < dimensionLen; i++) {
    factTableRow.getDimensionKeys()[i]=new DimensionKey(i);
    for (int j=0; j < i; j++) {
      if (j != 1)       factTableRow.getDimensionKeys()[i].getKeyValues()[j]=new Integer(iValue + j);
    }
  }
  factTableRow.setMeasures(new Object[measureLen]);
  for (int i=0; i < measureLen; i++) {
    factTableRow.getMeasures()[i]=new Integer(iValue + i);
  }
  return factTableRow;
}
Program: 76082
Project: 76082
Buggy source:
/** 
 * @param dimRow
 * @return
 */
private static Object[] getAllFields(DimensionRow dimRow){
  List fields=new ArrayList();
  for (int i=0; i < dimRow.members.length; i++) {
    if (dimRow.members[i].keyValues != null) {
      for (int j=0; j < dimRow.members[i].keyValues.length; j++) {
        fields.add(dimRow.members[i].keyValues[j]);
      }
    }
    if (dimRow.members[i].attributes != null) {
      for (int j=0; j < dimRow.members[i].attributes.length; j++) {
        fields.add(dimRow.members[i].attributes[j]);
      }
    }
  }
  return fields.toArray();
}

Fixed version (ground truth):
/** 
 * @param dimRow
 * @return
 */
private static Object[] getAllFields(DimensionRow dimRow){
  List fields=new ArrayList();
  for (int i=0; i < dimRow.getMembers().length; i++) {
    if (dimRow.getMembers()[i].getKeyValues() != null) {
      for (int j=0; j < dimRow.getMembers()[i].getKeyValues().length; j++) {
        fields.add(dimRow.getMembers()[i].getKeyValues()[j]);
      }
    }
    if (dimRow.getMembers()[i].getAttributes() != null) {
      for (int j=0; j < dimRow.getMembers()[i].getAttributes().length; j++) {
        fields.add(dimRow.getMembers()[i].getAttributes()[j]);
      }
    }
  }
  return fields.toArray();
}
Program: 76085
Project: 76085
Buggy source:
/** 
 * Build the style of foreign content.
 */
public void buildForeignStyle(IForeignContent foreign,StringBuffer styleBuffer,int display,String url){
  IStyle style=foreign.getStyle();
  handleShrink(display,style,foreign.getHeight(),foreign.getWidth(),styleBuffer);
  if (url != null) {
    setDisplayProperty(display,HTMLEmitterUtil.DISPLAY_BLOCK | HTMLEmitterUtil.DISPLAY_INLINE_BLOCK,styleBuffer);
    AttributeBuilder.checkHyperlinkTextDecoration(style,styleBuffer);
  }
 else {
    setDisplayProperty(display,HTMLEmitterUtil.DISPLAY_INLINE_BLOCK,styleBuffer);
  }
  String textAlign=foreign.getComputedStyle().getTextAlign();
  if (textAlign != null) {
    styleBuffer.append("String_Node_Str");
    styleBuffer.append(textAlign);
    styleBuffer.append("String_Node_Str");
  }
  buildStyle(foreign,styleBuffer);
}

Fixed version (ground truth):
/** 
 * Build the style of foreign content.
 */
public void buildForeignStyle(IForeignContent foreign,StringBuffer styleBuffer,int display,String url){
  IStyle style=foreign.getStyle();
  handleShrink(display,style,foreign.getHeight(),foreign.getWidth(),styleBuffer);
  if (url != null) {
    setDisplayProperty(display,HTMLEmitterUtil.DISPLAY_BLOCK | HTMLEmitterUtil.DISPLAY_INLINE_BLOCK,styleBuffer);
    AttributeBuilder.checkHyperlinkTextDecoration(style,styleBuffer);
  }
 else {
    setDisplayProperty(display,HTMLEmitterUtil.DISPLAY_INLINE_BLOCK,styleBuffer);
  }
  String textAlign=foreign.getComputedStyle().getTextAlign();
  if (textAlign != null) {
    styleBuffer.append("String_Node_Str");
    styleBuffer.append(textAlign);
    styleBuffer.append("String_Node_Str");
  }
  buildStyle(foreign,styleBuffer);
  if (!isEmbeddable) {
    AttributeBuilder.checkHyperlinkTextDecoration(style,styleBuffer);
  }
}
Program: 76086
Project: 76086
Buggy source:
/** 
 * Build the style of text content.
 */
public void buildTextStyle(ITextContent text,StringBuffer styleBuffer,int display,String url){
  IStyle style=text.getStyle();
  handleShrink(display,style,text.getHeight(),text.getWidth(),styleBuffer);
  if (url != null) {
    setDisplayProperty(display,HTMLEmitterUtil.DISPLAY_BLOCK | HTMLEmitterUtil.DISPLAY_INLINE_BLOCK,styleBuffer);
    AttributeBuilder.checkHyperlinkTextDecoration(style,styleBuffer);
  }
 else {
    setDisplayProperty(display,HTMLEmitterUtil.DISPLAY_INLINE_BLOCK,styleBuffer);
  }
  String textAlign=text.getComputedStyle().getTextAlign();
  if (textAlign != null) {
    styleBuffer.append("String_Node_Str");
    styleBuffer.append(textAlign);
    styleBuffer.append("String_Node_Str");
  }
  buildStyle(text,styleBuffer);
}

Fixed version (ground truth):
/** 
 * Build the style of text content.
 */
public void buildTextStyle(ITextContent text,StringBuffer styleBuffer,int display,String url){
  IStyle style=text.getStyle();
  handleShrink(display,style,text.getHeight(),text.getWidth(),styleBuffer);
  if (url != null) {
    setDisplayProperty(display,HTMLEmitterUtil.DISPLAY_BLOCK | HTMLEmitterUtil.DISPLAY_INLINE_BLOCK,styleBuffer);
    AttributeBuilder.checkHyperlinkTextDecoration(style,styleBuffer);
  }
 else {
    setDisplayProperty(display,HTMLEmitterUtil.DISPLAY_INLINE_BLOCK,styleBuffer);
  }
  String textAlign=text.getComputedStyle().getTextAlign();
  if (textAlign != null) {
    styleBuffer.append("String_Node_Str");
    styleBuffer.append(textAlign);
    styleBuffer.append("String_Node_Str");
  }
  buildStyle(text,styleBuffer);
  if (!isEmbeddable) {
    AttributeBuilder.checkHyperlinkTextDecoration(style,styleBuffer);
  }
}
Program: 76088
Project: 76088
Buggy source:
/** 
 * Convert parameter to Object
 * @param dataType
 * @param format
 * @param value
 * @param locale
 * @param isLocale indicate whether it is a locale string
 * @return Object
 * @throws ValidationValueException
 */
public static Object validate(String dataType,String format,String value,Locale locale,boolean isLocale) throws ValidationValueException {
  Object obj=null;
  if (value == null)   return obj;
  String defFormat=null;
  if (DesignChoiceConstants.PARAM_TYPE_DATETIME.equalsIgnoreCase(dataType)) {
    defFormat=ParameterValidationUtil.DEFAULT_DATETIME_FORMAT;
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_DATE.equalsIgnoreCase(dataType)) {
    defFormat=ParameterValidationUtil.DEFAULT_DATE_FORMAT;
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_TIME.equalsIgnoreCase(dataType)) {
    defFormat=ParameterValidationUtil.DEFAULT_TIME_FORMAT;
  }
  if (isLocale) {
    try {
      if (format == null) {
        if (DesignChoiceConstants.PARAM_TYPE_DATE.equalsIgnoreCase(dataType)) {
          format=ParameterValidationUtil.DISPLAY_DATE_FORMAT;
        }
 else         if (DesignChoiceConstants.PARAM_TYPE_TIME.equalsIgnoreCase(dataType)) {
          format=ParameterValidationUtil.DISPLAY_TIME_FORMAT;
        }
 else         if (DesignChoiceConstants.PARAM_TYPE_DATETIME.equalsIgnoreCase(dataType)) {
          format=DesignChoiceConstants.DATETIEM_FORMAT_TYPE_UNFORMATTED;
        }
      }
      obj=ParameterValidationUtil.validate(dataType,format,value,locale);
    }
 catch (    Exception e) {
      obj=ParameterValidationUtil.validate(dataType,defFormat,value);
    }
  }
 else {
    if (format == null)     format=defFormat;
    obj=ParameterValidationUtil.validate(dataType,format,value);
  }
  return obj;
}

Fixed version (ground truth):
/** 
 * Convert parameter to Object
 * @param dataType
 * @param format
 * @param value
 * @param locale
 * @param isLocale indicate whether it is a locale string
 * @return Object
 * @throws ValidationValueException
 */
public static Object validate(String dataType,String format,String value,Locale locale,boolean isLocale) throws ValidationValueException {
  Object obj=null;
  if (value == null)   return obj;
  if (isLocale) {
    validateWithLocale(dataType,format,value,locale);
  }
 else {
    obj=ParameterValidationUtil.validate(dataType,getDefaultDateFormat(dataType),value);
  }
  return obj;
}
Program: 76089
Project: 76089
Buggy source:
private void resolveBorder(BorderStyleInfo[] styles,BorderStyleInfo usedStyle){
  CSSValue[] borderStyles=new CSSValue[styles.length];
  for (int i=0; i < styles.length; i++) {
    borderStyles[i]=styles[i].getBorderStyle();
    if (IStyle.HIDDEN_VALUE.equals(borderStyles[i])) {
      usedStyle.setBorderStyle(IStyle.HIDDEN_VALUE);
      return;
    }
  }
  int maxWidth=0;
  int maxCount=1;
  int maxFirstIndex=0;
  int[] ws=new int[styles.length];
  CSSValue[] borderWidths=new CSSValue[styles.length];
  for (int i=0; i < styles.length; i++) {
    borderWidths[i]=styles[i].getBorderWidth();
    ws[i]=PropertyUtil.getDimensionValue(styles[i].getBorderWidth());
    if (ws[i] > maxWidth) {
      maxWidth=ws[i];
      maxCount=1;
      maxFirstIndex=i;
    }
 else     if (ws[i] == maxWidth) {
      maxCount++;
    }
  }
  if (maxCount == 1) {
    usedStyle.setBorder(borderStyles[maxFirstIndex],borderWidths[maxFirstIndex],styles[maxFirstIndex].getBorderColor());
    return;
  }
 else {
    int max=0;
    int maxStyleIndex=0;
    int[] ss=new int[styles.length];
    for (int i=0; i < styles.length; i++) {
      if (ws[i] == maxWidth) {
        ss[i]=((Integer)styleMap.get(styles[i].getBorderStyle())).intValue();
        if (ss[i] > max) {
          max=ss[i];
          maxStyleIndex=i;
        }
      }
    }
    usedStyle.setBorder(borderStyles[maxStyleIndex],borderWidths[maxStyleIndex],styles[maxStyleIndex].getBorderColor());
  }
}

Fixed version (ground truth):
private void resolveBorder(BorderStyleInfo[] styles,BorderStyleInfo usedStyle){
  CSSValue[] borderStyles=new CSSValue[styles.length];
  for (int i=0; i < styles.length; i++) {
    borderStyles[i]=styles[i].getBorderStyle();
    if (IStyle.HIDDEN_VALUE.equals(borderStyles[i])) {
      usedStyle.setBorderStyle(IStyle.HIDDEN_VALUE);
      return;
    }
  }
  int maxWidth=0;
  int maxCount=1;
  int maxFirstIndex=0;
  int[] ws=new int[styles.length];
  CSSValue[] borderWidths=new CSSValue[styles.length];
  for (int i=0; i < styles.length; i++) {
    borderWidths[i]=styles[i].getBorderWidth();
    ws[i]=PropertyUtil.getDimensionValue(styles[i].getBorderWidth());
    if (ws[i] > maxWidth) {
      maxWidth=ws[i];
      maxCount=1;
      maxFirstIndex=i;
    }
 else     if (ws[i] == maxWidth) {
      maxCount++;
    }
  }
  if (maxCount == 1) {
    usedStyle.setBorder(borderStyles[maxFirstIndex],borderWidths[maxFirstIndex],styles[maxFirstIndex].getBorderColor());
    return;
  }
 else {
    int max=0;
    int maxStyleIndex=0;
    int[] ss=new int[styles.length];
    for (int i=0; i < styles.length; i++) {
      if (ws[i] == maxWidth) {
        ss[i]=((Integer)styleMap.get(styles[i].getBorderStyle())).intValue();
        if (ss[i] > max) {
          max=ss[i];
          maxStyleIndex=i;
        }
      }
    }
    usedStyle.setBorder(borderStyles[maxStyleIndex],borderWidths[maxStyleIndex] != null ? borderWidths[maxStyleIndex] : IStyle.NUMBER_0,styles[maxStyleIndex].getBorderColor());
  }
}
Program: 76090
Project: 76090
Buggy source:
public boolean addArea(IArea area,boolean keepWithPrevious,boolean keepWithNext){
  if (area == null) {
    return true;
  }
  keepWith=keepWith || keepWithNext || pageBreakAvoid;
  if (!keepWith && !keepWithPrevious) {
    clearCache();
  }
  AbstractArea aArea=(AbstractArea)area;
  if (keepWithCache.getHeight() + aArea.getAllocatedHeight() + getCurrentBP() > getMaxAvaHeight()) {
    context.setAutoPageBreak(true);
    return false;
  }
 else {
    if (keepWithPrevious || keepWith) {
      keepWithCache.add(area);
    }
 else {
      addToRoot(aArea);
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean addArea(IArea area,boolean keepWithPrevious,boolean keepWithNext){
  if (area == null) {
    return true;
  }
  keepWith=keepWith || keepWithNext || pageBreakAvoid;
  if (!keepWith && !keepWithPrevious) {
    clearCache();
  }
  AbstractArea aArea=(AbstractArea)area;
  if (keepWithCache.getHeight() + aArea.getAllocatedHeight() + getCurrentBP() > getMaxAvaHeight()) {
    context.setAutoPageBreak(true);
    return false;
  }
 else {
    if (keepWithPrevious || keepWith) {
      keepWithCache.add(area);
    }
 else {
      addToRoot(aArea);
    }
  }
  keepWith=keepWithNext;
  return true;
}
Program: 76091
Project: 76091
Buggy source:
protected void createRoot(){
  if (!isFirst) {
    int startColumn=cellContent.getColumn();
    int endColumn=startColumn + cellContent.getColSpan();
    columnWidth=tableLM.getCellWidth(startColumn,endColumn);
  }
  if (root == null) {
    CellArea cell=AreaFactory.createCellArea(cellContent);
    cell.setRowSpan(tableLM.getRowSpan(cellContent));
    root=cell;
    if (!isFirst) {
      IStyle areaStyle=root.getStyle();
      areaStyle.setProperty(IStyle.STYLE_PADDING_TOP,IStyle.NUMBER_0);
      areaStyle.setProperty(IStyle.STYLE_MARGIN_TOP,IStyle.NUMBER_0);
    }
  }
  tableLM.resolveBorderConflict((CellArea)root);
  root.setWidth(columnWidth);
}

Fixed version (ground truth):
protected void createRoot(){
  if (!isFirst) {
    int startColumn=cellContent.getColumn();
    int endColumn=startColumn + cellContent.getColSpan();
    columnWidth=tableLM.getCellWidth(startColumn,endColumn);
  }
  if (root == null) {
    CellArea cell=AreaFactory.createCellArea(cellContent);
    cell.setRowSpan(tableLM.getRowSpan(cellContent));
    root=cell;
    if (!isFirst) {
      IStyle areaStyle=root.getStyle();
      areaStyle.setProperty(IStyle.STYLE_PADDING_TOP,IStyle.NUMBER_0);
      areaStyle.setProperty(IStyle.STYLE_MARGIN_TOP,IStyle.NUMBER_0);
    }
  }
  tableLM.resolveBorderConflict((CellArea)root,isFirst);
  root.setWidth(columnWidth);
}
Program: 76092
Project: 76092
Buggy source:
protected void initialize(){
  boolean isNewArea=(root == null);
  createRoot();
  if (isNewArea) {
    IStyle areaStyle=root.getStyle();
    removeMargin(areaStyle);
    validateBoxProperty(root.getStyle(),columnWidth,context.getMaxHeight());
    setOffsetX(root.getContentX());
    setOffsetY(root.getContentY());
    if (isFirst) {
      isFirst=false;
    }
    setCurrentBP(0);
    setCurrentIP(0);
  }
  maxAvaWidth=root.getContentWidth();
  root.setAllocatedHeight(parent.getCurrentMaxContentHeight());
  maxAvaHeight=root.getContentHeight();
}

Fixed version (ground truth):
protected void initialize(){
  boolean isNewArea=(root == null);
  createRoot();
  if (isNewArea) {
    IStyle areaStyle=root.getStyle();
    removeMargin(areaStyle);
    validateBoxProperty(root.getStyle(),columnWidth,context.getMaxHeight());
    setOffsetX(root.getContentX());
    setOffsetY(root.getContentY());
    setCurrentBP(0);
    setCurrentIP(0);
  }
  maxAvaWidth=root.getContentWidth();
  root.setAllocatedHeight(parent.getCurrentMaxContentHeight());
  maxAvaHeight=root.getContentHeight();
}
Program: 76093
Project: 76093
Buggy source:
private void repeat(){
  if (isFirst || tableLM.isFirst) {
    isFirst=false;
    return;
  }
  if (!needRepeat || !isCurrentDetailBand()) {
    return;
  }
  ITableBandContent header=(ITableBandContent)groupContent.getHeader();
  if (!isRepeatHeader() || header == null) {
    return;
  }
  if (header.getChildren().isEmpty()) {
    return;
  }
  if (child != null) {
    IContent content=child.getContent();
    if (content instanceof ITableBandContent) {
      if (((ITableBandContent)content).getBandType() == IBandContent.BAND_GROUP_HEADER) {
        return;
      }
    }
  }
  PDFReportLayoutEngine engine=context.getLayoutEngine();
  PDFLayoutEngineContext con=new PDFLayoutEngineContext(engine);
  con.setFactory(new PDFLayoutManagerFactory(con));
  con.setFormat(context.getFormat());
  con.setReport(context.getReport());
  con.setMaxHeight(context.getMaxHeight());
  con.setMaxWidth(context.getMaxWidth());
  con.setAllowPageBreak(false);
  IReportItemExecutor headerExecutor=new DOMReportItemExecutor(header);
  headerExecutor.execute();
  PDFTableRegionLM regionLM=new PDFTableRegionLM(con,tableLM.getContent(),tableLM.getLayoutInfo());
  regionLM.initialize(header,null);
  regionLM.layout();
  TableArea tableRegion=(TableArea)tableLM.getContent().getExtension(IContent.LAYOUT_EXTENSION);
  if (tableRegion != null && tableRegion.getHeight() < getCurrentMaxContentHeight()) {
    Iterator iter=tableRegion.getChildren();
    RowArea row=null;
    int count=0;
    while (iter.hasNext()) {
      row=(RowArea)iter.next();
      addArea(row,false,true);
      tableLM.addRow(row,true);
      count++;
    }
    repeatCount+=count;
  }
  tableLM.getContent().setExtension(IContent.LAYOUT_EXTENSION,null);
  needRepeat=false;
}

Fixed version (ground truth):
private void repeat(){
  if (isFirst || tableLM.isFirst) {
    isFirst=false;
    return;
  }
  if (!needRepeat || !isCurrentDetailBand()) {
    return;
  }
  ITableBandContent header=(ITableBandContent)groupContent.getHeader();
  if (!isRepeatHeader() || header == null) {
    return;
  }
  if (header.getChildren().isEmpty()) {
    return;
  }
  if (child != null) {
    IContent content=child.getContent();
    if (content instanceof ITableBandContent) {
      if (((ITableBandContent)content).getBandType() == IBandContent.BAND_GROUP_HEADER) {
        return;
      }
    }
  }
  IReportItemExecutor headerExecutor=new DOMReportItemExecutor(header);
  headerExecutor.execute();
  PDFTableRegionLM regionLM=tableLM.getTableRegionLayout();
  regionLM.initialize(header);
  regionLM.setGroupLevel(getGroupLevel());
  regionLM.layout();
  TableArea tableRegion=(TableArea)tableLM.getContent().getExtension(IContent.LAYOUT_EXTENSION);
  if (tableRegion != null && tableRegion.getHeight() < getCurrentMaxContentHeight()) {
    Iterator iter=tableRegion.getChildren();
    RowArea row=null;
    int count=0;
    while (iter.hasNext()) {
      row=(RowArea)iter.next();
      addArea(row,false,true);
      tableLM.addRow(row,true,false);
      count++;
    }
    repeatCount+=count;
  }
  tableLM.getContent().setExtension(IContent.LAYOUT_EXTENSION,null);
  needRepeat=false;
}
Program: 76094
Project: 76094
Buggy source:
public int[] resolveFixedLayout(int maxWidth){
  int columnNumber=table.getColumnCount();
  DimensionType[] columns=new DimensionType[columnNumber];
  for (int i=0; i < columnNumber; i++) {
    IColumn column=(IColumn)table.getColumn(i);
    DimensionType w=column.getWidth();
    if (PDFTableLM.this.isColumnHidden(column)) {
      columns[i]=new DimensionType(0d,EngineIRConstants.UNITS_PT);
    }
 else {
      if (w == null) {
        columns[i]=null;
      }
 else {
        columns[i]=new DimensionType(w.getMeasure(),w.getUnits());
      }
    }
  }
  int specifiedWidth=getDimensionValue(tableContent.getWidth(),maxWidth);
  int tableWidth;
  if (specifiedWidth > 0) {
    tableWidth=specifiedWidth;
  }
 else {
    tableWidth=maxWidth;
  }
  formalize(columns,tableWidth);
  return resolve(tableWidth,columns);
}

Fixed version (ground truth):
public int[] resolveFixedLayout(int maxWidth){
  int columnNumber=table.getColumnCount();
  DimensionType[] columns=new DimensionType[columnNumber];
  for (int i=0; i < columnNumber; i++) {
    IColumn column=table.getColumn(i);
    DimensionType w=column.getWidth();
    if (PDFTableLM.this.isColumnHidden(column)) {
      columns[i]=new DimensionType(0d,EngineIRConstants.UNITS_PT);
    }
 else {
      if (w == null) {
        columns[i]=null;
      }
 else {
        columns[i]=new DimensionType(w.getMeasure(),w.getUnits());
      }
    }
  }
  int specifiedWidth=getDimensionValue(tableContent.getWidth(),maxWidth);
  int tableWidth;
  if (specifiedWidth > 0) {
    tableWidth=specifiedWidth;
  }
 else {
    tableWidth=maxWidth;
  }
  formalize(columns,tableWidth);
  return resolve(tableWidth,columns);
}
Program: 76096
Project: 76096
Buggy source:
/** 
 * resolve cell border conflict
 * @param cellArea
 */
public void resolveBorderConflict(CellArea cellArea){
  if (layout != null) {
    layout.resolveBorderConflict(cellArea);
  }
}

Fixed version (ground truth):
/** 
 * resolve cell border conflict
 * @param cellArea
 */
public void resolveBorderConflict(CellArea cellArea,boolean isFirst){
  if (layout != null) {
    layout.resolveBorderConflict(cellArea,isFirst);
  }
}
Program: 76097
Project: 76097
Buggy source:
public void addRow(RowArea row,boolean finished){
  if (layout != null) {
    layout.addRow(row,finished);
  }
}

Fixed version (ground truth):
public void addRow(RowArea row,boolean finished,boolean repeated){
  if (layout != null) {
    layout.addRow(row,finished,repeated);
  }
}
Program: 76098
Project: 76098
Buggy source:
protected void closeLayout(){
  if (root == null) {
    return;
  }
  int borderHeight=0;
  if (layout != null) {
    layout.resolveAll();
    borderHeight=layout.resolveBottomBorder();
    layout.remove((TableArea)root);
  }
  root.setHeight(getCurrentBP() + getOffsetY() + borderHeight);
}

Fixed version (ground truth):
protected void closeLayout(){
  regionLayout=null;
  if (root == null) {
    return;
  }
  int borderHeight=0;
  if (layout != null) {
    layout.resolveAll();
    borderHeight=layout.resolveBottomBorder();
    layout.remove((TableArea)root);
  }
  root.setHeight(getCurrentBP() + getOffsetY() + borderHeight);
}
Program: 76099
Project: 76099
Buggy source:
private int getGroupLevel(){
  if (!groupStack.isEmpty()) {
    return ((Integer)groupStack.peek()).intValue();
  }
  return -1;
}

Fixed version (ground truth):
protected int getGroupLevel(){
  if (!groupStack.isEmpty()) {
    return ((Integer)groupStack.peek()).intValue();
  }
  return -1;
}
Program: 76100
Project: 76100
Buggy source:
protected void createRoot(){
  root=(ContainerArea)AreaFactory.createTableArea((ITableContent)content);
  root.setWidth(tableWidth);
  if (!isFirst) {
    root.getStyle().setProperty(IStyle.STYLE_MARGIN_TOP,IStyle.NUMBER_0);
  }
}

Fixed version (ground truth):
protected void createRoot(){
  root=AreaFactory.createTableArea((ITableContent)content);
  root.setWidth(tableWidth);
  if (!isFirst) {
    root.getStyle().setProperty(IStyle.STYLE_MARGIN_TOP,IStyle.NUMBER_0);
  }
}
Program: 76101
Project: 76101
Buggy source:
protected void addCaption(String caption){
  if (caption == null || "String_Node_Str".equals(caption)) {
    return;
  }
  IReportContent report=tableContent.getReportContent();
  ILabelContent captionLabel=report.createLabelContent();
  captionLabel.setText(caption);
  captionLabel.getStyle().setProperty(IStyle.STYLE_TEXT_ALIGN,IStyle.CENTER_VALUE);
  ICellContent cell=report.createCellContent();
  cell.setColSpan(tableContent.getColumnCount());
  cell.setRowSpan(1);
  cell.setColumn(0);
  captionLabel.setParent(cell);
  cell.getChildren().add(captionLabel);
  IRowContent row=report.createRowContent();
  row.getChildren().add(cell);
  cell.setParent(row);
  ITableBandContent band=report.createTableBandContent();
  band.getChildren().add(row);
  row.setParent(band);
  band.setParent(tableContent);
  PDFLayoutEngineContext con=new PDFLayoutEngineContext(context.getLayoutEngine());
  con.setFactory(context.getFactory());
  con.setFormat(context.getFormat());
  con.setMaxHeight(context.getMaxHeight());
  con.setAllowPageBreak(false);
  PDFTableRegionLM regionLM=new PDFTableRegionLM(con,content,layoutInfo);
  regionLM.initialize(band,null);
  regionLM.layout();
  TableArea tableRegion=(TableArea)content.getExtension(IContent.LAYOUT_EXTENSION);
  if (tableRegion != null && tableRegion.getHeight() < getCurrentMaxContentHeight()) {
    Iterator iter=tableRegion.getChildren();
    while (iter.hasNext()) {
      RowArea rowArea=(RowArea)iter.next();
      addArea(rowArea,false,false);
      repeatRowCount++;
    }
  }
  content.setExtension(IContent.LAYOUT_EXTENSION,null);
}

Fixed version (ground truth):
protected void addCaption(String caption){
  if (caption == null || "String_Node_Str".equals(caption)) {
    return;
  }
  IReportContent report=tableContent.getReportContent();
  ILabelContent captionLabel=report.createLabelContent();
  captionLabel.setText(caption);
  captionLabel.getStyle().setProperty(IStyle.STYLE_TEXT_ALIGN,IStyle.CENTER_VALUE);
  ICellContent cell=report.createCellContent();
  cell.setColSpan(tableContent.getColumnCount());
  cell.setRowSpan(1);
  cell.setColumn(0);
  captionLabel.setParent(cell);
  cell.getChildren().add(captionLabel);
  IRowContent row=report.createRowContent();
  row.getChildren().add(cell);
  cell.setParent(row);
  ITableBandContent band=report.createTableBandContent();
  band.getChildren().add(row);
  row.setParent(band);
  band.setParent(tableContent);
  PDFTableRegionLM regionLM=getTableRegionLayout();
  regionLM.initialize(band);
  regionLM.layout();
  TableArea tableRegion=(TableArea)content.getExtension(IContent.LAYOUT_EXTENSION);
  if (tableRegion != null && tableRegion.getHeight() < getCurrentMaxContentHeight()) {
    Iterator iter=tableRegion.getChildren();
    while (iter.hasNext()) {
      RowArea rowArea=(RowArea)iter.next();
      addArea(rowArea,false,false);
      repeatRowCount++;
    }
  }
  content.setExtension(IContent.LAYOUT_EXTENSION,null);
}
Program: 76102
Project: 76102
Buggy source:
protected void repeatHeader(){
  if (isFirst) {
    return;
  }
  ITableBandContent header=(ITableBandContent)tableContent.getHeader();
  if (!repeatHeader || header == null) {
    return;
  }
  if (header.getChildren().isEmpty()) {
    return;
  }
  if (child != null) {
    IContent content=child.getContent();
    if (content instanceof ITableBandContent) {
      if (((ITableBandContent)content).getBandType() == IBandContent.BAND_HEADER) {
        return;
      }
    }
  }
  PDFReportLayoutEngine engine=context.getLayoutEngine();
  PDFLayoutEngineContext con=new PDFLayoutEngineContext(engine);
  con.setFactory(new PDFLayoutManagerFactory(con));
  con.setFormat(context.getFormat());
  con.setReport(context.getReport());
  con.setMaxHeight(context.getMaxHeight());
  con.setMaxWidth(context.getMaxWidth());
  con.setAllowPageBreak(false);
  IReportItemExecutor headerExecutor=new DOMReportItemExecutor(header);
  headerExecutor.execute();
  PDFTableRegionLM regionLM=new PDFTableRegionLM(con,tableContent,layoutInfo);
  regionLM.initialize(header,null);
  regionLM.layout();
  TableArea tableRegion=(TableArea)tableContent.getExtension(IContent.LAYOUT_EXTENSION);
  if (tableRegion != null && tableRegion.getHeight() < getCurrentMaxContentHeight()) {
    Iterator iter=tableRegion.getChildren();
    RowArea row=null;
    while (iter.hasNext()) {
      row=(RowArea)iter.next();
      addArea(row,false,pageBreakAvoid);
      addRow(row,true);
      repeatRowCount++;
    }
    if (row != null) {
      removeBottomBorder(row);
    }
  }
  tableContent.setExtension(IContent.LAYOUT_EXTENSION,null);
}

Fixed version (ground truth):
protected void repeatHeader(){
  if (isFirst) {
    return;
  }
  ITableBandContent header=(ITableBandContent)tableContent.getHeader();
  if (!repeatHeader || header == null) {
    return;
  }
  if (header.getChildren().isEmpty()) {
    return;
  }
  if (child != null) {
    IContent content=child.getContent();
    if (content instanceof ITableBandContent) {
      if (((ITableBandContent)content).getBandType() == IBandContent.BAND_HEADER) {
        return;
      }
    }
  }
  IReportItemExecutor headerExecutor=new DOMReportItemExecutor(header);
  headerExecutor.execute();
  PDFTableRegionLM regionLM=getTableRegionLayout();
  regionLM.initialize(header);
  regionLM.layout();
  TableArea tableRegion=(TableArea)tableContent.getExtension(IContent.LAYOUT_EXTENSION);
  if (tableRegion != null && tableRegion.getHeight() < getCurrentMaxContentHeight()) {
    Iterator iter=tableRegion.getChildren();
    RowArea row=null;
    while (iter.hasNext()) {
      row=(RowArea)iter.next();
      addArea(row,false,pageBreakAvoid);
      addRow(row,true,true);
      repeatRowCount++;
    }
    if (row != null) {
      removeBottomBorder(row);
    }
  }
  tableContent.setExtension(IContent.LAYOUT_EXTENSION,null);
}
Program: 76103
Project: 76103
Buggy source:
public PDFTableRegionLM(PDFLayoutEngineContext context,IContent content,TableLayoutInfo layoutInfo){
  super(context,null,content,null);
  this.layoutInfo=layoutInfo;
}

Fixed version (ground truth):
public PDFTableRegionLM(PDFLayoutEngineContext context,IContent content,TableLayoutInfo layoutInfo,TableAreaLayout regionLayout){
  super(context,null,content,null);
  this.layoutInfo=layoutInfo;
  this.layout=regionLayout;
}
Program: 76107
Project: 76107
Buggy source:
private void prepareChildren(){
  currentChangeType=ColumnEvent.UNKNOWN_CHANGE;
  currentColIndex=-1;
  rowSpan=1;
  colSpan=0;
  lastMeasureIndex=-1;
  totalMeasureCount=crosstabItem.getMeasureCount();
  hasLast=false;
  walker.reload();
}

Fixed version (ground truth):
private void prepareChildren(){
  currentChangeType=ColumnEvent.UNKNOWN_CHANGE;
  currentColIndex=-1;
  rowSpan=1;
  colSpan=0;
  lastMeasureIndex=-1;
  totalMeasureCount=crosstabItem.getMeasureCount();
  boolean isVerticalMeasure=MEASURE_DIRECTION_VERTICAL.equals(crosstabItem.getMeasureDirection());
  isFirstTotalRow=rowIndex == GroupUtil.getFirstTotalRowIndex(crosstabItem,-1,-1,isVerticalMeasure);
  totalRowSpan=GroupUtil.getTotalRowSpan(crosstabItem,-1,-1,isVerticalMeasure);
  hasLast=false;
  walker.reload();
}
Program: 76108
Project: 76108
Buggy source:
private void prepareChildren(){
  currentGroupIndex=0;
  hasMeasureHeader=hasMeasureHeader(COLUMN_AXIS_TYPE);
}

Fixed version (ground truth):
private void prepareChildren(){
  currentGroupIndex=0;
  hasMeasureHeader=GroupUtil.hasMeasureHeader(crosstabItem,COLUMN_AXIS_TYPE);
}
Program: 76110
Project: 76110
Buggy source:
private void prepareChildren(){
  int measureCount=crosstabItem.getMeasureCount();
  if (columnGroups.size() > 0 || hasMeasureHeader(COLUMN_AXIS_TYPE)) {
    if (children == null) {
      children=new ArrayList();
    }
    CrosstabHeaderExecutor headerExecutor=new CrosstabHeaderExecutor(this);
    children.add(headerExecutor);
  }
  if (rowGroups.size() > 0 || measureCount > 0) {
    if (children == null) {
      children=new ArrayList();
    }
    try {
      EdgeCursor rowCursor=getRowEdgeCursor();
      if (rowCursor != null) {
        rowCursor.beforeFirst();
        if (rowCursor.next()) {
          CrosstabGroupExecutor groupExecutor=new CrosstabGroupExecutor(this,0,rowCursor);
          children.add(groupExecutor);
        }
      }
 else {
        CrosstabGroupExecutor groupExecutor=new CrosstabGroupExecutor(this,0,null);
        children.add(groupExecutor);
      }
    }
 catch (    OLAPException e) {
      logger.log(Level.SEVERE,Messages.getString("String_Node_Str"),e);
    }
  }
  if (crosstabItem.getGrandTotal(ROW_AXIS_TYPE) != null && (measureCount > 0 || !IColumnWalker.IGNORE_TOTAL_COLUMN_WITHOUT_MEASURE)) {
    if (children == null) {
      children=new ArrayList();
    }
    CrosstabFooterExecutor totalExecutor=new CrosstabFooterExecutor(this);
    children.add(totalExecutor);
  }
}

Fixed version (ground truth):
private void prepareChildren(){
  int measureCount=crosstabItem.getMeasureCount();
  if (columnGroups.size() > 0 || GroupUtil.hasMeasureHeader(crosstabItem,COLUMN_AXIS_TYPE)) {
    if (children == null) {
      children=new ArrayList();
    }
    CrosstabHeaderExecutor headerExecutor=new CrosstabHeaderExecutor(this);
    children.add(headerExecutor);
  }
  if (rowGroups.size() > 0 || measureCount > 0) {
    if (children == null) {
      children=new ArrayList();
    }
    try {
      EdgeCursor rowCursor=getRowEdgeCursor();
      if (rowCursor != null) {
        rowCursor.beforeFirst();
        if (rowCursor.next()) {
          CrosstabGroupExecutor groupExecutor=new CrosstabGroupExecutor(this,0,rowCursor);
          children.add(groupExecutor);
        }
      }
 else {
        CrosstabMeasureExecutor measureExecutor=new CrosstabMeasureExecutor(this);
        children.add(measureExecutor);
      }
    }
 catch (    OLAPException e) {
      logger.log(Level.SEVERE,Messages.getString("String_Node_Str"),e);
    }
  }
  if (rowGroups.size() > 0 && crosstabItem.getGrandTotal(ROW_AXIS_TYPE) != null && (measureCount > 0 || !IColumnWalker.IGNORE_TOTAL_COLUMN_WITHOUT_MEASURE)) {
    if (children == null) {
      children=new ArrayList();
    }
    CrosstabFooterExecutor totalExecutor=new CrosstabFooterExecutor(this);
    children.add(totalExecutor);
  }
}
Program: 76111
Project: 76111
Buggy source:
private void prepareChildren(){
  currentChangeType=ColumnEvent.UNKNOWN_CHANGE;
  currentColIndex=-1;
  isFirst=true;
  rowSpan=1;
  colSpan=0;
  lastMeasureIndex=-1;
  totalMeasureCount=crosstabItem.getMeasureCount();
  isLayoutDownThenOver=PAGE_LAYOUT_DOWN_THEN_OVER.equals(crosstabItem.getPageLayout());
  factor=hasMeasureHeader(ROW_AXIS_TYPE) ? Math.max(totalMeasureCount,1) : 1;
  hasLast=false;
  walker.reload();
}

Fixed version (ground truth):
private void prepareChildren(){
  currentChangeType=ColumnEvent.UNKNOWN_CHANGE;
  currentColIndex=-1;
  isFirst=true;
  rowSpan=1;
  colSpan=0;
  lastMeasureIndex=-1;
  totalMeasureCount=crosstabItem.getMeasureCount();
  isLayoutDownThenOver=PAGE_LAYOUT_DOWN_THEN_OVER.equals(crosstabItem.getPageLayout());
  hasLast=false;
  walker.reload();
}
Program: 76113
Project: 76113
Buggy source:
private void prepareChildren(){
  currentChangeType=ColumnEvent.UNKNOWN_CHANGE;
  currentColIndex=-1;
  isFirst=true;
  rowSpan=1;
  colSpan=0;
  lastMeasureIndex=-1;
  totalMeasureCount=crosstabItem.getMeasureCount();
  isLayoutDownThenOver=PAGE_LAYOUT_DOWN_THEN_OVER.equals(crosstabItem.getPageLayout());
  if (isLayoutDownThenOver) {
    startTotalDimensionIndex=dimensionIndex;
    startTotalLevelIndex=levelIndex;
  }
 else {
    EdgeGroup nextGroup=GroupUtil.getNextGroup(rowGroups,dimensionIndex,levelIndex);
    startTotalDimensionIndex=nextGroup.dimensionIndex;
    startTotalLevelIndex=nextGroup.levelIndex;
  }
  DimensionViewHandle dv=crosstabItem.getDimension(ROW_AXIS_TYPE,dimensionIndex);
  LevelViewHandle lv=dv.getLevel(levelIndex);
  isSubTotalBefore=lv.getAggregationHeader() != null && AGGREGATION_HEADER_LOCATION_BEFORE.equals(lv.getAggregationHeaderLocation());
  factor=hasMeasureHeader(ROW_AXIS_TYPE) ? Math.max(totalMeasureCount,1) : 1;
  hasLast=false;
  walker.reload();
}

Fixed version (ground truth):
private void prepareChildren(){
  currentChangeType=ColumnEvent.UNKNOWN_CHANGE;
  currentColIndex=-1;
  isFirst=true;
  rowSpan=1;
  colSpan=0;
  lastMeasureIndex=-1;
  totalMeasureCount=crosstabItem.getMeasureCount();
  isLayoutDownThenOver=PAGE_LAYOUT_DOWN_THEN_OVER.equals(crosstabItem.getPageLayout());
  if (isLayoutDownThenOver) {
    startTotalDimensionIndex=dimensionIndex;
    startTotalLevelIndex=levelIndex;
  }
 else {
    EdgeGroup nextGroup=GroupUtil.getNextGroup(rowGroups,dimensionIndex,levelIndex);
    startTotalDimensionIndex=nextGroup.dimensionIndex;
    startTotalLevelIndex=nextGroup.levelIndex;
  }
  DimensionViewHandle dv=crosstabItem.getDimension(ROW_AXIS_TYPE,dimensionIndex);
  LevelViewHandle lv=dv.getLevel(levelIndex);
  isSubTotalBefore=lv.getAggregationHeader() != null && AGGREGATION_HEADER_LOCATION_BEFORE.equals(lv.getAggregationHeaderLocation());
  boolean isVerticalMeasure=MEASURE_DIRECTION_VERTICAL.equals(crosstabItem.getMeasureDirection());
  isFirstTotalRow=rowIndex == GroupUtil.getFirstTotalRowIndex(crosstabItem,dimensionIndex,levelIndex,isVerticalMeasure);
  totalRowSpan=GroupUtil.getTotalRowSpan(crosstabItem,dimensionIndex,levelIndex,isVerticalMeasure);
  hasLast=false;
  walker.reload();
}
Program: 76115
Project: 76115
Buggy source:
public BidiSplitter(Chunk inputChunk){
  this.chunkText=inputChunk.getText().toCharArray();
  this.baseLevel=inputChunk.getBaseLevel();
  this.bidi=createBidi(inputChunk.getText(),baseLevel);
}

Fixed version (ground truth):
public BidiSplitter(Chunk inputChunk){
  this.chunkText=inputChunk.getText().toCharArray();
  this.baseLevel=inputChunk.getBaseLevel();
  this.bidi=createBidi(inputChunk.getText(),baseLevel);
  if (baseLevel < 0) {
    baseLevel=bidi.getBaseLevel();
    inputChunk.setBaseLevel(baseLevel);
    lastRun=baseLevel;
  }
}
Program: 76116
Project: 76116
Buggy source:
private Chunk buildChunk(){
  if (currentRun < bidi.getRunCount()) {
    endIndex=bidi.getRunLimit(currentRun);
    int level=bidi.getRunLevel(currentRun);
    String text=null;
    if (level == Bidi.DIRECTION_RIGHT_TO_LEFT) {
      for (int i=beginIndex; i < endIndex; i++) {
        if (needMirroring(chunkText[i])) {
          chunkText[i]=(char)mirrorChars.get(chunkText[i]);
        }
      }
      text=new String(chunkText,beginIndex,endIndex - beginIndex);
    }
 else {
      text=new String(chunkText,beginIndex,endIndex - beginIndex);
    }
    Chunk c=new Chunk(text,beginIndex,baseLevel,bidi.getRunLevel(currentRun));
    beginIndex=endIndex;
    currentRun++;
    return c;
  }
  return null;
}

Fixed version (ground truth):
private Chunk buildChunk(){
  if (currentRun < bidi.getRunCount()) {
    endIndex=bidi.getRunLimit(currentRun);
    int level=getAbsRunLevel();
    String text=null;
    if (level == Bidi.DIRECTION_RIGHT_TO_LEFT) {
      for (int i=beginIndex; i < endIndex; i++) {
        if (needMirroring(chunkText[i])) {
          chunkText[i]=(char)mirrorChars.get(chunkText[i]);
        }
      }
      text=new String(chunkText,beginIndex,endIndex - beginIndex);
    }
 else {
      text=new String(chunkText,beginIndex,endIndex - beginIndex);
    }
    Chunk c=new Chunk(text,beginIndex,baseLevel,level);
    beginIndex=endIndex;
    currentRun++;
    return c;
  }
  return null;
}
Program: 76119
Project: 76119
Buggy source:
/** 
 * Retrieves format pattern from arrays given format type categorys.
 * @param category Given format type category.
 * @return The corresponding format pattern string.
 */
public static String getPatternForCategory(String category){
  String pattern;
  if (DesignChoiceConstants.DATETIEM_FORMAT_TYPE_GENERAL_DATE.equals(category)) {
    pattern="String_Node_Str";
  }
 else   if (DesignChoiceConstants.DATETIEM_FORMAT_TYPE_LONG_DATE.equals(category)) {
    pattern="String_Node_Str";
  }
 else   if (DesignChoiceConstants.DATETIEM_FORMAT_TYPE_MUDIUM_DATE.equals(category)) {
    pattern="String_Node_Str";
  }
 else   if (DesignChoiceConstants.DATETIEM_FORMAT_TYPE_SHORT_DATE.equals(category)) {
    pattern="String_Node_Str";
  }
 else   if (DesignChoiceConstants.DATETIEM_FORMAT_TYPE_LONG_TIME.equals(category)) {
    pattern="String_Node_Str";
  }
 else   if (DesignChoiceConstants.DATETIEM_FORMAT_TYPE_MEDIUM_TIME.equals(category)) {
    pattern="String_Node_Str";
  }
 else   if (DesignChoiceConstants.DATETIEM_FORMAT_TYPE_SHORT_TIME.equals(category)) {
    pattern="String_Node_Str";
  }
 else {
    pattern="String_Node_Str";
  }
  return pattern;
}

Fixed version (ground truth):
/** 
 * Retrieves format pattern from arrays given format type categorys.
 * @param category Given format type category.
 * @return The corresponding format pattern string.
 */
public static String getPatternForCategory(String category){
  String pattern;
  if (DesignChoiceConstants.DATETIEM_FORMAT_TYPE_GENERAL_DATE.equals(category) || DesignChoiceConstants.DATE_FORMAT_TYPE_GENERAL_DATE.equals(category)) {
    pattern="String_Node_Str";
  }
 else   if (DesignChoiceConstants.DATETIEM_FORMAT_TYPE_LONG_DATE.equals(category) || DesignChoiceConstants.DATE_FORMAT_TYPE_LONG_DATE.equals(category)) {
    pattern="String_Node_Str";
  }
 else   if (DesignChoiceConstants.DATETIEM_FORMAT_TYPE_MUDIUM_DATE.equals(category) || DesignChoiceConstants.DATE_FORMAT_TYPE_MUDIUM_DATE.equals(category)) {
    pattern="String_Node_Str";
  }
 else   if (DesignChoiceConstants.DATETIEM_FORMAT_TYPE_SHORT_DATE.equals(category) || DesignChoiceConstants.DATE_FORMAT_TYPE_SHORT_DATE.equals(category)) {
    pattern="String_Node_Str";
  }
 else   if (DesignChoiceConstants.DATETIEM_FORMAT_TYPE_LONG_TIME.equals(category) || DesignChoiceConstants.TIME_FORMAT_TYPE_LONG_TIME.equals(category)) {
    pattern="String_Node_Str";
  }
 else   if (DesignChoiceConstants.DATETIEM_FORMAT_TYPE_MEDIUM_TIME.equals(category) || DesignChoiceConstants.TIME_FORMAT_TYPE_MEDIUM_TIME.equals(category)) {
    pattern="String_Node_Str";
  }
 else   if (DesignChoiceConstants.DATETIEM_FORMAT_TYPE_SHORT_TIME.equals(category) || DesignChoiceConstants.TIME_FORMAT_TYPE_SHORT_TIME.equals(category)) {
    pattern="String_Node_Str";
  }
 else {
    pattern="String_Node_Str";
  }
  return pattern;
}
Program: 76120
Project: 76120
Buggy source:
/** 
 * Gets the position after the sibling in the container
 * @param targetObj container or sibling
 * @param canContain <code>CONTAIN_PARENT</code> as sibling, others as container
 * @return the position: after the sibling in the same container, or -1 asthe last position in the container
 */
public static int calculateNextPosition(Object targetObj,int canContain){
  int position=-1;
  if (canContain == CONTAIN_PARENT) {
    DesignElementHandle afterHandle=getDesignElementHandle(targetObj);
    if (afterHandle != null) {
      if (afterHandle.getContainerSlotHandle() != null) {
        position=afterHandle.getContainerSlotHandle().findPosn(afterHandle);
        position++;
      }
 else       if (afterHandle.getContainerPropertyHandle() != null) {
        position=afterHandle.getContainerPropertyHandle().getContents().indexOf(afterHandle);
      }
    }
  }
  return position;
}

Fixed version (ground truth):
/** 
 * Gets the position after the sibling in the container
 * @param targetObj container or sibling
 * @param canContain <code>CONTAIN_PARENT</code> as sibling, others as container
 * @return the position: after the sibling in the same container, or -1 asthe last position in the container
 */
public static int calculateNextPosition(Object targetObj,int canContain){
  int position=-1;
  if (canContain == CONTAIN_PARENT) {
    DesignElementHandle afterHandle=getDesignElementHandle(targetObj);
    if (afterHandle != null) {
      if (afterHandle.getContainerSlotHandle() != null) {
        position=afterHandle.getContainerSlotHandle().findPosn(afterHandle);
      }
 else       if (afterHandle.getContainerPropertyHandle() != null) {
        position=afterHandle.getContainerPropertyHandle().getContents().indexOf(afterHandle);
      }
      position++;
    }
  }
  return position;
}
Program: 76121
Project: 76121
Buggy source:
private int getPosition(Object target){
  this.newTarget=target;
  int position=DNDUtil.calculateNextPosition(target,canContain);
  if (position > -1) {
    if (DNDUtil.getDesignElementHandle(target).getContainerSlotHandle() != null) {
      this.newTarget=DNDUtil.getDesignElementHandle(target).getContainerSlotHandle();
    }
 else {
      this.newTarget=DNDUtil.getDesignElementHandle(target).getContainerPropertyHandle();
    }
    if (getCurrentLocation() == LOCATION_BEFORE) {
      position--;
    }
  }
  return position;
}

Fixed version (ground truth):
private int getPosition(Object target){
  this.newTarget=target;
  int position=DNDUtil.calculateNextPosition(target,canContain);
  if (position > -1) {
    if (DNDUtil.getDesignElementHandle(target).getContainerSlotHandle() != null) {
      this.newTarget=DNDUtil.getDesignElementHandle(target).getContainerSlotHandle();
    }
 else {
      this.newTarget=DNDUtil.getDesignElementHandle(target).getContainerPropertyHandle();
    }
    if (getCurrentLocation() == LOCATION_BEFORE || (getCurrentLocation() == LOCATION_AFTER && target == getSelectedObject())) {
      position--;
    }
  }
  return position;
}
Program: 76122
Project: 76122
Buggy source:
private String getExpression(String columnName){
  for (Iterator iter=columnList.iterator(); iter.hasNext(); ) {
    ResultSetColumnHandle cachedColumn=(ResultSetColumnHandle)iter.next();
    if (cachedColumn.getColumnName().equals(columnName)) {
      return DEUtil.getExpression(cachedColumn);
    }
  }
  return columnName;
}

Fixed version (ground truth):
private String getExpression(String columnName){
  if (columnName.equals(NONE_DISPLAY_TEXT)) {
    return null;
  }
  for (Iterator iter=columnList.iterator(); iter.hasNext(); ) {
    ResultSetColumnHandle cachedColumn=(ResultSetColumnHandle)iter.next();
    if (cachedColumn.getColumnName().equals(columnName)) {
      return DEUtil.getExpression(cachedColumn);
    }
  }
  return columnName;
}
Program: 76124
Project: 76124
Buggy source:
public Object getValue(int fieldIndex) throws BirtException {
  return it.getValue(this.metadata == null ? it.getResultMetaData().getColumnName(fieldIndex) : this.metadata.getFieldName(fieldIndex));
}

Fixed version (ground truth):
public Object getValue(int fieldIndex) throws BirtException {
  Object value=it.getValue(this.metadata.getFieldName(fieldIndex));
  if (value == null) {
    return this.metadata.getNullValueReplacer(fieldIndex);
  }
  return value;
}
Program: 76125
Project: 76125
Buggy source:
/** 
 * @param query
 * @param measure
 * @param function
 * @return
 */
private ScriptExpression populateExpression(QueryDefinition query,MeasureHandle measure,String function){
  ScriptExpression se=null;
  if (function == null || function.equals("String_Node_Str")) {
    se=new ScriptExpression("String_Node_Str" + measure.getMeasureExpression() + "String_Node_Str"+ query.getGroups().size()+ "String_Node_Str");
  }
 else   if (function.equals("String_Node_Str")) {
    se=new ScriptExpression("String_Node_Str" + "String_Node_Str" + query.getGroups().size() + "String_Node_Str");
  }
 else   if (function.equals("String_Node_Str")) {
    se=new ScriptExpression("String_Node_Str" + measure.getMeasureExpression() + "String_Node_Str"+ query.getGroups().size()+ "String_Node_Str");
  }
 else   if (function.equals("String_Node_Str")) {
    se=new ScriptExpression("String_Node_Str" + measure.getMeasureExpression() + "String_Node_Str"+ query.getGroups().size()+ "String_Node_Str");
  }
  se.setDataType(DataType.DOUBLE_TYPE);
  return se;
}

Fixed version (ground truth):
/** 
 * @param query
 * @param measure
 * @param function
 * @return
 */
private ScriptExpression populateExpression(QueryDefinition query,MeasureHandle measure,String function){
  ScriptExpression se=null;
  if (function == null || function.equals("String_Node_Str")) {
    se=new ScriptExpression("String_Node_Str" + measure.getMeasureExpression() + "String_Node_Str"+ query.getGroups().size()+ "String_Node_Str");
  }
 else   if (function.equals("String_Node_Str")) {
    se=new ScriptExpression("String_Node_Str" + "String_Node_Str" + query.getGroups().size() + "String_Node_Str");
  }
 else   if (function.equals("String_Node_Str")) {
    se=new ScriptExpression("String_Node_Str" + measure.getMeasureExpression() + "String_Node_Str"+ query.getGroups().size()+ "String_Node_Str");
  }
 else   if (function.equals("String_Node_Str")) {
    se=new ScriptExpression("String_Node_Str" + measure.getMeasureExpression() + "String_Node_Str"+ query.getGroups().size()+ "String_Node_Str");
  }
  se.setDataType(ModelAdapter.adaptModelDataType(measure.getDataType()));
  return se;
}