nus-yam/ex-repair huggingface dataset:
Program: 68296
Project: 68296
Buggy source:
private void createExpressionButton(Composite composite,final Text property,String propName){
  ExpressionButton exprButton=ExpressionButtonUtil.createExpressionButton(composite,property,new ExpressionProvider(handle),handle,true,SWT.PUSH);
  if (PASSWORD.equals(propName)) {
    exprButton.setExpressionButtonProvider(new ExprButtonProvider(true,property));
  }
  Expression expr=handle.getPropertyBindingExpression(propName);
  property.setData(ExpressionButtonUtil.EXPR_TYPE,expr == null || expr.getType() == null ? UIUtil.getDefaultScriptType() : (String)expr.getType());
  property.setText((expr == null || expr.getStringExpression() == null) ? "String_Node_Str" : expr.getStringExpression());
  exprButton.refresh();
}

Fixed version (ground truth):
private void createExpressionButton(Composite composite,final Text property,String propName){
  ExpressionButton exprButton=ExpressionButtonUtil.createExpressionButton(composite,property,new ExpressionProvider(handle),handle,true,SWT.PUSH);
  if (ODAPASSWORD.equals(propName) || PASSWORD.equals(propName)) {
    exprButton.setExpressionButtonProvider(new ExprButtonProvider(true,property));
  }
  Expression expr=handle.getPropertyBindingExpression(propName);
  property.setData(ExpressionButtonUtil.EXPR_TYPE,expr == null || expr.getType() == null ? UIUtil.getDefaultScriptType() : (String)expr.getType());
  property.setText((expr == null || expr.getStringExpression() == null) ? "String_Node_Str" : expr.getStringExpression());
  exprButton.refresh();
}
Program: 68298
Project: 68298
Buggy source:
public void handleEvent(Event event){
  TreeItem item=(TreeItem)event.item;
  if (event.item.getData() instanceof CssStyleSheetHandle || event.item.getData() instanceof CssSharedStyleHandle) {
    Color gray=Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GRAY);
    if (!item.getForeground().equals(gray)) {
      item.setForeground(gray);
    }
  }
 else {
    INodeProvider provider=ProviderFactory.createProvider(event.item.getData());
    if (provider != null && provider.isReadOnly(event.item.getData())) {
      Color gray=Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GRAY);
      if (!item.getForeground().equals(gray)) {
        item.setForeground(gray);
      }
    }
 else {
      Color black=ReportColorConstants.ReportForeground;
      if (!item.getForeground().equals(black)) {
        item.setForeground(black);
      }
    }
  }
}

Fixed version (ground truth):
public void handleEvent(Event event){
  TreeItem item=(TreeItem)event.item;
  if (event.item.getData() instanceof CssStyleSheetHandle || event.item.getData() instanceof CssSharedStyleHandle) {
    Color gray=Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GRAY);
    if (!item.getForeground().equals(gray)) {
      item.setForeground(gray);
    }
  }
 else {
    INodeProvider provider=null;
    if (event.item != null && event.item.getData() != null) {
      provider=ProviderFactory.createProvider(event.item.getData());
    }
    if (provider != null && provider.isReadOnly(event.item.getData())) {
      Color gray=Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GRAY);
      if (!item.getForeground().equals(gray)) {
        item.setForeground(gray);
      }
    }
 else {
      Color black=ReportColorConstants.ReportForeground;
      if (!item.getForeground().equals(black)) {
        item.setForeground(black);
      }
    }
  }
}
Program: 68303
Project: 68303
Buggy source:
/** 
 * Check it should set cube into query session.
 * @param cube
 * @return
 */
private boolean needDefineCube(CubeHandle cube){
  return cubeReference != cube;
}

Fixed version (ground truth):
/** 
 * Check it should set cube into query session.
 * @param cube
 * @return
 */
private boolean needDefineCube(CubeHandle cube){
  return dataSetReference != cube;
}
Program: 68304
Project: 68304
Buggy source:
public void setAppContext(Map appContext){
  this.appContext=appContext;
}

Fixed version (ground truth):
public void setAppContext(Map appContext){
  this.appContext.clear();
  if (appContext != null) {
    this.appContext.putAll(appContext);
  }
}
Program: 68305
Project: 68305
Buggy source:
/** 
 */
private void updateDataTypeCombo(){
  final IAggrFunction aggrFunc=getSelectedFunction();
  if (aggrFunc != null) {
    String dataType=DataAdapterUtil.adapterToModelDataType(aggrFunc.getDataType());
    Integer index=(Integer)cmbDataType.getData(dataType);
    cmbDataType.select(index != null ? index.intValue() : 0);
  }
}

Fixed version (ground truth):
/** 
 */
private void updateDataTypeCombo(){
  final IAggrFunction aggrFunc=getSelectedFunction();
  if (aggrFunc != null) {
    String dataType=DataAdapterUtil.adapterToModelDataType(aggrFunc.getDataType());
    cmbDataType.setText(getTypeDisplayName(dataType));
  }
}
Program: 68306
Project: 68306
Buggy source:
public ExcelEmitterDescriptor(Locale locale){
  this.locale=locale;
  initOptions();
}

Fixed version (ground truth):
public ExcelEmitterDescriptor(){
  initOptions();
}
Program: 68307
Project: 68307
Buggy source:
public HTMLEmitterDescriptor(Locale locale){
  this.locale=locale;
}

Fixed version (ground truth):
public HTMLEmitterDescriptor(){
}
Program: 68308
Project: 68308
Buggy source:
public PDFEmitterDescriptor(Locale locale){
  this.locale=locale;
  initOptions();
}

Fixed version (ground truth):
public PDFEmitterDescriptor(){
  initOptions();
}
Program: 68309
Project: 68309
Buggy source:
public PostscriptEmitterDescriptor(Locale locale){
  this.locale=locale;
  initOptions();
}

Fixed version (ground truth):
public PostscriptEmitterDescriptor(){
  initOptions();
}
Program: 68310
Project: 68310
Buggy source:
public PPTEmitterDescriptor(Locale locale){
  this.locale=locale;
  initOptions();
}

Fixed version (ground truth):
public PPTEmitterDescriptor(){
  initOptions();
}
Program: 68311
Project: 68311
Buggy source:
public WordEmitterDescriptor(Locale locale){
  this.locale=locale;
  initOptions();
}

Fixed version (ground truth):
public WordEmitterDescriptor(){
  initOptions();
}
Program: 68312
Project: 68312
Buggy source:
private void addContent(IContent content){
  if (!bufferAllContents) {
    ReportItemDesign design=getGenerateDesign(content);
    if (design != null) {
      if (design.getOnPageBreak() != null) {
        if (!contents.contains(content)) {
          contents.add(content);
        }
      }
    }
  }
 else {
    if (!contents.contains(content)) {
      contents.add(content);
    }
  }
}

Fixed version (ground truth):
private void addContent(IContent content){
  if (!bufferAllContents) {
    ReportItemDesign design=getGenerateDesign(content);
    if (design != null) {
      if (design.getOnPageBreak() != null || design.getClass() != null) {
        if (!contents.contains(content)) {
          contents.add(content);
        }
      }
    }
  }
 else {
    if (!contents.contains(content)) {
      contents.add(content);
    }
  }
}
Program: 68314
Project: 68314
Buggy source:
/** 
 * Populate all dimensions.
 * @param cubeMaterializer
 * @param dimHandles
 * @param stopSign
 * @return
 * @throws AdapterException 
 * @throws IOException
 * @throws BirtException
 * @throws DataException
 */
private IDimension[] populateDimensions(CubeMaterializer cubeMaterializer,TabularCubeHandle cubeHandle,Map appContext,Map<ReportElementHandle,QueryDefinition> queryMap,Map<ReportElementHandle,List<ColumnMeta>> metaMap) throws AdapterException {
  List dimHandles=cubeHandle.getContents(CubeHandle.DIMENSIONS_PROP);
  List result=new ArrayList();
  for (int i=0; i < dimHandles.size(); i++) {
    result.add(populateDimension(cubeMaterializer,(DimensionHandle)dimHandles.get(i),cubeHandle,appContext,queryMap,metaMap));
  }
  IDimension[] dimArray=new IDimension[dimHandles.size()];
  for (int i=0; i < result.size(); i++) {
    dimArray[i]=(IDimension)result.get(i);
  }
  return dimArray;
}

Fixed version (ground truth):
/** 
 * Populate all dimensions.
 * @param cubeMaterializer
 * @param dimHandles
 * @param stopSign
 * @return
 * @throws AdapterException 
 * @throws IOException
 * @throws BirtException
 * @throws DataException
 */
private IDimension[] populateDimensions(CubeMaterializer cubeMaterializer,TabularCubeHandle cubeHandle,Map appContext,Map<ReportElementHandle,QueryDefinition> queryMap,Map<ReportElementHandle,List<ColumnMeta>> metaMap,SecurityListener sl) throws AdapterException {
  List dimHandles=cubeHandle.getContents(CubeHandle.DIMENSIONS_PROP);
  List result=new ArrayList();
  for (int i=0; i < dimHandles.size(); i++) {
    result.add(populateDimension(cubeMaterializer,(DimensionHandle)dimHandles.get(i),cubeHandle,appContext,queryMap,metaMap,sl));
  }
  IDimension[] dimArray=new IDimension[dimHandles.size()];
  for (int i=0; i < result.size(); i++) {
    dimArray[i]=(IDimension)result.get(i);
  }
  return dimArray;
}
Program: 68316
Project: 68316
Buggy source:
public void process(TabularCubeHandle o1,Object o2){
}

Fixed version (ground truth):
public void process(DimensionHandle dimHandle,IDatasetIterator iterator) throws BirtException {
}
Program: 68317
Project: 68317
Buggy source:
public void start(){
}

Fixed version (ground truth):
public void start(TabularCubeHandle cubeHandle) throws BirtException {
}
Program: 68318
Project: 68318
Buggy source:
public void end(){
}

Fixed version (ground truth):
public void end() throws BirtException {
}
Program: 68319
Project: 68319
Buggy source:
public Object getLevelAttribute(int levelIndex,int attributeIndex){
  return metaResultSet.getLevelAttribute(levelIndex,attributeIndex);
}

Fixed version (ground truth):
public Object getLevelAttribute(int levelIndex,int attributeIndex){
  if (resultObject.getLevelMembers() == null || levelIndex < 0 || levelIndex > resultObject.getLevelMembers().length - 1) {
    return null;
  }
  return resultObject.getLevelMembers()[levelIndex].getAttributes()[attributeIndex];
}
Program: 68321
Project: 68321
Buggy source:
/** 
 * API test on IReportEngine.createGetParameterDefinitionTask( ) method
 */
public void testCreateGetParameterDefinitionTask(){
  try {
    ReportEngine engine=new ReportEngine(new EngineConfig());
    IReportRunnable runnable=engine.openReportDesign(REPORT_DESIGN);
    IGetParameterDefinitionTask paramDefnTask=engine.createGetParameterDefinitionTask(runnable);
    IParameterDefnBase paramDefn=paramDefnTask.getParameterDefn("String_Node_Str");
    assertTrue(paramDefn instanceof ScalarParameterDefn);
    assertTrue(IScalarParameterDefn.TEXT_BOX == paramDefn.getParameterType());
    assertTrue("String_Node_Str".equals(paramDefnTask.getDefaultValue(paramDefn)));
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    fail();
  }
}

Fixed version (ground truth):
/** 
 * API test on IReportEngine.createGetParameterDefinitionTask( ) method
 */
public void testCreateGetParameterDefinitionTask(){
  try {
    ReportEngine engine=new ReportEngine(new EngineConfig());
    IReportRunnable runnable=engine.openReportDesign(REPORT_DESIGN);
    IGetParameterDefinitionTask paramDefnTask=engine.createGetParameterDefinitionTask(runnable);
    IParameterDefnBase paramDefn=paramDefnTask.getParameterDefn("String_Node_Str");
    assertTrue(paramDefn instanceof ScalarParameterDefn);
    assertTrue(IScalarParameterDefn.TEXT_BOX == paramDefn.getParameterType());
    assertTrue("String_Node_Str".equals(paramDefnTask.getDefaultValue(paramDefn)));
    ScalarParameterDefn scalarParameter=(ScalarParameterDefn)paramDefn;
    Map userProperties=scalarParameter.getUserPropertyValues();
    assertEquals(2,userProperties.size());
    assertEquals(5,userProperties.get("String_Node_Str"));
    assertEquals("String_Node_Str",userProperties.get("String_Node_Str"));
    assertEquals(5,scalarParameter.getUserPropertyValue("String_Node_Str"));
    assertEquals("String_Node_Str",scalarParameter.getUserPropertyValue("String_Node_Str"));
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    fail();
  }
}
Program: 68323
Project: 68323
Buggy source:
protected ImageArea createImageArea(IImageContent content){
  ImageArea area=new ImageArea();
  String mimeType=content.getMIMEType();
  String extension=content.getExtension();
  area.setExtension(extension);
  area.setMIMEType(mimeType);
switch (content.getImageSource()) {
case IImageContent.IMAGE_FILE:
case IImageContent.IMAGE_URL:
    area.setUrl(content.getURI());
  break;
case IImageContent.IMAGE_NAME:
area.setUrl("String_Node_Str" + content.getURI());
break;
case IImageContent.IMAGE_EXPRESSION:
break;
}
if (SvgFile.isSvg(mimeType,null,extension) && imageObject != null) {
area.setMIMEType("String_Node_Str");
area.setExtension("String_Node_Str");
area.setData(imageObject.rawData());
}
 else {
area.setMIMEType("String_Node_Str");
area.setExtension("String_Node_Str");
area.setData(content.getData());
}
if (content instanceof ObjectContent) {
ObjectContent object=(ObjectContent)content;
area.setParameters(object.getParamters());
}
area.setAction(content.getHyperlinkAction());
return area;
}

Fixed version (ground truth):
protected ImageArea createImageArea(IImageContent content){
  ImageArea area=new ImageArea();
  String mimeType=content.getMIMEType();
  String extension=content.getExtension();
  area.setExtension(extension);
  area.setMIMEType(mimeType);
switch (content.getImageSource()) {
case IImageContent.IMAGE_FILE:
case IImageContent.IMAGE_URL:
    area.setUrl(content.getURI());
  break;
case IImageContent.IMAGE_NAME:
area.setUrl("String_Node_Str" + content.getURI());
break;
case IImageContent.IMAGE_EXPRESSION:
break;
}
if (SvgFile.isSvg(mimeType,null,extension)) {
if (imageObject != null) {
area.setMIMEType("String_Node_Str");
area.setExtension("String_Node_Str");
area.setData(imageObject.rawData());
}
 else {
area.setMIMEType("String_Node_Str");
area.setExtension("String_Node_Str");
area.setData(content.getData());
}
}
 else {
area.setData(content.getData());
}
if (content instanceof ObjectContent) {
ObjectContent object=(ObjectContent)content;
area.setParameters(object.getParamters());
}
area.setAction(content.getHyperlinkAction());
return area;
}
Program: 68324
Project: 68324
Buggy source:
/** 
 * populate the name prefix of cached file
 */
private void setFileNamePrefix(){
  this.fileNamePrefix="String_Node_Str" + new Long(System.currentTimeMillis()).toString() + "String_Node_Str"+ Integer.toHexString(hashCode());
}

Fixed version (ground truth):
/** 
 * populate the name prefix of cached file
 */
private void setFileNamePrefix(){
  this.fileNamePrefix="String_Node_Str" + new Long(System.nanoTime()).toString() + "String_Node_Str"+ getID()+ "String_Node_Str"+ Integer.toHexString(hashCode());
}
Program: 68325
Project: 68325
Buggy source:
protected void addEmptyData(SheetData data,XlsContainer container){
  int parentStartCoordinate=container.getSizeInfo().getStartCoordinate();
  int parentEndCoordinate=container.getSizeInfo().getEndCoordinate();
  int childStartCoordinate=data.getStartX();
  int childEndCoordinate=data.getEndX();
  if (childEndCoordinate < parentEndCoordinate) {
    StyleEntry style=container.getStyle();
    removeLeftBorder(style);
    int column=axis.getColumnIndexByCoordinate(childEndCoordinate);
    Data empty=createEmptyData(style);
    empty.setStartX(childEndCoordinate);
    empty.setEndX(parentEndCoordinate);
    empty.setRowIndex(data.getRowIndex());
    addDatatoCache(column,empty);
  }
  if (childStartCoordinate > parentStartCoordinate) {
    StyleEntry style=container.getStyle();
    removeRightBorder(style);
    int column=axis.getColumnIndexByCoordinate(childStartCoordinate);
    Data empty=createEmptyData(style);
    empty.setStartX(childStartCoordinate);
    empty.setEndX(parentEndCoordinate);
    empty.setRowIndex(data.getRowIndex());
    addDatatoCache(column,empty);
  }
}

Fixed version (ground truth):
protected void addEmptyData(SheetData data,XlsContainer container){
  int parentStartCoordinate=container.getSizeInfo().getStartCoordinate();
  int parentEndCoordinate=container.getSizeInfo().getEndCoordinate();
  int childStartCoordinate=data.getStartX();
  int childEndCoordinate=data.getEndX();
  if (childEndCoordinate < parentEndCoordinate) {
    StyleEntry style=container.getStyle();
    removeLeftBorder(style);
    int column=axis.getColumnIndexByCoordinate(childEndCoordinate);
    int num=axis.getColumnIndexByCoordinate(parentEndCoordinate) - column - 1;
    Data empty=createEmptyData(style);
    empty.setStartX(childEndCoordinate);
    empty.setEndX(parentEndCoordinate);
    empty.setRowIndex(data.getRowIndex());
    addDatatoCache(column,empty);
    addBlankData(column,num,empty);
  }
  if (childStartCoordinate > parentStartCoordinate) {
    StyleEntry style=container.getStyle();
    removeRightBorder(style);
    int column=axis.getColumnIndexByCoordinate(childStartCoordinate);
    int num=column - axis.getColumnIndexByCoordinate(parentStartCoordinate) - 1;
    Data empty=createEmptyData(style);
    empty.setStartX(childStartCoordinate);
    empty.setEndX(parentEndCoordinate);
    empty.setRowIndex(data.getRowIndex());
    addDatatoCache(column,empty);
    addBlankData(column - num - 1,num,empty);
  }
}
Program: 68326
Project: 68326
Buggy source:
public boolean exist(String documentObjectName){
  return archiveReader.exists(documentObjectName);
}

Fixed version (ground truth):
public boolean exist(String documentObjectName){
  if (archiveReader == null)   return false;
  return archiveReader.exists(documentObjectName);
}
Program: 68327
Project: 68327
Buggy source:
public IDocumentObject openDocumentObject(String documentObjectName) throws IOException {
  RAInputStream inputStream=archiveReader.getStream(documentObjectName);
  if (inputStream == null)   return null;
  return new DocumentObject(new RandomDataAccessObject(new RAReader(inputStream)));
}

Fixed version (ground truth):
public IDocumentObject openDocumentObject(String documentObjectName) throws IOException {
  if (archiveReader == null)   return null;
  RAInputStream inputStream=archiveReader.getStream(documentObjectName);
  if (inputStream == null)   return null;
  return new DocumentObject(new RandomDataAccessObject(new RAReader(inputStream)));
}
Program: 68328
Project: 68328
Buggy source:
/** 
 * Clean up the execution context before finishing using it
 */
public void close(){
  if (extendedItemManager != null) {
    extendedItemManager.close();
    extendedItemManager=null;
  }
  if (engineExtensionManager != null) {
    engineExtensionManager.close();
    engineExtensionManager=null;
  }
  if (scriptContext != null) {
    scriptContext.close();
    scriptContext=null;
  }
  if (dataSource != null) {
    try {
      dataSource.close();
    }
 catch (    IOException e) {
      log.log(Level.SEVERE,"String_Node_Str",e);
    }
    dataSource=null;
  }
  if (dataEngine != null) {
    dataEngine.shutdown();
    dataEngine=null;
  }
  if (closeClassLoader && applicationClassLoader instanceof ApplicationClassLoader) {
    ((ApplicationClassLoader)applicationClassLoader).close();
  }
  IStatusHandler handler=task.getStatusHandler();
  if (handler != null) {
    handler.finish();
  }
  applicationClassLoader=null;
  engine=null;
  task=null;
  executor=null;
  tocBuilder=null;
  runnable=null;
  originalRunnable=null;
  configs=null;
  params=null;
  persistentBeans=null;
  transientBeans=null;
  pageVariables=null;
  docWriter=null;
  reportIR=null;
  appContext=null;
  reportContext=null;
  renderOption=null;
  reportDoc=null;
  reportContent=null;
  design=null;
  content=null;
  rsets=null;
  reportHandles=null;
  onPrepareErrors=null;
  stringFormatters=null;
  numberFormatters=null;
  dateFormatters=null;
  pageBreakListeners=null;
  eventHandlerManager=null;
  progressMonitor=null;
  element=null;
}

Fixed version (ground truth):
/** 
 * Clean up the execution context before finishing using it
 */
public void close(){
  if (extendedItemManager != null) {
    extendedItemManager.close();
    extendedItemManager=null;
  }
  if (engineExtensionManager != null) {
    engineExtensionManager.close();
    engineExtensionManager=null;
  }
  if (scriptContext != null) {
    scriptContext.close();
    scriptContext=null;
  }
  if (dataSource != null) {
    try {
      dataSource.close();
    }
 catch (    IOException e) {
      log.log(Level.SEVERE,"String_Node_Str",e);
    }
    dataSource=null;
  }
  if (dataEngine != null) {
    dataEngine.shutdown();
    dataEngine=null;
  }
  if (closeClassLoader && applicationClassLoader instanceof ApplicationClassLoader) {
    ((ApplicationClassLoader)applicationClassLoader).close();
  }
  IStatusHandler handler=task.getStatusHandler();
  if (handler != null) {
    handler.finish();
  }
  applicationClassLoader=null;
  engine=null;
  executor=null;
  tocBuilder=null;
  configs=null;
  params=null;
  persistentBeans=null;
  transientBeans=null;
  pageVariables=null;
  docWriter=null;
  reportIR=null;
  appContext=null;
  reportContext=null;
  renderOption=null;
  reportDoc=null;
  reportContent=null;
  design=null;
  content=null;
  rsets=null;
  reportHandles=null;
  onPrepareErrors=null;
  stringFormatters=null;
  numberFormatters=null;
  dateFormatters=null;
  pageBreakListeners=null;
  eventHandlerManager=null;
  progressMonitor=null;
  element=null;
}
Program: 68329
Project: 68329
Buggy source:
private Expression createUserProperty(DesignElementHandle handle,UserPropertyDefn userDef){
  String propName=userDef.getName();
  String valueExpr=handle.getStringProperty(propName);
switch (userDef.getTypeCode()) {
case IPropertyType.SCRIPT_TYPE:
case IPropertyType.EXPRESSION_TYPE:
    ExpressionHandle property=handle.getExpressionProperty(propName);
  if (property == null) {
    return null;
  }
Object expression=property.getExpression();
if (expression == null) {
expression=userDef.getDefault();
}
if (expression instanceof org.eclipse.birt.report.model.api.Expression) {
return createExpression((org.eclipse.birt.report.model.api.Expression)expression);
}
return null;
case IPropertyType.NUMBER_TYPE:
case IPropertyType.INTEGER_TYPE:
case IPropertyType.FLOAT_TYPE:
return createConstant(DataType.DOUBLE_TYPE,valueExpr);
case IPropertyType.BOOLEAN_TYPE:
return createConstant(DataType.BOOLEAN_TYPE,valueExpr);
case IPropertyType.DATE_TIME_TYPE:
return createConstant(DataType.DATE_TYPE,valueExpr);
default :
return createConstant(DataType.STRING_TYPE,valueExpr);
}
}

Fixed version (ground truth):
private Expression createUserProperty(DesignElementHandle handle,UserPropertyDefn userDef){
  String propName=userDef.getName();
  String valueExpr=handle.getStringProperty(propName);
switch (userDef.getTypeCode()) {
case IPropertyType.SCRIPT_TYPE:
case IPropertyType.EXPRESSION_TYPE:
    ExpressionHandle property=handle.getExpressionProperty(propName);
  if (property == null) {
    return null;
  }
Object expression=property.getValue();
if (expression == null) {
expression=userDef.getDefault();
}
if (expression instanceof org.eclipse.birt.report.model.api.Expression) {
return createExpression((org.eclipse.birt.report.model.api.Expression)expression);
}
return null;
case IPropertyType.NUMBER_TYPE:
case IPropertyType.INTEGER_TYPE:
case IPropertyType.FLOAT_TYPE:
return createConstant(DataType.DOUBLE_TYPE,valueExpr);
case IPropertyType.BOOLEAN_TYPE:
return createConstant(DataType.BOOLEAN_TYPE,valueExpr);
case IPropertyType.DATE_TIME_TYPE:
return createConstant(DataType.DATE_TYPE,valueExpr);
default :
return createConstant(DataType.STRING_TYPE,valueExpr);
}
}
Program: 68330
Project: 68330
Buggy source:
private static void overwriteProp(StyleEntry cEntry,StyleEntry entry,int id){
  if (StyleEntry.isNull(entry.getProperty(id))) {
    entry.setProperty(id,cEntry.getProperty(id));
  }
}

Fixed version (ground truth):
private static boolean overwriteProp(StyleEntry cEntry,StyleEntry entry,int id){
  if (StyleEntry.isNull(entry.getProperty(id))) {
    Object property=cEntry.getProperty(id);
    if (property != null) {
      entry.setProperty(id,property);
      return true;
    }
    return false;
  }
  return false;
}
Program: 68331
Project: 68331
Buggy source:
public static void applyBottomBorder(StyleEntry cEntry,StyleEntry entry){
  if (entry == null) {
    return;
  }
  overwriteProp(cEntry,entry,StyleConstant.BORDER_BOTTOM_COLOR_PROP);
  overwriteProp(cEntry,entry,StyleConstant.BORDER_BOTTOM_STYLE_PROP);
  overwriteProp(cEntry,entry,StyleConstant.BORDER_BOTTOM_WIDTH_PROP);
}

Fixed version (ground truth):
public static boolean applyBottomBorder(StyleEntry cEntry,StyleEntry entry){
  if (entry == null) {
    return false;
  }
  boolean isChanged=false;
  isChanged|=overwriteProp(cEntry,entry,StyleConstant.BORDER_BOTTOM_COLOR_PROP);
  isChanged|=overwriteProp(cEntry,entry,StyleConstant.BORDER_BOTTOM_STYLE_PROP);
  isChanged|=overwriteProp(cEntry,entry,StyleConstant.BORDER_BOTTOM_WIDTH_PROP);
  return isChanged;
}
Program: 68332
Project: 68332
Buggy source:
public void applyContainerBottomStyle(XlsContainer container){
  ContainerSizeInfo rule=container.getSizeInfo();
  StyleEntry entry=container.getStyle();
  int start=rule.getStartCoordinate();
  int col=engine.getAxis().getColumnIndexByCoordinate(start);
  int span=engine.getAxis().getColumnIndexByCoordinate(rule.getEndCoordinate());
  for (int i=col; i < span; i++) {
    SheetData data=engine.getColumnLastData(i);
    if (data == null) {
      continue;
    }
    int styleId=data.getStyleId();
    if (styleId != -1) {
      StyleEntry originalStyle=getStyle(styleId);
      StyleEntry newStyle=new StyleEntry(originalStyle);
      StyleBuilder.applyBottomBorder(entry,newStyle);
      data.setStyleId(getStyleId(newStyle));
    }
  }
}

Fixed version (ground truth):
public void applyContainerBottomStyle(XlsContainer container){
  ContainerSizeInfo rule=container.getSizeInfo();
  StyleEntry entry=container.getStyle();
  int start=rule.getStartCoordinate();
  int col=engine.getAxis().getColumnIndexByCoordinate(start);
  int span=engine.getAxis().getColumnIndexByCoordinate(rule.getEndCoordinate());
  for (int i=col; i < span; i++) {
    SheetData data=engine.getColumnLastData(i);
    if (data == null) {
      continue;
    }
    int styleId=data.getStyleId();
    if (styleId != -1) {
      StyleEntry originalStyle=getStyle(styleId);
      StyleEntry newStyle=new StyleEntry(originalStyle);
      boolean isChanged=StyleBuilder.applyBottomBorder(entry,newStyle);
      if (isChanged)       data.setStyleId(getStyleId(newStyle));
    }
  }
}
Program: 68333
Project: 68333
Buggy source:
public int getStyleId(StyleEntry entry){
  if (entry == null) {
    return 0;
  }
  int styleId=0;
  if (style2id.get(entry) != null) {
    styleId=style2id.get(entry).intValue();
  }
 else {
    styleId=styleID;
    style2id.put(entry,new Integer(styleId));
    styleID++;
  }
  return styleId;
}

Fixed version (ground truth):
public int getStyleId(StyleEntry entry){
  if (entry == null) {
    return 0;
  }
  int styleId=0;
  Integer id=style2id.get(entry);
  if (id != null) {
    styleId=id.intValue();
  }
 else {
    styleId=styleID;
    style2id.put(entry,new Integer(styleId));
    id2Style.put(new Integer(styleId),entry);
    styleID++;
  }
  return styleId;
}
Program: 68334
Project: 68334
Buggy source:
public StyleEntry getStyle(int id){
  for (  Entry<StyleEntry,Integer> entry : style2id.entrySet()) {
    if (entry.getValue() == id) {
      return entry.getKey();
    }
  }
  return null;
}

Fixed version (ground truth):
public StyleEntry getStyle(int id){
  return id2Style.get(id);
}
Program: 68335
Project: 68335
Buggy source:
public int hashCode(){
  int code=0;
  for (int i=0; i < StyleConstant.COUNT; i++) {
    int hashCode=props[i] == null ? 0 : props[i].hashCode();
    code+=hashCode * 2 + 1;
    if (Integer.MAX_VALUE == code) {
      break;
    }
  }
  return code;
}

Fixed version (ground truth):
public int hashCode(){
  if (hashCode == null) {
    int code=0;
    for (int i=0; i < StyleConstant.COUNT; i++) {
      int hashCode=props[i] == null ? 0 : props[i].hashCode();
      code+=hashCode * 2 + 1;
    }
    hashCode=new Integer(code);
    ;
  }
  return hashCode.intValue();
}
Program: 68336
Project: 68336
Buggy source:
public void setProperty(int id,Object value){
  props[id]=value;
}

Fixed version (ground truth):
public void setProperty(int id,Object value){
  props[id]=value;
  hashCode=null;
}
Program: 68337
Project: 68337
Buggy source:
public boolean equals(Object obj){
  if (obj == null) {
    return false;
  }
  if (!(obj instanceof StyleEntry)) {
    return false;
  }
  if (obj == this) {
    return true;
  }
  StyleEntry tar=(StyleEntry)obj;
  for (int i=0; i < StyleConstant.COUNT; i++) {
    if (props[i] != null) {
      if (!props[i].equals(tar.getProperty(i))) {
        return false;
      }
    }
 else {
      if (props[i] != tar.getProperty(i)) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean equals(Object obj){
  if (obj == this) {
    return true;
  }
  if (!(obj instanceof StyleEntry)) {
    return false;
  }
  StyleEntry tar=(StyleEntry)obj;
  for (int i=0; i < StyleConstant.COUNT; i++) {
    if (props[i] != null) {
      if (!props[i].equals(tar.getProperty(i))) {
        return false;
      }
    }
 else {
      if (props[i] != tar.getProperty(i)) {
        return false;
      }
    }
  }
  return true;
}
Program: 68338
Project: 68338
Buggy source:
protected void justify(){
  int spacing=width - currentIP;
  int whiteSpaceNumber=getWhiteSpaceNumber(this);
  if (whiteSpaceNumber > 0) {
    int wordSpacing=spacing / whiteSpaceNumber;
    adjustWordSpacing(wordSpacing,this);
  }
 else {
    int letterNumber=getLetterNumber(this);
    if (letterNumber > 0) {
      int letterSpacing=spacing / (letterNumber - 1);
      adjustLetterSpacing(letterSpacing,this);
    }
  }
}

Fixed version (ground truth):
protected void justify(){
  int spacing=width - currentIP;
  int whiteSpaceNumber=getWhiteSpaceNumber(this);
  if (whiteSpaceNumber > 0) {
    int wordSpacing=spacing / whiteSpaceNumber;
    adjustWordSpacing(wordSpacing,this);
  }
 else {
    int letterNumber=getLetterNumber(this);
    if (letterNumber > 1) {
      int letterSpacing=spacing / (letterNumber - 1);
      adjustLetterSpacing(letterSpacing,this);
    }
  }
}
Program: 68339
Project: 68339
Buggy source:
private static String getAdaptedExprText(IModelAdapter adapter,ComputedColumnHandle target){
  ExpressionHandle eh=target.getExpressionProperty(org.eclipse.birt.report.model.api.elements.structures.ComputedColumn.EXPRESSION_MEMBER);
  if (eh == null) {
    return null;
  }
  Expression expr=(Expression)eh.getValue();
  return adapter.adaptExpression(expr).getText();
}

Fixed version (ground truth):
private static String getAdaptedExprText(IModelAdapter adapter,ComputedColumnHandle target){
  ExpressionHandle eh=target.getExpressionProperty(org.eclipse.birt.report.model.api.elements.structures.ComputedColumn.EXPRESSION_MEMBER);
  if (eh == null) {
    return null;
  }
  Expression expr=(Expression)eh.getValue();
  ScriptExpression scriptExpr=adapter.adaptExpression(expr);
  if (scriptExpr == null)   return null;
  return scriptExpr.getText();
}
Program: 68340
Project: 68340
Buggy source:
boolean nodeCreated(){
  return node_created;
}

Fixed version (ground truth):
public boolean nodeCreated(){
  return node_created;
}
Program: 68341
Project: 68341
Buggy source:
Node popNode(){
  if (--sp < mk) {
    mk=((Integer)marks.pop()).intValue();
  }
  return (Node)nodes.pop();
}

Fixed version (ground truth):
public Node popNode(){
  if (--sp < mk) {
    mk=marks.remove(marks.size() - 1);
  }
  return nodes.remove(nodes.size() - 1);
}
Program: 68342
Project: 68342
Buggy source:
void pushNode(Node n){
  nodes.push(n);
  ++sp;
}

Fixed version (ground truth):
public void pushNode(Node n){
  nodes.add(n);
  ++sp;
}
Program: 68343
Project: 68343
Buggy source:
JJTParserState(){
  nodes=new java.util.Stack();
  marks=new java.util.Stack();
  sp=0;
  mk=0;
}

Fixed version (ground truth):
public JJTParserState(){
  nodes=new java.util.ArrayList<Node>();
  marks=new java.util.ArrayList<Integer>();
  sp=0;
  mk=0;
}
Program: 68344
Project: 68344
Buggy source:
Node peekNode(){
  return (Node)nodes.peek();
}

Fixed version (ground truth):
public Node peekNode(){
  return nodes.get(nodes.size() - 1);
}
Program: 68345
Project: 68345
Buggy source:
void clearNodeScope(Node n){
  while (sp > mk) {
    popNode();
  }
  mk=((Integer)marks.pop()).intValue();
}

Fixed version (ground truth):
public void clearNodeScope(Node n){
  while (sp > mk) {
    popNode();
  }
  mk=marks.remove(marks.size() - 1);
}
Program: 68346
Project: 68346
Buggy source:
int nodeArity(){
  return sp - mk;
}

Fixed version (ground truth):
public int nodeArity(){
  return sp - mk;
}
Program: 68347
Project: 68347
Buggy source:
void closeNodeScope(Node n,boolean condition){
  if (condition) {
    int a=nodeArity();
    mk=((Integer)marks.pop()).intValue();
    while (a-- > 0) {
      Node c=popNode();
      c.jjtSetParent(n);
      n.jjtAddChild(c,a);
    }
    n.jjtClose();
    pushNode(n);
    node_created=true;
  }
 else {
    mk=((Integer)marks.pop()).intValue();
    node_created=false;
  }
}

Fixed version (ground truth):
public void closeNodeScope(Node n,boolean condition){
  if (condition) {
    int a=nodeArity();
    mk=marks.remove(marks.size() - 1);
    while (a-- > 0) {
      Node c=popNode();
      c.jjtSetParent(n);
      n.jjtAddChild(c,a);
    }
    n.jjtClose();
    pushNode(n);
    node_created=true;
  }
 else {
    mk=marks.remove(marks.size() - 1);
    node_created=false;
  }
}
Program: 68348
Project: 68348
Buggy source:
void reset(){
  nodes.removeAllElements();
  marks.removeAllElements();
  sp=0;
  mk=0;
}

Fixed version (ground truth):
public void reset(){
  nodes.clear();
  marks.clear();
  sp=0;
  mk=0;
}
Program: 68349
Project: 68349
Buggy source:
void openNodeScope(Node n){
  marks.push(new Integer(mk));
  mk=sp;
  n.jjtOpen();
}

Fixed version (ground truth):
public void openNodeScope(Node n){
  marks.add(mk);
  mk=sp;
  n.jjtOpen();
}
Program: 68350
Project: 68350
Buggy source:
Node rootNode(){
  return (Node)nodes.elementAt(0);
}

Fixed version (ground truth):
public Node rootNode(){
  return nodes.get(0);
}
Program: 68351
Project: 68351
Buggy source:
/** 
 * Used to convert raw characters to their escaped version when these raw version cannot be used as part of an ASCII string literal.
 */
protected String add_escapes(String str){
  StringBuffer retval=new StringBuffer();
  char ch;
  for (int i=0; i < str.length(); i++) {
switch (str.charAt(i)) {
case 0:
      continue;
case '\b':
    retval.append("String_Node_Str");
  continue;
case '\t':
retval.append("String_Node_Str");
continue;
case '\n':
retval.append("String_Node_Str");
continue;
case '\f':
retval.append("String_Node_Str");
continue;
case '\r':
retval.append("String_Node_Str");
continue;
case '\"':
retval.append("String_Node_Str");
continue;
case '\'':
retval.append("String_Node_Str");
continue;
case '\\':
retval.append("String_Node_Str");
continue;
default :
if ((ch=str.charAt(i)) < 0x20 || ch > 0x7e) {
String s="String_Node_Str" + Integer.toString(ch,16);
retval.append("String_Node_Str" + s.substring(s.length() - 4,s.length()));
}
 else {
retval.append(ch);
}
continue;
}
}
return retval.toString();
}

Fixed version (ground truth):
/** 
 * Used to convert raw characters to their escaped version when these raw version cannot be used as part of an ASCII string literal.
 */
static String add_escapes(String str){
  StringBuffer retval=new StringBuffer();
  char ch;
  for (int i=0; i < str.length(); i++) {
switch (str.charAt(i)) {
case 0:
      continue;
case '\b':
    retval.append("String_Node_Str");
  continue;
case '\t':
retval.append("String_Node_Str");
continue;
case '\n':
retval.append("String_Node_Str");
continue;
case '\f':
retval.append("String_Node_Str");
continue;
case '\r':
retval.append("String_Node_Str");
continue;
case '\"':
retval.append("String_Node_Str");
continue;
case '\'':
retval.append("String_Node_Str");
continue;
case '\\':
retval.append("String_Node_Str");
continue;
default :
if ((ch=str.charAt(i)) < 0x20 || ch > 0x7e) {
String s="String_Node_Str" + Integer.toString(ch,16);
retval.append("String_Node_Str" + s.substring(s.length() - 4,s.length()));
}
 else {
retval.append(ch);
}
continue;
}
}
return retval.toString();
}
Program: 68352
Project: 68352
Buggy source:
public ParseException(String message){
  super(message);
  specialConstructor=false;
}

Fixed version (ground truth):
/** 
 * Constructor with message. 
 */
public ParseException(String message){
  super(message);
}
Program: 68353
Project: 68353
Buggy source:
/** 
 * Set scripts class folder
 */
protected void setScriptingPath(){
  System.setProperty(EngineConstants.WEBAPP_CLASSPATH_KEY,this.getClassFolder() + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Set scripts class folder
 */
protected void setScriptingPath(){
}
Program: 68357
Project: 68357
Buggy source:
protected void checkObjectType(){
  IImageContent image=(IImageContent)content;
  String uri=image.getURI();
  String mimeType=image.getMIMEType();
  String extension=image.getExtension();
  if (FlashFile.isFlash(mimeType,uri,extension)) {
    objectType=TYPE_FLASH_OBJECT;
  }
 else   if (SvgFile.isSvg(mimeType,uri,extension)) {
    objectType=TYPE_SVG_OBJECT;
  }
 else {
    objectType=TYPE_IMAGE_OBJECT;
  }
}

Fixed version (ground truth):
protected void checkObjectType(){
  IImageContent image=(IImageContent)content;
  String uri=image.getURI();
  String mimeType=image.getMIMEType();
  String extension=image.getExtension();
  if (FlashFile.isFlash(mimeType,uri,extension)) {
    objectType=TYPE_FLASH_OBJECT;
  }
 else   if (SvgFile.isSvg(mimeType,uri,extension)) {
    image.setMIMEType("String_Node_Str");
    image.setExtension("String_Node_Str");
    objectType=TYPE_SVG_OBJECT;
  }
 else {
    objectType=TYPE_IMAGE_OBJECT;
  }
}
Program: 68358
Project: 68358
Buggy source:
/** 
 * Creates legend for chart.
 * @param imageContent the image content of the chart.
 * @param imageArea the imageArea of the chart.
 */
private void processChartLegend(IImageContent imageContent,IImageArea imageArea){
  if (null == intrinsic) {
    return;
  }
  Object imageMapObject=imageContent.getImageMap();
  boolean hasImageMap=(imageMapObject != null) && (imageMapObject instanceof String) && (((String)imageMapObject).length() > 0);
  if (hasImageMap) {
    createImageMap((String)imageMapObject,imageArea);
  }
}

Fixed version (ground truth):
/** 
 * Creates legend for chart.
 * @param imageContent the image content of the chart.
 * @param imageArea the imageArea of the chart.
 */
private void processChartLegend(IImageContent imageContent,IImageArea imageArea){
  Object imageMapObject=imageContent.getImageMap();
  boolean hasImageMap=(imageMapObject != null) && (imageMapObject instanceof String) && (((String)imageMapObject).length() > 0);
  if (hasImageMap) {
    createImageMap((String)imageMapObject,imageArea);
  }
}
Program: 68359
Project: 68359
Buggy source:
/** 
 * Puts container's child areas into the visual (display) order and repositions them following that order horizontally.
 * @author Lina Kemmel
 */
private void reorderVisually(ContainerArea parent){
  int n=parent.getChildrenCount();
  if (n == 0)   return;
  int i=0;
  AbstractArea[] areas=new AbstractArea[n];
  byte[] levels=new byte[n];
  Iterator<?> iter=parent.getChildren();
  for (; i < n && iter.hasNext(); i++) {
    AbstractArea area=(AbstractArea)iter.next();
    areas[i]=area;
    if (area instanceof TextArea)     levels[i]=(byte)((TextArea)area).getRunLevel();
 else {
      levels[i]=baseLevel;
      if (area instanceof InlineStackingArea) {
        reorderVisually((ContainerArea)area);
      }
    }
  }
  if (n > 1) {
    int parentWidth=parent.getContentWidth();
    Bidi.reorderVisually(levels,0,areas,0,n);
    for (i=0; i < n; i++) {
      int x=areas[i].getAllocatedX();
      areas[i].setAllocatedPosition(parentWidth - x - areas[i].getAllocatedWidth(),areas[i].getAllocatedY());
    }
  }
}

Fixed version (ground truth):
/** 
 * Puts container's child areas into the visual (display) order and repositions them following that order horizontally.
 * @author Lina Kemmel
 */
private void reorderVisually(ContainerArea parent){
  int n=parent.getChildrenCount();
  if (n == 0)   return;
  int i=0;
  AbstractArea[] areas=new AbstractArea[n];
  byte[] levels=new byte[n];
  Iterator<?> iter=parent.getChildren();
  for (; i < n && iter.hasNext(); i++) {
    AbstractArea area=(AbstractArea)iter.next();
    areas[i]=area;
    if (area instanceof TextArea)     levels[i]=(byte)((TextArea)area).getRunLevel();
 else {
      levels[i]=baseLevel;
      if (area instanceof InlineStackingArea) {
        reorderVisually((ContainerArea)area);
      }
    }
  }
  if (n > 1) {
    int x=areas[0].getAllocatedX();
    Bidi.reorderVisually(levels,0,areas,0,n);
    for (i=0; i < n - 1; i++) {
      if (!areas[i].isIgnoreReordering()) {
        areas[i].setAllocatedPosition(x,areas[i].getAllocatedY());
        x+=areas[i].getAllocatedWidth();
      }
    }
    if (!areas[i].isIgnoreReordering()) {
      areas[i].setAllocatedPosition(x,areas[i].getAllocatedY());
    }
  }
}
Program: 68360
Project: 68360
Buggy source:
public void setExpression(String expr){
  if (expr != null && expr.length() > 0) {
    codec.decode(expr);
    eHelper.setExpression(codec.getExpression());
    eHelper.setExpressionType(codec.getType());
  }
 else {
    eHelper.setExpression(codec.getExpression());
  }
  eb.refresh();
}

Fixed version (ground truth):
public void setExpression(String expr){
  if (expr != null && expr.length() > 0) {
    codec.decode(expr);
    eHelper.setExpression(codec.getExpression());
    eHelper.setExpressionType(codec.getType());
  }
 else {
    eHelper.setExpression(expr);
  }
  eb.refresh();
}
Program: 68361
Project: 68361
Buggy source:
@Override public Object visitExpressionValue(ExpressionValueNode node,Object value){
  StringBuffer buffer=(StringBuffer)value;
  buffer.append("String_Node_Str");
  if (node.getFormat() != null) {
    buffer.append("String_Node_Str");
    buffer.append(node.getFormat());
    buffer.append("String_Node_Str");
  }
  buffer.append("String_Node_Str");
  buffer.append(node.getValue());
  buffer.append("String_Node_Str");
  return buffer;
}

Fixed version (ground truth):
public Object visitExpressionValue(ExpressionValueNode node,Object value){
  StringBuffer buffer=(StringBuffer)value;
  buffer.append("String_Node_Str");
  if (node.getFormat() != null) {
    buffer.append("String_Node_Str");
    buffer.append(node.getFormat());
    buffer.append("String_Node_Str");
  }
  buffer.append("String_Node_Str");
  buffer.append(node.getValue());
  buffer.append("String_Node_Str");
  return buffer;
}
Program: 68362
Project: 68362
Buggy source:
private Expression createUserProperty(DesignElementHandle handle,UserPropertyDefn userDef){
  String propName=userDef.getName();
  String valueExpr=handle.getStringProperty(propName);
switch (userDef.getTypeCode()) {
case IPropertyType.SCRIPT_TYPE:
case IPropertyType.EXPRESSION_TYPE:
    if (valueExpr != null) {
      return createExpression(valueExpr);
    }
 else {
      Object defaultValue=userDef.getDefault();
      if (defaultValue instanceof org.eclipse.birt.report.model.api.Expression) {
        return createExpression((org.eclipse.birt.report.model.api.Expression)defaultValue);
      }
 else {
        return null;
      }
    }
case IPropertyType.NUMBER_TYPE:
case IPropertyType.INTEGER_TYPE:
case IPropertyType.FLOAT_TYPE:
  return createConstant(DataType.DOUBLE_TYPE,valueExpr);
case IPropertyType.BOOLEAN_TYPE:
return createConstant(DataType.BOOLEAN_TYPE,valueExpr);
case IPropertyType.DATE_TIME_TYPE:
return createConstant(DataType.DATE_TYPE,valueExpr);
default :
return createConstant(DataType.STRING_TYPE,valueExpr);
}
}

Fixed version (ground truth):
private Expression createUserProperty(DesignElementHandle handle,UserPropertyDefn userDef){
  String propName=userDef.getName();
  String valueExpr=handle.getStringProperty(propName);
switch (userDef.getTypeCode()) {
case IPropertyType.SCRIPT_TYPE:
case IPropertyType.EXPRESSION_TYPE:
    ExpressionHandle property=handle.getExpressionProperty(propName);
  if (property == null) {
    return null;
  }
Object expression=property.getExpression();
if (expression == null) {
expression=userDef.getDefault();
}
if (expression instanceof org.eclipse.birt.report.model.api.Expression) {
return createExpression((org.eclipse.birt.report.model.api.Expression)expression);
}
return null;
case IPropertyType.NUMBER_TYPE:
case IPropertyType.INTEGER_TYPE:
case IPropertyType.FLOAT_TYPE:
return createConstant(DataType.DOUBLE_TYPE,valueExpr);
case IPropertyType.BOOLEAN_TYPE:
return createConstant(DataType.BOOLEAN_TYPE,valueExpr);
case IPropertyType.DATE_TIME_TYPE:
return createConstant(DataType.DATE_TYPE,valueExpr);
default :
return createConstant(DataType.STRING_TYPE,valueExpr);
}
}
Program: 68363
Project: 68363
Buggy source:
private void createNewDataSet(){
  List existingDataSets=getDataSets();
  DefaultDataSetWizard wizard=new DefaultDataSetWizard();
  wizard.setWindowTitle(Messages.getString("String_Node_Str"));
  WizardDialog dialog=new WizardDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(),wizard);
  if (dialog.open() == WizardDialog.OK) {
    List newDataSets=getDataSets();
    if (editDataSet(existingDataSets,newDataSets)) {
      notifyResult(true);
    }
 else {
      notifyResult(false);
    }
    ReportRequest request=new ReportRequest(ReportRequest.CREATE_ELEMENT);
    List selectionObjects=new ArrayList();
    selectionObjects.add(dataSetHandle);
    request.setSelectionObject(selectionObjects);
    SessionHandleAdapter.getInstance().getMediator().notifyRequest(request);
    SessionHandleAdapter.getInstance().getCommandStack().commit();
  }
 else {
    notifyResult(false);
    SessionHandleAdapter.getInstance().getCommandStack().rollback();
  }
}

Fixed version (ground truth):
private void createNewDataSet(){
  DefaultDataSetWizard wizard=new DefaultDataSetWizard();
  wizard.setWindowTitle(Messages.getString("String_Node_Str"));
  WizardDialog dialog=new WizardDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(),wizard);
  if (dialog.open() == WizardDialog.OK) {
    DataSetHandle ds=wizard.getNewCreateDataSetHandle();
    if (editDataSet(ds)) {
      notifyResult(true);
    }
 else {
      notifyResult(false);
    }
    ReportRequest request=new ReportRequest(ReportRequest.CREATE_ELEMENT);
    List selectionObjects=new ArrayList();
    selectionObjects.add(dataSetHandle);
    request.setSelectionObject(selectionObjects);
    SessionHandleAdapter.getInstance().getMediator().notifyRequest(request);
    SessionHandleAdapter.getInstance().getCommandStack().commit();
  }
 else {
    notifyResult(false);
    SessionHandleAdapter.getInstance().getCommandStack().rollback();
  }
}
Program: 68364
Project: 68364
Buggy source:
private boolean editDataSet(List existingDataSets,List newDataSets){
  if (existingDataSets == null || newDataSets == null) {
    return false;
  }
  if (newDataSets.size() <= existingDataSets.size()) {
    return false;
  }
  dataSetHandle=findNewDataSet(existingDataSets,newDataSets);
  if (dataSetHandle == null)   return false;
  if (dataSetHandle instanceof ScriptDataSetHandle) {
    return false;
  }
  DataSetEditor dialog=new AdvancedDataSetEditor(PlatformUI.getWorkbench().getDisplay().getActiveShell(),dataSetHandle,true);
  return (dialog.open() == Window.OK);
}

Fixed version (ground truth):
private boolean editDataSet(DataSetHandle ds){
  dataSetHandle=ds;
  if (dataSetHandle == null)   return false;
  if (dataSetHandle instanceof ScriptDataSetHandle) {
    return false;
  }
  DataSetEditor dialog=new AdvancedDataSetEditor(PlatformUI.getWorkbench().getDisplay().getActiveShell(),dataSetHandle,true);
  return (dialog.open() == Window.OK);
}