nus-yam/ex-repair huggingface dataset:
Program: 56472
Project: 56472
Buggy source:
@Override public void fillDown(){
  new ModelUpdateTask(){
    @Override Object doInvokePhase(){
      autoFillInLock(new CellRegion(getRow(),getColumn(),getLastRow(),getLastColumn()),new CellRegion(getRow(),getColumn(),getLastRow(),getLastColumn()),FillType.COPY);
      return null;
    }
    @Override void doNotifyPhase(){
    }
  }
.doInWriteLock(getLock());
}

Fixed version (ground truth):
@Override public void fillDown(){
  new ModelUpdateTask(){
    @Override Object doInvokePhase(){
      autoFillInLock(new CellRegion(getRow(),getColumn(),getRow(),getLastColumn()),new CellRegion(getRow(),getColumn(),getLastRow(),getLastColumn()),FillType.COPY);
      return null;
    }
    @Override void doNotifyPhase(){
    }
  }
.doInWriteLock(getLock());
}
Program: 56473
Project: 56473
Buggy source:
private void pasteValue(CellBuffer buffer,NCell destCell,boolean pasteFormula,int rowOffset,int columnOffset,boolean transpose,int rowOrigin,int columnOrigin){
  if (pasteFormula) {
    String formula=buffer.getFormula();
    if (formula != null) {
      FormulaEngine engine=getFormulaEignin();
      FormulaExpression expr=engine.shift(formula,rowOffset,columnOffset,new FormulaParseContext(destSheet,null));
      if (!expr.hasError() && transpose) {
        expr=engine.transpose(expr.getFormulaString(),rowOffset,columnOffset,new FormulaParseContext(destSheet,null));
      }
      if (!expr.hasError()) {
        destCell.setFormulaValue(expr.getFormulaString());
      }
      return;
    }
  }
  destCell.setValue(buffer.getValue());
}

Fixed version (ground truth):
private void pasteValue(CellBuffer buffer,NCell destCell,boolean pasteFormula,int rowOffset,int columnOffset,boolean transpose,int rowOrigin,int columnOrigin){
  if (pasteFormula) {
    String formula=buffer.getFormula();
    if (formula != null) {
      FormulaEngine engine=getFormulaEignin();
      FormulaExpression expr=engine.shift(formula,rowOffset,columnOffset,new FormulaParseContext(destSheet,null));
      if (!expr.hasError() && transpose) {
        expr=engine.transpose(expr.getFormulaString(),rowOrigin,columnOrigin,new FormulaParseContext(destSheet,null));
      }
      if (!expr.hasError()) {
        destCell.setFormulaValue(expr.getFormulaString());
      }
      return;
    }
  }
  destCell.setValue(buffer.getValue());
}
Program: 56474
Project: 56474
Buggy source:
private void pasteValue(CellBuffer buffer,NCell destCell,boolean pasteFormula,int rowOffset,int columnOffset,boolean transpose,int rowOrigin,int columnOrigin){
  if (pasteFormula) {
    String formula=buffer.getFormula();
    if (formula != null) {
      FormulaEngine engine=getFormulaEignin();
      FormulaExpression expr=engine.shift(formula,rowOffset,columnOffset,new FormulaParseContext(destSheet,null));
      if (!expr.hasError() && transpose) {
        expr=engine.transpose(expr.getFormulaString(),rowOffset,columnOffset,new FormulaParseContext(destSheet,null));
      }
      if (!expr.hasError()) {
        destCell.setFormulaValue(expr.getFormulaString());
      }
      return;
    }
  }
  destCell.setValue(buffer.getValue());
}

Fixed version (ground truth):
private void pasteValue(CellBuffer buffer,NCell destCell,boolean pasteFormula,int rowOffset,int columnOffset,boolean transpose,int rowOrigin,int columnOrigin){
  if (pasteFormula) {
    String formula=buffer.getFormula();
    if (formula != null) {
      FormulaEngine engine=getFormulaEignin();
      FormulaExpression expr=engine.shift(formula,rowOffset,columnOffset,new FormulaParseContext(destSheet,null));
      if (!expr.hasError() && transpose) {
        expr=engine.transpose(expr.getFormulaString(),rowOrigin,columnOrigin,new FormulaParseContext(destSheet,null));
      }
      if (!expr.hasError()) {
        destCell.setFormulaValue(expr.getFormulaString());
      }
      return;
    }
  }
  destCell.setValue(buffer.getValue());
}
Program: 56475
Project: 56475
Buggy source:
@Override public void setCellStyle(NCellStyle cellStyle){
  Validations.argNotNull(cellStyle);
  loadProxy();
  if (proxy == null) {
    proxy=(AbstractCellAdv)((AbstractRowAdv)((AbstractSheetAdv)getSheet()).getOrCreateRow(rowIdx)).getOrCreateCell(columnIdx);
  }
  proxy.setCellStyle(cellStyle);
}

Fixed version (ground truth):
@Override public void setCellStyle(NCellStyle cellStyle){
  loadProxy();
  if (proxy == null) {
    proxy=(AbstractCellAdv)((AbstractRowAdv)((AbstractSheetAdv)getSheet()).getOrCreateRow(rowIdx)).getOrCreateCell(columnIdx);
  }
  proxy.setCellStyle(cellStyle);
}
Program: 56478
Project: 56478
Buggy source:
void rebuildFormulaDependency(){
  if (getType() == CellType.FORMULA && lastRef != null) {
    FormulaExpression expr=(FormulaExpression)getValue(false);
    if (!expr.hasError()) {
      clearFormulaDependency();
      FormulaEngine fe=EngineFactory.getInstance().createFormulaEngine();
      fe.parse(expr.getFormulaString(),new FormulaParseContext(this,getRef()));
    }
  }
}

Fixed version (ground truth):
void rebuildFormulaDependency(){
  if (getType() == CellType.FORMULA && lastRef != null) {
    FormulaExpression expr=(FormulaExpression)getValue(false);
    if (!expr.hasError()) {
      clearFormulaDependency();
      FormulaEngine fe=EngineFactory.getInstance().createFormulaEngine();
      fe.parse(expr.getFormulaString(),new FormulaParseContext(this,getRef()));
    }
  }
 else   if (lastRef != null) {
    lastRef=null;
  }
}
Program: 56480
Project: 56480
Buggy source:
@Override public void setDataFormat(String dataFormat){
  Validations.argNotNull(dataFormat);
  this.dataFormat=dataFormat;
}

Fixed version (ground truth):
@Override public void setDataFormat(String dataFormat){
  if (dataFormat == null) {
    dataFormat=FORMAT_GENERAL;
  }
  this.dataFormat=dataFormat;
}
Program: 56484
Project: 56484
Buggy source:
public void testDateDisplayNormal2(Book book){
  Sheet sheet=book.getSheetAt(0);
  Range r;
  Setup.setZssLocale(Locale.TAIWAN);
  r=Ranges.range(sheet,"String_Node_Str");
  r.setCellEditText("String_Node_Str");
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  CellOperationUtil.applyDataFormat(r,"String_Node_Str");
  Setup.setZssLocale(Locale.TAIWAN);
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.US);
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.UK);
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
}

Fixed version (ground truth):
public void testDateDisplayNormal2(Book book){
  Sheet sheet=book.getSheetAt(0);
  Range r;
  Setup.setZssLocale(Locale.TAIWAN);
  r=Ranges.range(sheet,"String_Node_Str");
  r.setCellEditText("String_Node_Str");
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  CellOperationUtil.applyDataFormat(r,"String_Node_Str");
  Setup.setZssLocale(Locale.TAIWAN);
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.US);
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.UK);
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
}
Program: 56485
Project: 56485
Buggy source:
public void testDateDisplayNormal1(Book book){
  Sheet sheet=book.getSheetAt(0);
  Range r;
  Setup.setZssLocale(Locale.TAIWAN);
  r=Ranges.range(sheet,"String_Node_Str");
  r.setCellEditText("String_Node_Str");
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  CellOperationUtil.applyDataFormat(r,"String_Node_Str");
  Setup.setZssLocale(Locale.TAIWAN);
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.US);
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.UK);
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
}

Fixed version (ground truth):
public void testDateDisplayNormal1(Book book){
  Sheet sheet=book.getSheetAt(0);
  Range r;
  Setup.setZssLocale(Locale.TAIWAN);
  r=Ranges.range(sheet,"String_Node_Str");
  r.setCellEditText("String_Node_Str");
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  CellOperationUtil.applyDataFormat(r,"String_Node_Str");
  Setup.setZssLocale(Locale.TAIWAN);
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.US);
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.UK);
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
}
Program: 56486
Project: 56486
Buggy source:
public void testInputDateObjectTW(Book book){
  Sheet sheet=book.getSheetAt(0);
  Range r;
  Date today=new Date();
  String todayStr;
  String todayStrLong;
  Setup.setZssLocale(Locale.TAIWAN);
  r=Ranges.range(sheet,"String_Node_Str");
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  CellOperationUtil.applyDataFormat(r,"String_Node_Str");
  todayStr=new SimpleDateFormat("String_Node_Str",Setup.getZssLocale()).format(today);
  todayStrLong=new SimpleDateFormat("String_Node_Str",Setup.getZssLocale()).format(today);
  r.setCellEditText(todayStr);
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals(todayStr,r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals(todayStr,r.getCellEditText());
  r.getCellData().setValue(today);
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals(todayStr,r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals(todayStrLong,r.getCellEditText());
  r.getCellData().setValue(Util.getDateOnly(today));
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals(todayStr,r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals(todayStr,r.getCellEditText());
}

Fixed version (ground truth):
public void testInputDateObjectTW(Book book){
  Sheet sheet=book.getSheetAt(0);
  Range r;
  Date today=new Date();
  String todayStr;
  String todayStrLong;
  Setup.setZssLocale(Locale.TAIWAN);
  r=Ranges.range(sheet,"String_Node_Str");
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  CellOperationUtil.applyDataFormat(r,"String_Node_Str");
  todayStr=new SimpleDateFormat("String_Node_Str",Setup.getZssLocale()).format(today);
  todayStrLong=new SimpleDateFormat("String_Node_Str",Setup.getZssLocale()).format(today);
  r.setCellEditText(todayStr);
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals(todayStr,r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals(todayStr,r.getCellEditText());
  r.getCellData().setValue(today);
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals(todayStr,r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals(todayStrLong,r.getCellEditText());
  r.getCellData().setValue(Util.getDateOnly(today));
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals(todayStr,r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals(todayStr,r.getCellEditText());
}
Program: 56487
Project: 56487
Buggy source:
public void testDateDisplaySpecial1(Book book){
  Sheet sheet=book.getSheetAt(0);
  Range r;
  Setup.setZssLocale(Locale.TAIWAN);
  r=Ranges.range(sheet,"String_Node_Str");
  r.setCellEditText("String_Node_Str");
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  CellOperationUtil.applyDataFormat(r,"String_Node_Str");
  Setup.setZssLocale(Locale.TAIWAN);
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.US);
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.UK);
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
}

Fixed version (ground truth):
public void testDateDisplaySpecial1(Book book){
  Sheet sheet=book.getSheetAt(0);
  Range r;
  Setup.setZssLocale(Locale.TAIWAN);
  r=Ranges.range(sheet,"String_Node_Str");
  r.setCellEditText("String_Node_Str");
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  CellOperationUtil.applyDataFormat(r,"String_Node_Str");
  Setup.setZssLocale(Locale.TAIWAN);
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.US);
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.UK);
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
}
Program: 56488
Project: 56488
Buggy source:
public void testDateDisplaySpecial2(Book book){
  Sheet sheet=book.getSheetAt(0);
  Range r;
  Setup.setZssLocale(Locale.TAIWAN);
  r=Ranges.range(sheet,"String_Node_Str");
  r.setCellEditText("String_Node_Str");
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  CellOperationUtil.applyDataFormat(r,"String_Node_Str");
  Setup.setZssLocale(Locale.TAIWAN);
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.US);
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.UK);
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
}

Fixed version (ground truth):
public void testDateDisplaySpecial2(Book book){
  Sheet sheet=book.getSheetAt(0);
  Range r;
  Setup.setZssLocale(Locale.TAIWAN);
  r=Ranges.range(sheet,"String_Node_Str");
  r.setCellEditText("String_Node_Str");
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  CellOperationUtil.applyDataFormat(r,"String_Node_Str");
  Setup.setZssLocale(Locale.TAIWAN);
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.US);
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.UK);
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
}
Program: 56489
Project: 56489
Buggy source:
public void testDateDisplaySpecial3(Book book){
  Sheet sheet=book.getSheetAt(0);
  Range r;
  Setup.setZssLocale(Locale.US);
  r=Ranges.range(sheet,"String_Node_Str");
  r.setCellEditText("String_Node_Str");
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  CellOperationUtil.applyDataFormat(r,"String_Node_Str");
  Setup.setZssLocale(Locale.TAIWAN);
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.US);
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.UK);
  Assert.assertEquals("String_Node_Str",r.getCellStyle().getDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
}

Fixed version (ground truth):
public void testDateDisplaySpecial3(Book book){
  Sheet sheet=book.getSheetAt(0);
  Range r;
  Setup.setZssLocale(Locale.US);
  r=Ranges.range(sheet,"String_Node_Str");
  r.setCellEditText("String_Node_Str");
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  CellOperationUtil.applyDataFormat(r,"String_Node_Str");
  Setup.setZssLocale(Locale.TAIWAN);
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.US);
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
  Setup.setZssLocale(Locale.UK);
  Assert.assertEquals("String_Node_Str",r.getCellDataFormat());
  Assert.assertEquals("String_Node_Str",r.getCellFormatText());
  Assert.assertEquals(CellType.NUMERIC,r.getCellData().getType());
  Assert.assertEquals("String_Node_Str",r.getCellEditText());
}
Program: 56490
Project: 56490
Buggy source:
/** 
 * Gets the first cell(top-left) format text of this range
 * @return format text
 * @see CellData#getFormatText()
 */
public String getCellFormatText();

Fixed version (ground truth):
/** 
 * Gets the first cell(top-left) formatted text of this range
 * @return format text
 * @see CellData#getFormatText()
 */
public String getCellFormatText();
Program: 56491
Project: 56491
Buggy source:
/** 
 * Gets the first(top-left) cell's formatted text
 * @return
 */
public String getCellFormatText();

Fixed version (ground truth):
/** 
 * Gets the first(top-left) cell's formatted text, if the cell's format is the special LOCALE aware format (such as m/d/yyyy),  it will formats the value by transferred format (e.g m/d/yyyy will transfer to yyyy/m/d in TW locale) 
 * @return
 */
public String getCellFormatText();
Program: 56492
Project: 56492
Buggy source:
protected void exportNamedRange(NBook book){
  for (  NName name : book.getNames()) {
    Name poiName=workbook.createName();
    poiName.setNameName(name.getName());
    poiName.setSheetIndex(workbook.getSheetIndex(name.getRefersToSheetName()));
    poiName.setRefersToFormula(name.getRefersToFormula());
  }
}

Fixed version (ground truth):
protected void exportNamedRange(NBook book){
  for (  NName name : book.getNames()) {
    Name poiName=workbook.createName();
    poiName.setNameName(name.getName());
    String sheetName=name.getRefersToSheetName();
    if (sheetName != null) {
      poiName.setSheetIndex(workbook.getSheetIndex(sheetName));
    }
    poiName.setRefersToFormula(name.getRefersToFormula());
  }
}
Program: 56493
Project: 56493
Buggy source:
@Override public void deleteSheet(NSheet sheet){
  checkOwnership(sheet);
  ((AbstractSheetAdv)sheet).destroy();
  int index=sheets.indexOf(sheet);
  sheets.remove(index);
  EngineFactory.getInstance().createFormulaEngine().clearCache(new FormulaClearContext(this));
  sendModelInternalEvent(ModelInternalEvents.createModelInternalEvent(ModelInternalEvents.ON_SHEET_DELETED,this,ModelInternalEvents.createDataMap(ModelInternalEvents.PARAM_SHEET_OLD_INDEX,index)));
  ModelUpdateUtil.handlePrecedentUpdate(getBookSeries(),new RefImpl(this.getBookName(),sheet.getSheetName()));
}

Fixed version (ground truth):
@Override public void deleteSheet(NSheet sheet){
  checkOwnership(sheet);
  destroyingSheet.set(sheet);
  try {
    ((AbstractSheetAdv)sheet).destroy();
  }
  finally {
    destroyingSheet.set(null);
  }
  int index=sheets.indexOf(sheet);
  sheets.remove(index);
  EngineFactory.getInstance().createFormulaEngine().clearCache(new FormulaClearContext(this));
  sendModelInternalEvent(ModelInternalEvents.createModelInternalEvent(ModelInternalEvents.ON_SHEET_DELETED,this,ModelInternalEvents.createDataMap(ModelInternalEvents.PARAM_SHEET_OLD_INDEX,index)));
  ModelUpdateUtil.handlePrecedentUpdate(getBookSeries(),new RefImpl(this.getBookName(),sheet.getSheetName()));
}
Program: 56494
Project: 56494
Buggy source:
@Override public void clearValue(){
  checkOrphan();
  validateDataGridValue(null);
  setDataGridValue(null);
  clearFormulaDependency();
  clearFormulaResultCache();
  OptFields opts=getOpts(false);
  if (opts != null) {
    opts.hyperlink=null;
  }
  ;
  addCellUpdate();
}

Fixed version (ground truth):
@Override public void clearValue(){
  checkOrphan();
  validateDataGridValue(null);
  setDataGridValue(null);
  clearFormulaDependency();
  clearFormulaResultCache();
  OptFields opts=getOpts(false);
  if (opts != null) {
    opts.hyperlink=null;
  }
  ;
  if (BookImpl.destroyingSheet.get() != getSheet()) {
    addCellUpdate();
  }
}
Program: 56495
Project: 56495
Buggy source:
@SuppressWarnings("String_Node_Str") public void merge(boolean across){
  int tRow=range.getRow();
  int lCol=range.getColumn();
  int bRow=range.getLastColumn();
  int rCol=range.getLastColumn();
  List<CellRegion> overlaps=sheet.getOverlapsMergedRegions(new CellRegion(tRow,lCol,bRow,rCol));
  if (overlaps != null && overlaps.size() > 0) {
    throw new InvalidateModelOpException("String_Node_Str" + overlaps.get(0).getReferenceString() + "String_Node_Str");
  }
  if (across) {
    for (int r=tRow; r <= bRow; ++r) {
      merge0(sheet,r,lCol,r,rCol);
    }
  }
 else {
    merge0(sheet,tRow,lCol,bRow,rCol);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void merge(boolean across){
  int tRow=range.getRow();
  int lCol=range.getColumn();
  int bRow=range.getLastRow();
  int rCol=range.getLastColumn();
  List<CellRegion> overlaps=sheet.getOverlapsMergedRegions(new CellRegion(tRow,lCol,bRow,rCol));
  if (overlaps != null && overlaps.size() > 0) {
    throw new InvalidateModelOpException("String_Node_Str" + overlaps.get(0).getReferenceString() + "String_Node_Str");
  }
  if (across) {
    for (int r=tRow; r <= bRow; ++r) {
      merge0(sheet,r,lCol,r,rCol);
    }
  }
 else {
    merge0(sheet,tRow,lCol,bRow,rCol);
  }
}
Program: 56496
Project: 56496
Buggy source:
private void importAutoFilter(Sheet poiSheet,NSheet sheet){
  AutoFilter poiAutoFilter=poiSheet.getAutoFilter();
  if (poiAutoFilter != null) {
    NAutoFilter autoFilter=sheet.createAutoFilter(new CellRegion(poiAutoFilter.getRangeAddress().formatAsString()));
    for (int i=0; i < poiAutoFilter.getFilterColumns().size(); i++) {
      FilterColumn srcColumn=poiAutoFilter.getFilterColumn(i);
      NFilterColumn destColumn=autoFilter.getFilterColumn(i,true);
      destColumn.setProperties(toFilterOperator(srcColumn.getOperator()),srcColumn.getCriteria1(),srcColumn.getCriteria2(),srcColumn.isOn());
    }
  }
}

Fixed version (ground truth):
/** 
 * A FilterColumn object only exists when we have set a criteria on that column.  For example, if we enable auto filter on 2 columns, but we only set criteria on 2nd column.  Thus, the size of filter column is 1. There is only one FilterColumn object and its column id is 1.   Only getFilterColumn(1) will return a FilterColumn, other get null.
 * @param poiSheet
 * @param sheet
 */
private void importAutoFilter(Sheet poiSheet,NSheet sheet){
  AutoFilter poiAutoFilter=poiSheet.getAutoFilter();
  if (poiAutoFilter != null) {
    CellRangeAddress filteringRange=poiAutoFilter.getRangeAddress();
    NAutoFilter autoFilter=sheet.createAutoFilter(new CellRegion(filteringRange.formatAsString()));
    int numberOfColumn=filteringRange.getLastColumn() - filteringRange.getFirstColumn() + 1;
    for (int i=0; i < numberOfColumn; i++) {
      FilterColumn srcColumn=poiAutoFilter.getFilterColumn(i);
      if (srcColumn == null) {
        continue;
      }
      NFilterColumn destColumn=autoFilter.getFilterColumn(i,true);
      destColumn.setProperties(toFilterOperator(srcColumn.getOperator()),srcColumn.getCriteria1(),srcColumn.getCriteria2(),srcColumn.isOn());
    }
  }
}
Program: 56497
Project: 56497
Buggy source:
/** 
 * Returns the column filter information of the specified column; null if the column is not filtered.
 * @param col the nth column (1st column in the filter range is 0)
 * @return the column filter information of the specified column; null if the column is not filtered.
 */
public NFilterColumn getFilterColumn(int index,boolean create);

Fixed version (ground truth):
/** 
 * Returns the column filter information of the specified column; null if the column is not filtered.
 * @param index the nth column (1st column in the filter range is 0)
 * @return the column filter information of the specified column; null if the column is not filtered.
 */
public NFilterColumn getFilterColumn(int index,boolean create);
Program: 56499
Project: 56499
Buggy source:
@Override public int[] getColumnBreaks(){
  if (columnBreaks == null) {
    return new int[0];
  }
  int[] arr=new int[]{columnBreaks.size()};
  Iterator<Integer> iter=columnBreaks.iterator();
  for (int i=0; i < arr.length; i++) {
    arr[i]=iter.next();
  }
  return arr;
}

Fixed version (ground truth):
@Override public int[] getColumnBreaks(){
  if (columnBreaks == null) {
    return new int[0];
  }
  int[] arr=new int[columnBreaks.size()];
  Iterator<Integer> iter=columnBreaks.iterator();
  for (int i=0; i < arr.length; i++) {
    arr[i]=iter.next();
  }
  return arr;
}
Program: 56500
Project: 56500
Buggy source:
@Override public int[] getRowBreaks(){
  if (rowBreaks == null) {
    return new int[0];
  }
  int[] arr=new int[]{rowBreaks.size()};
  Iterator<Integer> iter=rowBreaks.iterator();
  for (int i=0; i < arr.length; i++) {
    arr[i]=iter.next();
  }
  return arr;
}

Fixed version (ground truth):
@Override public int[] getRowBreaks(){
  if (rowBreaks == null) {
    return new int[0];
  }
  int[] arr=new int[rowBreaks.size()];
  Iterator<Integer> iter=rowBreaks.iterator();
  for (int i=0; i < arr.length; i++) {
    arr[i]=iter.next();
  }
  return arr;
}
Program: 56501
Project: 56501
Buggy source:
@Override public boolean isPrintGridlines(){
  return getNative().getPrintInfo().isPrintGridline();
}

Fixed version (ground truth):
@Override public boolean isPrintGridlines(){
  return getNative().getPrintSetup().isPrintGridline();
}
Program: 56502
Project: 56502
Buggy source:
public int getErrorCellValue(){
  ErrorValue errorValue=cell.getErrorValue();
switch (errorValue.getCode()) {
case ErrorValue.INVALID_FORMULA:
    return FormulaError.NA.getCode();
case ErrorValue.INVALID_NAME:
  return FormulaError.NAME.getCode();
case ErrorValue.INVALID_VALUE:
return FormulaError.VALUE.getCode();
default :
return FormulaError.VALUE.getCode();
}
}

Fixed version (ground truth):
public int getErrorCellValue(){
  ErrorValue errorValue=cell.getErrorValue();
switch (errorValue.getCode()) {
case ErrorValue.INVALID_FORMULA:
    return FormulaError.NA.getCode();
default :
  return errorValue.getCode();
}
}
Program: 56504
Project: 56504
Buggy source:
private XelContext getXelContextForResolving(FormulaEvaluationContext context,EvaluationWorkbook evalBook,WorkbookEvaluator evaluator){
  XelContext xelContext=xelContexts.get(evalBook);
  if (xelContext == null) {
    NFunctionResolver resolver=NFunctionResolverFactory.getFunctionResolver();
    UDFFinder zkUDFF=resolver.getUDFFinder();
    if (zkUDFF != null) {
      IndexedUDFFinder bookUDFF=(IndexedUDFFinder)evalBook.getUDFFinder();
      bookUDFF.insert(0,zkUDFF);
    }
    DependencyTracker tracker=resolver.getDependencyTracker();
    if (tracker != null) {
      evaluator.setDependencyTracker(tracker);
    }
    NJoinFunctionMapper functionMapper=new NJoinFunctionMapper(null);
    FunctionMapper extraFunctionMapper=context.getFunctionMapper();
    if (extraFunctionMapper != null) {
      functionMapper.addFunctionMapper(extraFunctionMapper);
    }
    FunctionMapper zssFuncMapper=resolver.getFunctionMapper();
    if (zssFuncMapper != null) {
      functionMapper.addFunctionMapper(zssFuncMapper);
    }
    NJoinVariableResolver variableResolver=new NJoinVariableResolver();
    VariableResolver extraVariableResolver=context.getVariableResolver();
    if (extraVariableResolver != null) {
      variableResolver.addVariableResolver(extraVariableResolver);
    }
    xelContext=new SimpleXelContext(variableResolver,functionMapper);
    xelContext.setAttribute("String_Node_Str",Object.class);
    xelContexts.put(evalBook,xelContext);
  }
  return xelContext;
}

Fixed version (ground truth):
private XelContext getXelContextForResolving(FormulaEvaluationContext context,EvaluationWorkbook evalBook,WorkbookEvaluator evaluator){
  XelContext xelContext=xelContexts.get(evalBook);
  if (xelContext == null) {
    NFunctionResolver resolver=NFunctionResolverFactory.getFunctionResolver();
    DependencyTracker tracker=resolver.getDependencyTracker();
    if (tracker != null) {
      evaluator.setDependencyTracker(tracker);
    }
    NJoinFunctionMapper functionMapper=new NJoinFunctionMapper(null);
    FunctionMapper extraFunctionMapper=context.getFunctionMapper();
    if (extraFunctionMapper != null) {
      functionMapper.addFunctionMapper(extraFunctionMapper);
    }
    FunctionMapper zssFuncMapper=resolver.getFunctionMapper();
    if (zssFuncMapper != null) {
      functionMapper.addFunctionMapper(zssFuncMapper);
    }
    NJoinVariableResolver variableResolver=new NJoinVariableResolver();
    VariableResolver extraVariableResolver=context.getVariableResolver();
    if (extraVariableResolver != null) {
      variableResolver.addVariableResolver(extraVariableResolver);
    }
    xelContext=new SimpleXelContext(variableResolver,functionMapper);
    xelContext.setAttribute("String_Node_Str",Object.class);
    xelContexts.put(evalBook,xelContext);
  }
  return xelContext;
}
Program: 56506
Project: 56506
Buggy source:
@Override public void export(NBook book,File file) throws IOException {
  OutputStream os=null;
  try {
    os=new FileOutputStream(file);
    export(book,os);
  }
  finally {
    if (os != null) {
      try {
        os.close();
      }
 catch (      Exception x) {
      }
    }
  }
}

Fixed version (ground truth):
@Override public void export(NBook book,File file) throws IOException {
  OutputStream os=null;
  try {
    os=new FileOutputStream(file);
    export(book,os);
  }
  finally {
    if (os != null) {
      try {
        os.close();
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
}
Program: 56507
Project: 56507
Buggy source:
protected void sheetNamedRangeTest(NBook book){
  assertEquals(2,book.getNumOfName());
  assertEquals("String_Node_Str",book.getNameByName("String_Node_Str","String_Node_Str").getRefersToFormula());
  assertEquals("String_Node_Str",book.getNameByName("String_Node_Str","String_Node_Str").getRefersToFormula());
}

Fixed version (ground truth):
protected void sheetNamedRangeTest(NBook book){
  assertEquals(2,book.getNumOfName());
  assertEquals("String_Node_Str",book.getNameByName("String_Node_Str").getRefersToFormula());
  assertEquals("String_Node_Str",book.getNameByName("String_Node_Str").getRefersToFormula());
}
Program: 56508
Project: 56508
Buggy source:
@BeforeClass static public void setupTestFile(){
  IMPORT_FILE_UNDER_TEST=ImporterTest.class.getResource("String_Node_Str");
  CHART_IMPORT_FILE_UNDER_TEST=ImporterTest.class.getResource("String_Node_Str");
}

Fixed version (ground truth):
@Before public void setupTestFile(){
  IMPORT_FILE_UNDER_TEST=ImporterTest.class.getResource("String_Node_Str");
  CHART_IMPORT_FILE_UNDER_TEST=ImporterTest.class.getResource("String_Node_Str");
}
Program: 56509
Project: 56509
Buggy source:
public int getEndCellIndex(int row){
  AbstractRowAdv rowObj=(AbstractRowAdv)getRow(row,false);
  if (rowObj != null) {
    return rowObj.getEndCellIndex();
  }
  return -1;
}

Fixed version (ground truth):
public int getEndCellIndex(int row){
  int idx1=-1;
  AbstractRowAdv rowObj=(AbstractRowAdv)getRow(row,false);
  if (rowObj != null) {
    idx1=rowObj.getEndCellIndex();
  }
  NDataGrid dg=getDataGrid();
  if (dg == null || !dg.isSupportedDataStartEndIndex()) {
    return idx1;
  }
 else {
    int idx2=dg.getEndCellIndex(row);
    if (idx1 < 0)     return idx2;
    if (idx2 < 0)     return idx1;
    return Math.max(idx1,idx2);
  }
}
Program: 56510
Project: 56510
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override public Iterator<NRow> getRowIterator(){
  NDataGrid dg=getDataGrid();
  if (dg != null && dg.supportDataIterator()) {
    return new JoinRowIterator(this,((Collection)rows.values()).iterator(),dg.getRowIterator());
  }
 else {
    return Collections.unmodifiableCollection((Collection)rows.values()).iterator();
  }
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override public Iterator<NRow> getRowIterator(){
  NDataGrid dg=getDataGrid();
  if (dg != null && dg.isSupportedDataIterator()) {
    return new JoinRowIterator(this,((Collection)rows.values()).iterator(),dg.getRowIterator());
  }
 else {
    return Collections.unmodifiableCollection((Collection)rows.values()).iterator();
  }
}
Program: 56511
Project: 56511
Buggy source:
public int getStartCellIndex(int row){
  AbstractRowAdv rowObj=(AbstractRowAdv)getRow(row,false);
  if (rowObj != null) {
    return rowObj.getStartCellIndex();
  }
  return -1;
}

Fixed version (ground truth):
public int getStartCellIndex(int row){
  int idx1=-1;
  AbstractRowAdv rowObj=(AbstractRowAdv)getRow(row,false);
  if (rowObj != null) {
    idx1=rowObj.getStartCellIndex();
  }
  NDataGrid dg=getDataGrid();
  if (dg == null || !dg.isSupportedDataStartEndIndex()) {
    return idx1;
  }
 else {
    int idx2=dg.getStartCellIndex(row);
    if (idx1 < 0)     return idx2;
    if (idx2 < 0)     return idx1;
    return Math.min(idx1,idx2);
  }
}
Program: 56512
Project: 56512
Buggy source:
public int getStartRowIndex(){
  return rows.firstKey();
}

Fixed version (ground truth):
public int getStartRowIndex(){
  int idx1=rows.firstKey();
  NDataGrid dg=getDataGrid();
  if (dg == null || !dg.isSupportedDataStartEndIndex()) {
    return idx1;
  }
 else {
    int idx2=dg.getStartRowIndex();
    if (idx1 < 0)     return idx2;
    if (idx2 < 0)     return idx1;
    return Math.min(idx1,idx2);
  }
}
Program: 56513
Project: 56513
Buggy source:
public void deleteRow(int rowIdx,int size){
  checkOrphan();
  if (size <= 0)   return;
  NDataGrid dg=getDataGrid();
  if (dg != null) {
    if (!dg.supportOperations()) {
      throw new InvalidateModelOpException("String_Node_Str");
    }
    dg.deleteRow(rowIdx,size);
  }
  for (  AbstractRowAdv row : rows.subValues(rowIdx,rowIdx + size)) {
    row.destroy();
  }
  rows.delete(rowIdx,size);
  shiftAfterRowDelete(rowIdx,size);
  book.sendModelInternalEvent(createModelInternalEvent(ModelInternalEvents.ON_ROW_DELETED,ModelInternalEvents.PARAM_ROW_INDEX,rowIdx,ModelInternalEvents.PARAM_SIZE,size));
}

Fixed version (ground truth):
public void deleteRow(int rowIdx,int size){
  checkOrphan();
  if (size <= 0)   return;
  NDataGrid dg=getDataGrid();
  if (dg != null) {
    if (!dg.isSupportedOperations()) {
      throw new InvalidateModelOpException("String_Node_Str");
    }
    dg.deleteRow(rowIdx,size);
  }
  for (  AbstractRowAdv row : rows.subValues(rowIdx,rowIdx + size)) {
    row.destroy();
  }
  rows.delete(rowIdx,size);
  shiftAfterRowDelete(rowIdx,size);
  book.sendModelInternalEvent(createModelInternalEvent(ModelInternalEvents.ON_ROW_DELETED,ModelInternalEvents.PARAM_ROW_INDEX,rowIdx,ModelInternalEvents.PARAM_SIZE,size));
}
Program: 56514
Project: 56514
Buggy source:
public void insertColumn(int columnIdx,int size){
  checkOrphan();
  if (size <= 0)   return;
  NDataGrid dg=getDataGrid();
  if (dg != null) {
    if (!dg.supportOperations()) {
      throw new InvalidateModelOpException("String_Node_Str");
    }
    dg.insertColumn(columnIdx,size);
  }
  insertAndSplitColumnArray(columnIdx,size);
  for (  AbstractRowAdv row : rows.values()) {
    row.insertCell(columnIdx,size);
  }
  shiftAfterColumnInsert(columnIdx,size);
  book.sendModelInternalEvent(createModelInternalEvent(ModelInternalEvents.ON_COLUMN_INSERTED,ModelInternalEvents.PARAM_COLUMN_INDEX,columnIdx,ModelInternalEvents.PARAM_SIZE,size));
}

Fixed version (ground truth):
public void insertColumn(int columnIdx,int size){
  checkOrphan();
  if (size <= 0)   return;
  NDataGrid dg=getDataGrid();
  if (dg != null) {
    if (!dg.isSupportedOperations()) {
      throw new InvalidateModelOpException("String_Node_Str");
    }
    dg.insertColumn(columnIdx,size);
  }
  insertAndSplitColumnArray(columnIdx,size);
  for (  AbstractRowAdv row : rows.values()) {
    row.insertCell(columnIdx,size);
  }
  shiftAfterColumnInsert(columnIdx,size);
  book.sendModelInternalEvent(createModelInternalEvent(ModelInternalEvents.ON_COLUMN_INSERTED,ModelInternalEvents.PARAM_COLUMN_INDEX,columnIdx,ModelInternalEvents.PARAM_SIZE,size));
}
Program: 56515
Project: 56515
Buggy source:
public int getEndRowIndex(){
  return rows.lastKey();
}

Fixed version (ground truth):
public int getEndRowIndex(){
  int idx1=rows.lastKey();
  NDataGrid dg=getDataGrid();
  if (dg == null || !dg.isSupportedDataStartEndIndex()) {
    return idx1;
  }
 else {
    int idx2=dg.getEndRowIndex();
    if (idx1 < 0)     return idx2;
    if (idx2 < 0)     return idx1;
    return Math.max(idx1,idx2);
  }
}
Program: 56516
Project: 56516
Buggy source:
public void insertRow(int rowIdx,int size){
  checkOrphan();
  if (size <= 0)   return;
  NDataGrid dg=getDataGrid();
  if (dg != null) {
    if (!dg.supportOperations()) {
      throw new InvalidateModelOpException("String_Node_Str");
    }
    dg.insertRow(rowIdx,size);
  }
  rows.insert(rowIdx,size);
  shiftAfterRowInsert(rowIdx,size);
  book.sendModelInternalEvent(createModelInternalEvent(ModelInternalEvents.ON_ROW_INSERTED,ModelInternalEvents.PARAM_ROW_INDEX,rowIdx,ModelInternalEvents.PARAM_SIZE,size));
}

Fixed version (ground truth):
public void insertRow(int rowIdx,int size){
  checkOrphan();
  if (size <= 0)   return;
  NDataGrid dg=getDataGrid();
  if (dg != null) {
    if (!dg.isSupportedOperations()) {
      throw new InvalidateModelOpException("String_Node_Str");
    }
    dg.insertRow(rowIdx,size);
  }
  rows.insert(rowIdx,size);
  shiftAfterRowInsert(rowIdx,size);
  book.sendModelInternalEvent(createModelInternalEvent(ModelInternalEvents.ON_ROW_INSERTED,ModelInternalEvents.PARAM_ROW_INDEX,rowIdx,ModelInternalEvents.PARAM_SIZE,size));
}
Program: 56517
Project: 56517
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override public Iterator<NCell> getCellIterator(int row){
  NDataGrid dg=getDataGrid();
  if (dg != null && dg.supportDataIterator()) {
    return new JoinCellIterator(this,row,(Iterator)((AbstractRowAdv)getRow(row)).getCellIterator(),dg.getCellIterator(row));
  }
 else {
    return (Iterator)((AbstractRowAdv)getRow(row)).getCellIterator();
  }
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override public Iterator<NCell> getCellIterator(int row){
  NDataGrid dg=getDataGrid();
  if (dg != null && dg.isSupportedDataIterator()) {
    return new JoinCellIterator(this,row,(Iterator)((AbstractRowAdv)getRow(row)).getCellIterator(),dg.getCellIterator(row));
  }
 else {
    return (Iterator)((AbstractRowAdv)getRow(row)).getCellIterator();
  }
}
Program: 56518
Project: 56518
Buggy source:
public void deleteColumn(int columnIdx,int size){
  checkOrphan();
  if (size <= 0)   return;
  NDataGrid dg=getDataGrid();
  if (dg != null) {
    if (!dg.supportOperations()) {
      throw new InvalidateModelOpException("String_Node_Str");
    }
    dg.deleteColumn(columnIdx,size);
  }
  deleteAndShrinkColumnArray(columnIdx,size);
  for (  AbstractRowAdv row : rows.values()) {
    row.deleteCell(columnIdx,size);
  }
  shiftAfterColumnDelete(columnIdx,size);
  book.sendModelInternalEvent(createModelInternalEvent(ModelInternalEvents.ON_COLUMN_DELETED,ModelInternalEvents.PARAM_COLUMN_INDEX,columnIdx,ModelInternalEvents.PARAM_SIZE,size));
}

Fixed version (ground truth):
public void deleteColumn(int columnIdx,int size){
  checkOrphan();
  if (size <= 0)   return;
  NDataGrid dg=getDataGrid();
  if (dg != null) {
    if (!dg.isSupportedOperations()) {
      throw new InvalidateModelOpException("String_Node_Str");
    }
    dg.deleteColumn(columnIdx,size);
  }
  deleteAndShrinkColumnArray(columnIdx,size);
  for (  AbstractRowAdv row : rows.values()) {
    row.deleteCell(columnIdx,size);
  }
  shiftAfterColumnDelete(columnIdx,size);
  book.sendModelInternalEvent(createModelInternalEvent(ModelInternalEvents.ON_COLUMN_DELETED,ModelInternalEvents.PARAM_COLUMN_INDEX,columnIdx,ModelInternalEvents.PARAM_SIZE,size));
}
Program: 56519
Project: 56519
Buggy source:
DataCellImpl getCell(int columnIdx,boolean create){
  DataCellImpl cellObj=cells.get(columnIdx);
  if (cellObj == null) {
    checkOrphan();
    cellObj=new DataCellImpl(this,columnIdx);
    cells.put(columnIdx,cellObj);
  }
  return cellObj;
}

Fixed version (ground truth):
DataCellImpl getCell(int columnIdx,boolean create){
  DataCellImpl cellObj=cells.get(columnIdx);
  if (cellObj == null && create) {
    checkOrphan();
    cellObj=new DataCellImpl(this,columnIdx);
    cells.put(columnIdx,cellObj);
  }
  return cellObj;
}
Program: 56520
Project: 56520
Buggy source:
DataRowImpl getRow(int rowIdx,boolean create){
  DataRowImpl rowObj=rows.get(rowIdx);
  if (rowObj == null) {
    rowObj=new DataRowImpl(this,rowIdx);
    rows.put(rowIdx,rowObj);
  }
  return rowObj;
}

Fixed version (ground truth):
DataRowImpl getRow(int rowIdx,boolean create){
  DataRowImpl rowObj=rows.get(rowIdx);
  if (rowObj == null && create) {
    rowObj=new DataRowImpl(this,rowIdx);
    rows.put(rowIdx,rowObj);
  }
  return rowObj;
}
Program: 56521
Project: 56521
Buggy source:
public static String getFontHTMLColor(Workbook book,Font font){
  if (font instanceof XSSFFont) {
    final XSSFFont f=(XSSFFont)font;
    final XSSFColor color=f.getXSSFColor();
    return BookHelper.colorToHTML(book,color);
  }
 else {
    final HSSFColor color=getHSSFFontColor((HSSFWorkbook)book,(HSSFFont)font);
    return BookHelper.colorToHTML(book,color);
  }
}

Fixed version (ground truth):
public static String getFontHTMLColor(Workbook book,Font font){
  String colorCode=null;
  if (font instanceof XSSFFont) {
    final XSSFFont f=(XSSFFont)font;
    final XSSFColor color=f.getXSSFColor();
    colorCode=BookHelper.colorToHTML(book,color);
  }
 else {
    final HSSFColor color=getHSSFFontColor((HSSFWorkbook)book,(HSSFFont)font);
    colorCode=BookHelper.colorToHTML(book,color);
  }
  if (AUTO_COLOR.equals(colorCode)) {
    colorCode="String_Node_Str";
  }
  return colorCode;
}