nus-yam/ex-repair huggingface dataset:
Program: 71867
Project: 71867
Buggy source:
public int[] getColumnWidths(){
  int length=columnCoordinates.size() - 1;
  int[] columnWidths=new int[length];
  for (int i=0; i < length - 1; i++) {
    columnWidths[i]=columnCoordinates.get(i + 1) - columnCoordinates.get(i);
  }
  return columnWidths;
}

Fixed version (ground truth):
public int[] getColumnWidths(){
  int length=columnCoordinates.size();
  int[] columnWidths=new int[length];
  for (int i=0; i < length - 1; i++) {
    columnWidths[i]=columnCoordinates.get(i + 1) - columnCoordinates.get(i);
  }
  return columnWidths;
}
Program: 71868
Project: 71868
Buggy source:
public Data(final Object txt,final StyleEntry s,final String datatype){
  this.txt=txt;
  this.style=s;
  this.datatype=datatype;
  id=ID++;
}

Fixed version (ground truth):
public Data(final Object txt,final StyleEntry s,final String datatype,XlsContainer container){
  this.txt=txt;
  this.style=s;
  this.datatype=datatype;
  id=ID++;
  this.container=container;
}
Program: 71869
Project: 71869
Buggy source:
/** 
 * Gets a subset of naxis.
 * @param start
 * @param end
 * @return
 */
public int[] getColumnCoordinatesInRange(int start,int end){
  int startColumnIndex=getColumnIndexByCoordinate(start);
  int endColumnIndex=getColumnIndexByCoordinate(end);
  List<Integer> list=columnCoordinates.subList(startColumnIndex,endColumnIndex + 1);
  Integer[] integerColumnCoordinates=new Integer[list.size()];
  integerColumnCoordinates=list.toArray(integerColumnCoordinates);
  int[] columnCoordinates=new int[integerColumnCoordinates.length];
  for (int i=0; i < columnCoordinates.length; i++) {
    columnCoordinates[i]=integerColumnCoordinates[i].intValue();
  }
  return columnCoordinates;
}

Fixed version (ground truth):
/** 
 * Gets a subset of naxis.
 * @param start
 * @param end
 * @return
 */
public int[] getColumnCoordinatesInRange(int start,int end){
  int startColumnIndex=getColumnIndexByCoordinate(start);
  int endColumnIndex=getColumnIndexByCoordinate(end);
  List<Integer> list=columnCoordinates.subList(startColumnIndex,endColumnIndex + 1);
  int length=list.size();
  int[] columnCoordinates=new int[length];
  for (int i=0; i <= length; i++) {
    columnCoordinates[i]=list.get(i);
  }
  return columnCoordinates;
}
Program: 71870
Project: 71870
Buggy source:
private void initalize(PageDef page){
  axis=new AxisProcessor();
  axis.addCoordinate(page.contentwidth);
  setCacheSize();
  ContainerSizeInfo rule=new ContainerSizeInfo(0,page.contentwidth);
  cache=new DataCache(MAX_COLUMN,MAX_ROW,emitter);
  engine=new StyleEngine(this);
  containers.push(createContainer(rule,page.style));
}

Fixed version (ground truth):
private void initalize(PageDef page){
  axis=new AxisProcessor();
  axis.addCoordinate(page.contentwidth);
  setCacheSize();
  ContainerSizeInfo rule=new ContainerSizeInfo(0,page.contentwidth);
  cache=new DataCache(MAX_COLUMN,MAX_ROW,emitter);
  engine=new StyleEngine(this);
  containers.push(createContainer(rule,page.style,null));
}
Program: 71871
Project: 71871
Buggy source:
private Data createDateData(Object txt,StyleEntry entry,String timeFormat){
  Locale locale=emitter.getLocale();
  timeFormat=ExcelUtil.parse(timeFormat,locale);
  if (timeFormat.equals("String_Node_Str")) {
    if (txt instanceof java.sql.Date) {
      timeFormat=DateTimeUtil.formatDateTime("String_Node_Str",locale);
    }
 else     if (txt instanceof java.sql.Time) {
      timeFormat=DateTimeUtil.formatDateTime("String_Node_Str",locale);
    }
 else {
      timeFormat=DateTimeUtil.formatDateTime("String_Node_Str",locale);
    }
  }
 else {
    timeFormat=DateTimeUtil.formatDateTime(timeFormat,locale);
  }
  entry.setProperty(StyleConstant.DATE_FORMAT_PROP,timeFormat);
  entry.setProperty(StyleConstant.DATA_TYPE_PROP,Data.DATE);
  return new Data(txt,entry,Data.DATE);
}

Fixed version (ground truth):
private Data createDateData(Object txt,StyleEntry entry,String timeFormat){
  Locale locale=emitter.getLocale();
  timeFormat=ExcelUtil.parse(timeFormat,locale);
  if (timeFormat.equals("String_Node_Str")) {
    if (txt instanceof java.sql.Date) {
      timeFormat=DateTimeUtil.formatDateTime("String_Node_Str",locale);
    }
 else     if (txt instanceof java.sql.Time) {
      timeFormat=DateTimeUtil.formatDateTime("String_Node_Str",locale);
    }
 else {
      timeFormat=DateTimeUtil.formatDateTime("String_Node_Str",locale);
    }
  }
 else {
    timeFormat=DateTimeUtil.formatDateTime(timeFormat,locale);
  }
  entry.setProperty(StyleConstant.DATE_FORMAT_PROP,timeFormat);
  entry.setProperty(StyleConstant.DATA_TYPE_PROP,Data.DATE);
  return new Data(txt,entry,Data.DATE,getCurrentContainer());
}
Program: 71872
Project: 71872
Buggy source:
public XlsContainer createContainer(ContainerSizeInfo sizeInfo,IStyle style){
  return new XlsContainer(engine.createEntry(sizeInfo,style),sizeInfo);
}

Fixed version (ground truth):
public XlsContainer createContainer(ContainerSizeInfo sizeInfo,IStyle style,XlsContainer parent){
  return new XlsContainer(engine.createEntry(sizeInfo,style),sizeInfo,parent);
}
Program: 71873
Project: 71873
Buggy source:
public void addRow(IStyle style){
  XlsTable table=(XlsTable)containers.peek();
  XlsContainer container=createContainer(table.getSizeInfo(),style);
  container.setEmpty(false);
  addContainer(container);
}

Fixed version (ground truth):
public void addRow(IStyle style){
  XlsTable table=(XlsTable)containers.peek();
  XlsContainer container=createContainer(table.getSizeInfo(),style,table);
  container.setEmpty(false);
  addContainer(container);
}
Program: 71874
Project: 71874
Buggy source:
public Data createData(Object txt,StyleEntry entry){
  String type=Data.STRING;
  if (Data.NUMBER.equals(ExcelUtil.getType(txt))) {
    String format=ExcelUtil.getPattern(txt,entry.getProperty(StyleConstant.NUMBER_FORMAT_PROP));
    entry.setProperty(StyleConstant.NUMBER_FORMAT_PROP,format);
    type=Data.NUMBER;
  }
 else   if (Data.DATE.equals(ExcelUtil.getType(txt))) {
    String format=ExcelUtil.getPattern(txt,entry.getProperty(StyleConstant.DATE_FORMAT_PROP));
    entry.setProperty(StyleConstant.DATE_FORMAT_PROP,format);
    type=Data.DATE;
  }
  entry.setProperty(StyleConstant.DATA_TYPE_PROP,type);
  return new Data(txt,entry,type);
}

Fixed version (ground truth):
public Data createData(Object txt,StyleEntry entry){
  String type=Data.STRING;
  if (Data.NUMBER.equals(ExcelUtil.getType(txt))) {
    String format=ExcelUtil.getPattern(txt,entry.getProperty(StyleConstant.NUMBER_FORMAT_PROP));
    entry.setProperty(StyleConstant.NUMBER_FORMAT_PROP,format);
    type=Data.NUMBER;
  }
 else   if (Data.DATE.equals(ExcelUtil.getType(txt))) {
    String format=ExcelUtil.getPattern(txt,entry.getProperty(StyleConstant.DATE_FORMAT_PROP));
    entry.setProperty(StyleConstant.DATE_FORMAT_PROP,format);
    type=Data.DATE;
  }
  entry.setProperty(StyleConstant.DATA_TYPE_PROP,type);
  return new Data(txt,entry,type,getCurrentContainer());
}
Program: 71875
Project: 71875
Buggy source:
public void endContainer(){
  XlsContainer container=getCurrentContainer();
  if (container.isEmpty()) {
    Data data=new Data(EMPTY,container.getStyle(),Data.STRING);
    data.setSizeInfo(container.getSizeInfo());
    addData(data);
  }
  engine.removeContainerStyle();
  containers.pop();
}

Fixed version (ground truth):
public void endContainer(){
  XlsContainer container=getCurrentContainer();
  if (container.isEmpty()) {
    Data data=new Data(EMPTY,container.getStyle(),Data.STRING,container);
    data.setSizeInfo(container.getSizeInfo());
    addData(data);
  }
  engine.removeContainerStyle();
  containers.pop();
}
Program: 71876
Project: 71876
Buggy source:
public void addTable(TableInfo table,IStyle style){
  ContainerSizeInfo parentSizeInfo=getCurrentContainer().getSizeInfo();
  int startCoordinate=parentSizeInfo.getStartCoordinate();
  int[] columnStartCoordinates=new int[table.getColumnCount() + 1];
  columnStartCoordinates[0]=startCoordinate;
  for (int i=1; i <= table.getColumnCount(); i++) {
    columnStartCoordinates[i]=columnStartCoordinates[i - 1] + table.getColumnWidth(i - 1);
  }
  int endCoordinate=parentSizeInfo.getEndCoordinate();
  int[] scale=axis.getColumnCoordinatesInRange(startCoordinate,endCoordinate);
  for (int i=0; i < scale.length - 1; i++) {
    int startPosition=scale[i];
    int endPostion=scale[i + 1];
    int[] range=inRange(startPosition,endPostion,columnStartCoordinates);
    if (range.length > 0) {
      int pos=axis.getColumnIndexByCoordinate(startPosition);
      cache.insertColumns(pos,range.length);
      for (int j=0; j < range.length; j++) {
        axis.addCoordinate(range[j]);
      }
    }
  }
  XlsContainer container=createContainer(parentSizeInfo,style);
  XlsTable tcontainer=new XlsTable(table,container);
  addContainer(tcontainer);
  tables.push(tcontainer);
}

Fixed version (ground truth):
public void addTable(TableInfo table,IStyle style){
  XlsContainer currentContainer=getCurrentContainer();
  ContainerSizeInfo parentSizeInfo=currentContainer.getSizeInfo();
  int startCoordinate=parentSizeInfo.getStartCoordinate();
  int endCoordinate=parentSizeInfo.getEndCoordinate();
  int[] columnStartCoordinates=calculateColumnCoordinates(table,startCoordinate,endCoordinate);
  splitColumns(startCoordinate,endCoordinate,columnStartCoordinates);
  createTable(table,style,currentContainer,columnStartCoordinates);
}
Program: 71877
Project: 71877
Buggy source:
public void addCell(int col,int span,IStyle style){
  XlsTable table=tables.peek();
  ContainerSizeInfo cellSizeInfo=table.getColumnSizeInfo(col,span);
  addContainer(createContainer(cellSizeInfo,style));
}

Fixed version (ground truth):
public void addCell(int col,int span,IStyle style){
  XlsTable table=tables.peek();
  ContainerSizeInfo cellSizeInfo=table.getColumnSizeInfo(col,span);
  addContainer(createContainer(cellSizeInfo,style,getCurrentContainer()));
}
Program: 71878
Project: 71878
Buggy source:
public void endRow(){
  synchronous();
  endContainer();
}

Fixed version (ground truth):
public void endRow(){
  synchronize();
  endContainer();
}
Program: 71879
Project: 71879
Buggy source:
private void addData(Data data){
  getCurrentContainer().setEmpty(false);
  int col=axis.getColumnIndexByCoordinate(data.getRule().getStartCoordinate());
  int span=axis.getColumnIndexByCoordinate(data.getRule().getEndCoordinate()) - col;
  addDatatoCache(col,data);
  for (int i=col + 1; i < col + span; i++) {
    addDatatoCache(i,Data.WASTE);
  }
}

Fixed version (ground truth):
private void addData(Data data){
  XlsContainer container=getCurrentContainer();
  container.setEmpty(false);
  int col=axis.getColumnIndexByCoordinate(data.getRule().getStartCoordinate());
  int span=axis.getColumnIndexByCoordinate(data.getRule().getEndCoordinate()) - col;
  addDatatoCache(col,data);
  for (int i=col + 1; i < col + span; i++) {
    addDatatoCache(i,Data.WASTE);
  }
}
Program: 71880
Project: 71880
Buggy source:
public static TableInfo createTable(ITableContent table,int width){
  width=getElementWidth(table,width);
  int colcount=table.getColumnCount();
  if (colcount == 0) {
    return null;
  }
  int[] index=new int[colcount];
  int know=0;
  List unmount=new ArrayList();
  for (int i=0; i < colcount; i++) {
    DimensionType value=table.getColumn(i).getWidth();
    if (value == null) {
      unmount.add(new Integer(i));
    }
 else {
      try {
        index[i]=ExcelUtil.covertDimensionType(value,width);
        know+=index[i];
      }
 catch (      IllegalArgumentException ex) {
        unmount.add(new Integer(i));
      }
    }
  }
  int left=width - know;
  if (left > 0 && unmount.size() == 0) {
    index[index.length - 1]=index[index.length - 1] + left;
    return new DefaultTableInfo(index);
  }
 else   if (left < 0) {
    return new DefaultTableInfo(split(width,colcount));
  }
 else   if (left > 0 && unmount.size() > 0) {
    int[] size=split(left,unmount.size());
    Iterator iter=unmount.iterator();
    int i=0;
    while (iter.hasNext()) {
      int pos=((Integer)iter.next()).intValue();
      index[pos]=size[i];
      i++;
    }
    return new DefaultTableInfo(index);
  }
 else {
    return new DefaultTableInfo(index);
  }
}

Fixed version (ground truth):
public static TableInfo createTable(ITableContent table,int width){
  width=getElementWidth(table,width);
  int colcount=table.getColumnCount();
  if (colcount == 0) {
    return null;
  }
  int[] index=new int[colcount];
  int know=0;
  List unmount=new ArrayList();
  for (int i=0; i < colcount; i++) {
    DimensionType value=table.getColumn(i).getWidth();
    if (value == null) {
      unmount.add(new Integer(i));
    }
 else {
      try {
        index[i]=ExcelUtil.covertDimensionType(value,width);
        know+=index[i];
      }
 catch (      IllegalArgumentException ex) {
        unmount.add(new Integer(i));
      }
    }
  }
  int left=width - know;
  if (left > 0 && unmount.size() == 0) {
    index[index.length - 1]=index[index.length - 1] + left;
    return new DefaultTableInfo(index);
  }
 else   if (left > 0 && unmount.size() > 0) {
    int[] size=split(left,unmount.size());
    Iterator iter=unmount.iterator();
    int i=0;
    while (iter.hasNext()) {
      int pos=((Integer)iter.next()).intValue();
      index[pos]=size[i];
      i++;
    }
    return new DefaultTableInfo(index);
  }
 else {
    return new DefaultTableInfo(index);
  }
}
Program: 71881
Project: 71881
Buggy source:
public XlsContainer(StyleEntry style,ContainerSizeInfo sizeInfo){
  this.style=style;
  this.sizeInfo=sizeInfo;
  empty=true;
}

Fixed version (ground truth):
public XlsContainer(StyleEntry style,ContainerSizeInfo sizeInfo,XlsContainer parent){
  this.style=style;
  this.sizeInfo=sizeInfo;
  this.parent=parent;
  empty=true;
}
Program: 71882
Project: 71882
Buggy source:
private int getParameterType(int i) throws OdaException {
  if (parameterDefn.getParameterType(i) != Types.CHAR)   return parameterDefn.getParameterType(i);
  IParameterMetaData paramMetaData=getParameterMetaData();
  if (paramMetaData != null && paramMetaData.getParameterCount() >= i)   return paramMetaData.getParameterType(i);
 else   return parameterDefn.getParameterType(i);
}

Fixed version (ground truth):
private int getParameterType(int i) throws OdaException {
  if (parameterDefn.getParameterType(i) != Types.CHAR)   return parameterDefn.getParameterType(i);
  try {
    IParameterMetaData paramMetaData=getParameterMetaData();
    if (paramMetaData != null && paramMetaData.getParameterCount() >= i)     return paramMetaData.getParameterType(i);
 else     return parameterDefn.getParameterType(i);
  }
 catch (  OdaException ex) {
    return parameterDefn.getParameterType(i);
  }
}
Program: 71883
Project: 71883
Buggy source:
/** 
 * Specifies the name of the primary result set.
 * @param resultSetName
 */
public void setPrimaryResultSetName(String resultSetName){
  primaryResultSetName=resultSetName;
}

Fixed version (ground truth):
/** 
 * Specifies the name of the primary result set.
 * @param resultSetName
 */
public void setPrimaryResultSetName(String resultSetName){
  primaryResultSetName=resultSetName == null ? null : (resultSetName.trim().length() == 0 ? null : resultSetName);
}
Program: 71884
Project: 71884
Buggy source:
public IParameterDefn[] getParameterDefn(){
  return new IParameterDefn[]{new ParameterDefn(Constants.EXPRESSION_NAME,Constants.EXPRESSION_DISPLAY_NAME,false,true,SupportedDataTypes.CALCULATABLE,"String_Node_Str"),new ParameterDefn("String_Node_Str",Messages.getString("String_Node_Str"),true,false,SupportedDataTypes.CALCULATABLE,"String_Node_Str")};
}

Fixed version (ground truth):
public IParameterDefn[] getParameterDefn(){
  return new IParameterDefn[]{new ParameterDefn(Constants.EXPRESSION_NAME,Constants.EXPRESSION_DISPLAY_NAME,false,true,SupportedDataTypes.CALCULATABLE,"String_Node_Str"),new ParameterDefn("String_Node_Str",Messages.getString("String_Node_Str"),false,false,SupportedDataTypes.CALCULATABLE,"String_Node_Str")};
}
Program: 71886
Project: 71886
Buggy source:
/** 
 * Get the evaluated result by the ScriptExpression
 * @param aggrIndex
 * @param aggrInfo
 * @param i
 * @throws DataException
 */
private void evaluateArgsValue(int aggrIndex,IAggrInfo aggrInfo,int i) throws DataException {
  IBaseExpression argExpr=aggrInfo.getArgument()[i];
  checkExpression(aggrInfo,argExpr);
  try {
    aggrArgs[aggrIndex][i]=ExprEvaluateUtil.evaluateValue(argExpr,this.populator.getCache().getCurrentIndex(),this.populator.getCache().getCurrentResult(),this.populator.getQuery().getExprProcessor().getScope());
  }
 catch (  BirtException e) {
    throw DataException.wrap(e);
  }
}

Fixed version (ground truth):
/** 
 * Get the evaluated result by the ScriptExpression
 * @param aggrIndex
 * @param aggrInfo
 * @param i
 * @throws DataException
 */
private void evaluateArgsValue(int aggrIndex,IAggrInfo aggrInfo,int i) throws DataException {
  if (i >= aggrInfo.getArgument().length) {
    return;
  }
  IBaseExpression argExpr=aggrInfo.getArgument()[i];
  checkExpression(aggrInfo,argExpr);
  try {
    aggrArgs[aggrIndex][i]=ExprEvaluateUtil.evaluateValue(argExpr,this.populator.getCache().getCurrentIndex(),this.populator.getCache().getCurrentResult(),this.populator.getQuery().getExprProcessor().getScope());
  }
 catch (  BirtException e) {
    throw DataException.wrap(e);
  }
}
Program: 71887
Project: 71887
Buggy source:
/** 
 * It is not going to get the coordinate, but the colId relative to this coordinate. Gets the colId of the given coordinate point
 * @param value	 the coordinate point
 * @return the colId
 */
public int getColumnIndexByCoordinate(int value){
  int index=columnCoordinates.indexOf(new Integer(value));
  return (index == -1) ? 0 : index;
}

Fixed version (ground truth):
/** 
 * It is not going to get the coordinate, but the colId relative to this coordinate. Gets the colId of the given coordinate point
 * @param value	 the coordinate point
 * @return the colId
 */
public int getColumnIndexByCoordinate(int value){
  int index=columnCoordinates.indexOf(value);
  return (index == -1) ? 0 : index;
}
Program: 71888
Project: 71888
Buggy source:
/** 
 * Gets a subset of naxis.
 * @param start
 * @param end
 * @return
 */
public int[] getColumnCoordinatesInRange(int start,int end){
  int startColumnIndex=getColumnIndexByCoordinate(start);
  int endColumnIndex=getColumnIndexByCoordinate(end);
  List<Integer> list=columnCoordinates.subList(startColumnIndex,endColumnIndex + 1);
  int length=list.size();
  int[] columnCoordinates=new int[length];
  for (int i=0; i <= length; i++) {
    columnCoordinates[i]=list.get(i);
  }
  return columnCoordinates;
}

Fixed version (ground truth):
/** 
 * Gets a subset of naxis.
 * @param start
 * @param end
 * @return
 */
public int[] getColumnCoordinatesInRange(int start,int end){
  int startColumnIndex=getColumnIndexByCoordinate(start);
  int endColumnIndex=getColumnIndexByCoordinate(end);
  List<Integer> list=columnCoordinates.subList(startColumnIndex,endColumnIndex + 1);
  int length=list.size();
  int[] columnCoordinates=new int[length];
  for (int i=0; i < length; i++) {
    columnCoordinates[i]=list.get(i);
  }
  return columnCoordinates;
}
Program: 71889
Project: 71889
Buggy source:
public void addDateTime(Object txt,IStyle style,HyperlinkDef link,BookmarkDef bookmark){
  ContainerSizeInfo rule=getCurrentContainer().getSizeInfo();
  StyleEntry entry=engine.getStyle(style,rule);
  Data data=null;
  IDataContent dataContent=(IDataContent)txt;
  Object value=dataContent.getValue();
  Date date=ExcelUtil.getDate(value);
  if (date != null && date.getYear() >= 0) {
    data=createDateData(value,entry,style.getDateTimeFormat());
    data.setHyperlinkDef(link);
    data.setBookmark(bookmark);
    data.setSizeInfo(rule);
    addData(data);
  }
 else {
    addData(dataContent.getText(),style,link,bookmark);
  }
}

Fixed version (ground truth):
public void addDateTime(Object txt,IStyle style,HyperlinkDef link,BookmarkDef bookmark){
  ContainerSizeInfo rule=getCurrentContainer().getSizeInfo();
  StyleEntry entry=engine.getStyle(style,rule);
  Data data=null;
  IDataContent dataContent=(IDataContent)txt;
  Object value=dataContent.getValue();
  Date date=ExcelUtil.getDate(value);
  if (date != null && ((date instanceof Time) || date.getYear() >= 0)) {
    data=createDateData(value,entry,style.getDateTimeFormat());
    data.setHyperlinkDef(link);
    data.setBookmark(bookmark);
    data.setSizeInfo(rule);
    addData(data);
  }
 else {
    addData(dataContent.getText(),style,link,bookmark);
  }
}
Program: 71890
Project: 71890
Buggy source:
public static void addParameterSortBy(QueryDefinition queryDefn,ScalarParameterHandle parameter){
  String sortBy=parameter.getSortByColumn();
  if (sortBy != null) {
    SortDefinition sort=new SortDefinition();
    sort.setColumn(sortBy);
    boolean direction="String_Node_Str".equalsIgnoreCase(parameter.getSortDirection());
    sort.setSortDirection(direction ? ISortDefinition.SORT_ASC : ISortDefinition.SORT_DESC);
    queryDefn.addSort(sort);
  }
}

Fixed version (ground truth):
public static void addParameterSortBy(QueryDefinition queryDefn,ScalarParameterHandle parameter){
  String sortBy=parameter.getSortByColumn();
  if (sortBy != null) {
    SortDefinition sort=new SortDefinition();
    sort.setExpression(sortBy);
    boolean direction="String_Node_Str".equalsIgnoreCase(parameter.getSortDirection());
    sort.setSortDirection(direction ? ISortDefinition.SORT_ASC : ISortDefinition.SORT_DESC);
    queryDefn.addSort(sort);
  }
}
Program: 71891
Project: 71891
Buggy source:
/** 
 * Get current preview browser.
 * @param forceExternal forece using external browser or not
 * @return browser instance
 */
public static synchronized IBrowser getPreviewBrowser(boolean forceExternal){
  if (!forceExternal && BrowserManager.getInstance().isEmbeddedBrowserPresent()) {
    if (internalBrowser == null) {
      internalBrowser=BrowserManager.getInstance().createBrowser(false);
    }
    return internalBrowser;
  }
  if (browser == null) {
    browser=BrowserManager.getInstance().createBrowser(true);
  }
  return browser;
}

Fixed version (ground truth):
/** 
 * Get current preview browser.
 * @param forceExternal forece using external browser or not
 * @return browser instance
 */
public static synchronized IBrowser getPreviewBrowser(boolean forceExternal){
  if (!forceExternal && BrowserManager.getInstance().isEmbeddedBrowserPresent()) {
    if (internalBrowser == null) {
      internalBrowser=BrowserManager.getInstance().createBrowser(false);
    }
    return internalBrowser;
  }
  if (browser == null) {
    browser=new ExternalWorkbenchBrowser();
  }
  if (browser == null) {
    browser=BrowserManager.getInstance().createBrowser(true);
  }
  return browser;
}
Program: 71892
Project: 71892
Buggy source:
public static void display(String webappName,String report,Map params){
  startWebApp(webappName);
  try {
    BrowserAccessor.getPreviewBrowser(false).displayURL(createURL(webappName,report,params) + "String_Node_Str" + new Random().nextInt());
  }
 catch (  Exception e) {
    LogUtil.logError(e.getLocalizedMessage(),e);
  }
}

Fixed version (ground truth):
public static void display(String webappName,String report,Map params){
  startWebApp(webappName);
  try {
    boolean useExternal=ViewerPlugin.getDefault().getPluginPreferences().getBoolean(BrowserManager.ALWAYS_EXTERNAL_BROWSER_KEY);
    BrowserAccessor.getPreviewBrowser(useExternal).displayURL(createURL(webappName,report,params) + "String_Node_Str" + new Random().nextInt());
  }
 catch (  Exception e) {
    LogUtil.logError(e.getLocalizedMessage(),e);
  }
}
Program: 71893
Project: 71893
Buggy source:
public void render() throws Exception {
  setupRenderOption();
  IContentEmitter emitter=createContentEmitter();
  String format=executionContext.getOutputFormat();
  IReportExecutor executor=new ReportletExecutor(executionContext,offset);
  executor=new SuppressDuplciateReportExecutor(executor);
  executor=new LocalizedReportExecutor(executionContext,executor);
  executionContext.setExecutor(executor);
  initializeContentEmitter(emitter,executor);
  IReportLayoutEngine layoutEngine=createReportLayoutEngine(pagination,renderOptions);
  layoutEngine.setLocale(executionContext.getLocale());
  if (ExtensionManager.PAPER_SIZE_PAGINATION.equals(pagination)) {
    OnPageBreakLayoutPageHandle handle=new OnPageBreakLayoutPageHandle(executionContext);
    layoutEngine.setPageHandler(handle);
    CompositeContentEmitter outputEmitters=new CompositeContentEmitter(format);
    outputEmitters.addEmitter(new PDFLayoutEmitter(executor,emitter,renderOptions,executionContext.getLocale(),getTotalPage()));
    outputEmitters.addEmitter(handle.getEmitter());
    emitter=outputEmitters;
  }
  startRender();
  IReportContent report=executor.execute();
  emitter.start(report);
  layoutEngine.layout(executor,report,emitter,false);
  layoutEngine.close();
  emitter.end(report);
  closeRender();
  executor.close();
  outputPageCount=layoutEngine.getPageCount();
}

Fixed version (ground truth):
public void render() throws Exception {
  setupRenderOption();
  IContentEmitter emitter=createContentEmitter();
  String format=executionContext.getOutputFormat();
  IReportExecutor executor=new ReportletExecutor(executionContext,offset);
  executor=new SuppressDuplciateReportExecutor(executor);
  executor=new LocalizedReportExecutor(executionContext,executor);
  executionContext.setExecutor(executor);
  initializeContentEmitter(emitter,executor);
  IReportLayoutEngine layoutEngine=createReportLayoutEngine(pagination,renderOptions);
  layoutEngine.setLocale(executionContext.getLocale());
  if (ExtensionManager.PAPER_SIZE_PAGINATION.equals(pagination)) {
    OnPageBreakLayoutPageHandle handle=new OnPageBreakLayoutPageHandle(executionContext);
    layoutEngine.setPageHandler(handle);
    CompositeContentEmitter outputEmitters=new CompositeContentEmitter(format);
    outputEmitters.addEmitter(new PDFLayoutEmitterProxy(executor,emitter,renderOptions,executionContext.getLocale(),getTotalPage()));
    outputEmitters.addEmitter(handle.getEmitter());
    emitter=outputEmitters;
  }
  startRender();
  IReportContent report=executor.execute();
  emitter.start(report);
  layoutEngine.layout(executor,report,emitter,false);
  layoutEngine.close();
  emitter.end(report);
  closeRender();
  executor.close();
  outputPageCount=layoutEngine.getPageCount();
}
Program: 71895
Project: 71895
Buggy source:
/** 
 * constructor
 * @param item the table deign
 */
public TableContentWrapper(ITableContent content,List columns){
  super(content);
  this.tableContent=content;
  this.columns=columns;
}

Fixed version (ground truth):
public TableContentWrapper(TableContentWrapper content){
  super(content);
  this.tableContent=content;
  this.columns=content.columns;
}
Program: 71896
Project: 71896
Buggy source:
protected void repeatHeader(){
  if (!isFirstLayout) {
    IGroupContent group=(IGroupContent)content;
    IBandContent header=group.getHeader();
    if (group.isHeaderRepeat() && header != null) {
      boolean pageBreak=context.allowPageBreak();
      context.setAllowPageBreak(false);
      IPageBuffer buffer=context.getPageBufferManager();
      boolean isRepeated=buffer.isRepeated();
      buffer.setRepeated(true);
      engine.layout(this,header,emitter);
      buffer.setRepeated(isRepeated);
      context.setAllowPageBreak(pageBreak);
    }
  }
  isFirstLayout=false;
}

Fixed version (ground truth):
protected void repeatHeader(){
  if (!isFirstLayout) {
    IGroupContent group=(IGroupContent)content;
    IBandContent header=group.getHeader();
    if (group.isHeaderRepeat() && header != null && !isHeaderBand()) {
      boolean pageBreak=context.allowPageBreak();
      context.setAllowPageBreak(false);
      IPageBuffer buffer=context.getPageBufferManager();
      boolean isRepeated=buffer.isRepeated();
      buffer.setRepeated(true);
      engine.layout(this,header,emitter);
      buffer.setRepeated(isRepeated);
      context.setAllowPageBreak(pageBreak);
    }
  }
  isFirstLayout=false;
}
Program: 71897
Project: 71897
Buggy source:
public void setEmitter(PDFLayoutEmitter emitter){
  this.emitter=emitter;
}

Fixed version (ground truth):
public void setEmitter(LayoutEmitterAdapter emitter){
  this.emitter=emitter;
}
Program: 71898
Project: 71898
Buggy source:
public void run(){
  TreeViewer treeViewer=getTreeViewer();
  boolean needSelect=false;
  refreshRoot();
  for (  String path : paths) {
    File file=new File(path);
    if (!file.exists()) {
      continue;
    }
    needSelect=true;
    String parent=file.getParent();
    List<String> folders=new ArrayList<String>();
    while (parent != null) {
      folders.add(parent);
      parent=new File(parent).getParent();
    }
    for (int i=folders.size() - 1; i >= 0; i--) {
      treeViewer.expandToLevel(folders.get(i),1);
    }
  }
  if (needSelect) {
    treeViewer.setSelection(new StructuredSelection(paths));
    treeViewer.reveal(paths[0]);
  }
}

Fixed version (ground truth):
public void run(){
  TreeViewer treeViewer=getTreeViewer();
  boolean needSelect=false;
  if (forceRefresh) {
    refreshRoot();
  }
  for (  String path : paths) {
    File file=new File(path);
    if (!file.exists()) {
      continue;
    }
    needSelect=true;
    String parent=file.getParent();
    List<String> folders=new ArrayList<String>();
    while (parent != null) {
      folders.add(parent);
      parent=new File(parent).getParent();
    }
    for (int i=folders.size() - 1; i >= 0; i--) {
      treeViewer.expandToLevel(folders.get(i),1);
    }
  }
  if (needSelect) {
    treeViewer.setSelection(new StructuredSelection(paths));
    treeViewer.reveal(paths[0]);
  }
}
Program: 71899
Project: 71899
Buggy source:
/** 
 * Sets selections for the specified tree viewer and optionally makes it visible.
 * @param treeViewer the specified tree viewer to select.
 * @param paths the specified paths to select.
 */
public void selectPath(final String[] paths){
  if (paths == null || paths.length <= 0) {
    return;
  }
  Display display=getSite().getShell().getDisplay();
  display.asyncExec(new Runnable(){
    public void run(){
      TreeViewer treeViewer=getTreeViewer();
      boolean needSelect=false;
      refreshRoot();
      for (      String path : paths) {
        File file=new File(path);
        if (!file.exists()) {
          continue;
        }
        needSelect=true;
        String parent=file.getParent();
        List<String> folders=new ArrayList<String>();
        while (parent != null) {
          folders.add(parent);
          parent=new File(parent).getParent();
        }
        for (int i=folders.size() - 1; i >= 0; i--) {
          treeViewer.expandToLevel(folders.get(i),1);
        }
      }
      if (needSelect) {
        treeViewer.setSelection(new StructuredSelection(paths));
        treeViewer.reveal(paths[0]);
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Sets selections for the specified tree viewer and optionally makes it visible.
 * @param treeViewer the specified tree viewer to select.
 * @param paths the specified paths to select.
 */
public void selectPath(final String[] paths,final boolean forceRefresh){
  if (paths == null || paths.length <= 0) {
    return;
  }
  Display display=getSite().getShell().getDisplay();
  display.asyncExec(new Runnable(){
    public void run(){
      TreeViewer treeViewer=getTreeViewer();
      boolean needSelect=false;
      if (forceRefresh) {
        refreshRoot();
      }
      for (      String path : paths) {
        File file=new File(path);
        if (!file.exists()) {
          continue;
        }
        needSelect=true;
        String parent=file.getParent();
        List<String> folders=new ArrayList<String>();
        while (parent != null) {
          folders.add(parent);
          parent=new File(parent).getParent();
        }
        for (int i=folders.size() - 1; i >= 0; i--) {
          treeViewer.expandToLevel(folders.get(i),1);
        }
      }
      if (needSelect) {
        treeViewer.setSelection(new StructuredSelection(paths));
        treeViewer.reveal(paths[0]);
      }
    }
  }
);
}
Program: 71900
Project: 71900
Buggy source:
public void resourceChanged(ModuleHandle module,ResourceChangeEvent event){
  if (isDisposed()) {
    return;
  }
  String path=event.getChangedResourcePath();
  if (path == null) {
    refreshRoot();
  }
 else {
    selectPath(new String[]{path});
  }
}

Fixed version (ground truth):
public void resourceChanged(ModuleHandle module,ResourceChangeEvent event){
  if (isDisposed()) {
    return;
  }
  String path=event.getChangedResourcePath();
  if (path != null) {
    File file=new File(path);
    String resourcePath=ReportPlugin.getDefault().getResourceFolder();
    File resource=new File(resourcePath);
    if (file.exists() && resource.exists() && file.toURI().toString().indexOf(resource.toURI().toString()) > -1) {
      refreshRoot();
    }
  }
}
Program: 71901
Project: 71901
Buggy source:
/** 
 * Handles an open event from the viewer. Opens an editor on the selected library.
 * @param event the open event
 * @throws IOException if an I/O error occurs.
 */
protected void handleOpen(OpenEvent event) throws IOException {
  IStructuredSelection selection=(IStructuredSelection)event.getSelection();
  Object element=selection.getFirstElement();
  if (element instanceof ResourceEntryWrapper && ((ResourceEntryWrapper)element).isFile()) {
switch (((ResourceEntryWrapper)element).getType()) {
case ResourceEntryWrapper.LIBRARY:
      File file=null;
    URL url=((ResourceEntryWrapper)element).getURL();
  if (((ResourceEntryWrapper)element).getEntry() instanceof FragmentResourceEntry) {
    file=ResourceAction.convertToFile(Platform.getBundle(IResourceLocator.FRAGMENT_RESOURCE_HOST).getEntry(url.getPath()));
  }
 else {
    file=ResourceAction.convertToFile(url);
  }
if (file != null && file.exists() && file.isFile()) {
  ResourceAction.openLibrary(this,file);
}
 else {
  if (MessageDialog.openConfirm(getSite().getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"))) {
    refreshRoot();
  }
}
break;
case ResourceEntryWrapper.CSS_STYLE_SHEET:
default :
break;
}
}
}

Fixed version (ground truth):
/** 
 * Handles an open event from the viewer. Opens an editor on the selected library.
 * @param event the open event
 * @throws IOException if an I/O error occurs.
 */
protected void handleOpen(OpenEvent event) throws IOException {
  IStructuredSelection selection=(IStructuredSelection)event.getSelection();
  Object element=selection.getFirstElement();
  if (element instanceof ResourceEntryWrapper && ((ResourceEntryWrapper)element).isFile()) {
switch (((ResourceEntryWrapper)element).getType()) {
case ResourceEntryWrapper.LIBRARY:
      File file=null;
    URL url=((ResourceEntryWrapper)element).getURL();
  if (((ResourceEntryWrapper)element).getEntry() instanceof FragmentResourceEntry) {
    file=ResourceAction.convertToFile(Platform.getBundle(IResourceLocator.FRAGMENT_RESOURCE_HOST).getEntry(url.getPath()));
  }
 else {
    file=ResourceAction.convertToFile(url);
  }
if (file != null && file.exists() && file.isFile()) {
  ResourceAction.openLibrary(this,file,false);
}
 else {
  if (MessageDialog.openConfirm(getSite().getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"))) {
    refreshRoot();
  }
}
break;
case ResourceEntryWrapper.CSS_STYLE_SHEET:
default :
break;
}
}
}
Program: 71902
Project: 71902
Buggy source:
/** 
 * Finishes the work.
 * @param libraryName the library's file name.
 * @param templateName the library template's file name.
 * @param monitor the progress monitor to use to display progress and receive requests for cancelation.
 * @throws DesignFileException If the library template is not found, or it contains fatal errors.
 * @throws SemanticException if the value of a property is incorrect.
 * @throws IOException if the file cannot be saved.
 */
private void doFinish(final String libraryName,String templateName,IProgressMonitor monitor) throws DesignFileException, SemanticException, IOException {
  monitor.beginTask(null,IProgressMonitor.UNKNOWN);
  try {
    makeLibrary(libraryName,templateName);
    openLibrary(new File(libraryName));
    fireResourceChanged(libraryName);
  }
  finally {
    monitor.done();
  }
}

Fixed version (ground truth):
/** 
 * Finishes the work.
 * @param libraryName the library's file name.
 * @param templateName the library template's file name.
 * @param monitor the progress monitor to use to display progress and receive requests for cancelation.
 * @throws DesignFileException If the library template is not found, or it contains fatal errors.
 * @throws SemanticException if the value of a property is incorrect.
 * @throws IOException if the file cannot be saved.
 */
private void doFinish(final String libraryName,String templateName,IProgressMonitor monitor) throws DesignFileException, SemanticException, IOException {
  monitor.beginTask(null,IProgressMonitor.UNKNOWN);
  try {
    makeLibrary(libraryName,templateName);
    openLibrary(new File(libraryName),true);
  }
  finally {
    monitor.done();
  }
}
Program: 71903
Project: 71903
Buggy source:
public synchronized final void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  monitor.beginTask(null,IProgressMonitor.UNKNOWN);
  try {
    if (srcFile != null && targetFile != null && srcFile.exists() && !targetFile.exists()) {
      if (renameFile(srcFile,targetFile)) {
        fireResourceChanged(targetFile.getAbsolutePath());
        refreshWorkspace(srcFile.getAbsolutePath());
      }
    }
  }
  finally {
    monitor.done();
  }
}

Fixed version (ground truth):
public synchronized final void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  monitor.beginTask(null,IProgressMonitor.UNKNOWN);
  try {
    if (srcFile != null && targetFile != null && srcFile.exists() && !targetFile.exists()) {
      if (renameFile(srcFile,targetFile)) {
        fireResourceChanged(targetFile.getAbsolutePath());
        fireResourceChanged(srcFile.getAbsolutePath());
      }
    }
  }
  finally {
    monitor.done();
  }
}
Program: 71904
Project: 71904
Buggy source:
/** 
 * Notifies model for the reource chang.
 * @param fileName the resource's file name.
 */
protected void fireResourceChanged(String fileName){
  SessionHandleAdapter.getInstance().getSessionHandle().fireResourceChange(new LibraryChangeEvent(fileName));
  refreshWorkspace(fileName);
}

Fixed version (ground truth):
/** 
 * Notifies model for the reource chang.
 * @param fileName the resource's file name.
 */
protected void fireResourceChanged(String fileName){
  IReportResourceSynchronizer synchronizer=ReportPlugin.getDefault().getResourceSynchronizerService();
  if (synchronizer != null) {
    synchronizer.notifyResourceChanged(new ReportResourceChangeEvent(viewerPage,Path.fromOSString(fileName),IReportResourceChangeEvent.NewResource));
  }
}
Program: 71905
Project: 71905
Buggy source:
/** 
 * Opens an editor on the specified library file, and refresh the specified library explorer page.
 * @param viewer the library explorer page
 * @param file the specified library to open.
 */
public static void openLibrary(final LibraryExplorerTreeViewPage viewer,final File file){
  if (file == null || !file.exists() || !file.isFile()) {
    return;
  }
  Display display;
  if (viewer != null) {
    display=viewer.getSite().getShell().getDisplay();
  }
 else {
    display=Display.getCurrent();
  }
  display.asyncExec(new Runnable(){
    public void run(){
      try {
        IWorkbench workbench=PlatformUI.getWorkbench();
        IWorkbenchWindow window=workbench == null ? null : workbench.getActiveWorkbenchWindow();
        IWorkbenchPage page=window == null ? null : window.getActivePage();
        if (page != null) {
          IEditorInput input=null;
          Object adapter=Platform.getAdapterManager().getAdapter(viewer,IPathEditorInputFactory.class);
          if (adapter instanceof IPathEditorInputFactory) {
            input=((IPathEditorInputFactory)adapter).create(new Path(file.getAbsolutePath()));
          }
          if (input == null) {
            input=new ReportEditorInput(file);
          }
          page.openEditor(input,IReportEditorContants.LIBRARY_EDITOR_ID,true);
        }
      }
 catch (      PartInitException e) {
        ExceptionHandler.handle(e);
      }
 finally {
        viewer.selectPath(new String[]{file.getAbsolutePath()});
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Opens an editor on the specified library file, and refresh the specified library explorer page.
 * @param viewer the library explorer page
 * @param file the specified library to open.
 */
public static void openLibrary(final LibraryExplorerTreeViewPage viewer,final File file,final boolean forceRefresh){
  if (file == null || !file.exists() || !file.isFile()) {
    return;
  }
  Display display;
  if (viewer != null) {
    display=viewer.getSite().getShell().getDisplay();
  }
 else {
    display=Display.getCurrent();
  }
  display.asyncExec(new Runnable(){
    public void run(){
      try {
        IWorkbench workbench=PlatformUI.getWorkbench();
        IWorkbenchWindow window=workbench == null ? null : workbench.getActiveWorkbenchWindow();
        IWorkbenchPage page=window == null ? null : window.getActivePage();
        if (page != null) {
          IEditorInput input=null;
          Object adapter=Platform.getAdapterManager().getAdapter(viewer,IPathEditorInputFactory.class);
          if (adapter instanceof IPathEditorInputFactory) {
            input=((IPathEditorInputFactory)adapter).create(new Path(file.getAbsolutePath()));
          }
          if (input == null) {
            input=new ReportEditorInput(file);
          }
          page.openEditor(input,IReportEditorContants.LIBRARY_EDITOR_ID,true);
        }
      }
 catch (      PartInitException e) {
        ExceptionHandler.handle(e);
      }
 finally {
        viewer.selectPath(new String[]{file.getAbsolutePath()},forceRefresh);
      }
    }
  }
);
}
Program: 71906
Project: 71906
Buggy source:
/** 
 * Creates an instance of <copy>IRunnableWithProgress</copy> for renaming the specified source file to the specified target file.
 * @param srcFile the specified source file.
 * @param targetFile the specified target file.
 * @return the instance of <code>IRunnableWithProgress</code>.
 */
protected IRunnableWithProgress createRenameFileRunnable(final File srcFile,final File targetFile){
  return new IRunnableWithProgress(){
    public synchronized final void run(    IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
      monitor.beginTask(null,IProgressMonitor.UNKNOWN);
      try {
        if (srcFile != null && targetFile != null && srcFile.exists() && !targetFile.exists()) {
          if (renameFile(srcFile,targetFile)) {
            fireResourceChanged(targetFile.getAbsolutePath());
            refreshWorkspace(srcFile.getAbsolutePath());
          }
        }
      }
  finally {
        monitor.done();
      }
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Creates an instance of <copy>IRunnableWithProgress</copy> for renaming the specified source file to the specified target file.
 * @param srcFile the specified source file.
 * @param targetFile the specified target file.
 * @return the instance of <code>IRunnableWithProgress</code>.
 */
protected IRunnableWithProgress createRenameFileRunnable(final File srcFile,final File targetFile){
  return new IRunnableWithProgress(){
    public synchronized final void run(    IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
      monitor.beginTask(null,IProgressMonitor.UNKNOWN);
      try {
        if (srcFile != null && targetFile != null && srcFile.exists() && !targetFile.exists()) {
          if (renameFile(srcFile,targetFile)) {
            fireResourceChanged(targetFile.getAbsolutePath());
            fireResourceChanged(srcFile.getAbsolutePath());
          }
        }
      }
  finally {
        monitor.done();
      }
    }
  }
;
}
Program: 71907
Project: 71907
Buggy source:
/** 
 * @param context
 * @param format
 * @param emitterId
 * @return
 */
public static String getExportFilename(IContext context,String format,String emitterId){
  IFilenameGenerator gen=ParameterAccessor.getFilenameGenerator();
  Map options=ParameterAccessor.makeFilenameGeneratorOptions(context);
  EmitterInfo emitterInfo=ParameterAccessor.getEmitterInfo(emitterId);
  if (emitterInfo != null) {
    options.put(IFilenameGenerator.OPTIONS_EMITTER_INFO,emitterInfo);
  }
  String extensionName=ParameterAccessor.getExtensionName(format);
  if (extensionName != null) {
    options.put(IFilenameGenerator.OPTIONS_TARGET_FILE_EXTENSION,extensionName);
  }
  String baseName=(String)options.get(IFilenameGenerator.OPTIONS_REPORT_DESIGN);
  if (baseName == null || baseName.length() == 0) {
    baseName=(String)options.get(IFilenameGenerator.OPTIONS_REPORT_DOCUMENT);
  }
  baseName=stripFileExtension(baseName);
  return gen.getFilename(baseName,extensionName,IFilenameGenerator.OUTPUT_TYPE_EXPORT,options);
}

Fixed version (ground truth):
/** 
 * @param context
 * @param format
 * @param emitterId
 * @return
 */
public static String getExportFilename(IContext context,String format,String emitterId){
  IFilenameGenerator gen=ParameterAccessor.getFilenameGenerator();
  Map options=ParameterAccessor.makeFilenameGeneratorOptions(context);
  if (emitterId != null) {
    EmitterInfo emitterInfo=ParameterAccessor.getEmitterInfo(emitterId);
    if (emitterInfo != null) {
      options.put(IFilenameGenerator.OPTIONS_EMITTER_INFO,emitterInfo);
    }
  }
  String extensionName=ParameterAccessor.getExtensionName(format);
  if (extensionName != null) {
    options.put(IFilenameGenerator.OPTIONS_TARGET_FILE_EXTENSION,extensionName);
  }
  String baseName=(String)options.get(IFilenameGenerator.OPTIONS_REPORT_DESIGN);
  if (baseName == null || baseName.length() == 0) {
    baseName=(String)options.get(IFilenameGenerator.OPTIONS_REPORT_DOCUMENT);
  }
  baseName=stripFileExtension(baseName);
  return gen.getFilename(baseName,extensionName,IFilenameGenerator.OUTPUT_TYPE_EXPORT,options);
}
Program: 71908
Project: 71908
Buggy source:
public void writeDataFormat(StyleEntry style){
  if (style.getProperty(StyleConstant.DATA_TYPE_PROP) == Data.DATE && style.getProperty(StyleConstant.DATE_FORMAT_PROP) != null) {
    writer.openTag("String_Node_Str");
    writer.attribute("String_Node_Str",style.getProperty(StyleConstant.DATE_FORMAT_PROP));
    writer.closeTag("String_Node_Str");
  }
  if (style.getProperty(StyleConstant.DATA_TYPE_PROP) == Data.NUMBER && style.getProperty(StyleConstant.NUMBER_FORMAT_PROP) != null) {
    writer.openTag("String_Node_Str");
    String numberStyle=style.getProperty(StyleConstant.NUMBER_FORMAT_PROP);
    numberStyle=format(numberStyle);
    writer.attribute("String_Node_Str",numberStyle);
    writer.closeTag("String_Node_Str");
  }
}

Fixed version (ground truth):
public void writeDataFormat(StyleEntry style){
  if (style.getProperty(StyleConstant.DATA_TYPE_PROP) == Data.DATE && style.getProperty(StyleConstant.DATE_FORMAT_PROP) != null) {
    writer.openTag("String_Node_Str");
    writer.attribute("String_Node_Str",style.getProperty(StyleConstant.DATE_FORMAT_PROP));
    writer.closeTag("String_Node_Str");
  }
  if (style.getProperty(StyleConstant.DATA_TYPE_PROP) == Data.NUMBER && style.getProperty(StyleConstant.NUMBER_FORMAT_PROP) != null) {
    writer.openTag("String_Node_Str");
    String numberStyle=style.getProperty(StyleConstant.NUMBER_FORMAT_PROP);
    numberStyle=ExcelUtil.formatNumberPattern(numberStyle);
    writer.attribute("String_Node_Str",numberStyle);
    writer.closeTag("String_Node_Str");
  }
}
Program: 71909
Project: 71909
Buggy source:
/** 
 * Returns appropriate expressions if current has aggregations defined in chart.
 * @param helper
 * @param isSharingQuery
 * @return
 */
public List getExpressions(GroupingLookupHelper helper,boolean isSharingQuery){
  if (isSharingQuery) {
    return helper.getExpressions();
  }
  return helper.getExpressionsForAggregate();
}

Fixed version (ground truth):
/** 
 * Returns appropriate expressions if current has aggregations defined in chart.
 * @param helper
 * @param isSharingQuery
 * @return expressions list
 */
public List<String> getExpressions(GroupingLookupHelper helper,boolean isSharingQuery){
  if (isSharingQuery) {
    return helper.getExpressions();
  }
  return helper.getExpressionsForAggregate();
}