nus-yam/ex-repair huggingface dataset:
Program: 67626
Project: 67626
Buggy source:
/** 
 * Note: Manually written
 */
protected void initialize(){
  setVersion(VERSION);
  block=BlockImpl.create();
  block.setBackground(ColorDefinitionImpl.WHITE());
  TitleBlock tb=(TitleBlock)TitleBlockImpl.create();
  Plot pl=(Plot)PlotImpl.create();
  Legend lg=(Legend)LegendImpl.create();
  block.add(tb);
  block.add(pl);
  block.add(lg);
  Text txtChartTitle=tb.getLabel().getCaption();
  txtChartTitle.setValue("String_Node_Str");
  txtChartTitle.getFont().setSize(16);
  txtChartTitle.getFont().setBold(true);
  TextAlignment taTitle=TextAlignmentImpl.create();
  taTitle.setHorizontalAlignment(HorizontalAlignment.CENTER_LITERAL);
  taTitle.setVerticalAlignment(VerticalAlignment.CENTER_LITERAL);
  txtChartTitle.getFont().setAlignment(taTitle);
  setDimension(ChartDimension.TWO_DIMENSIONAL_LITERAL);
  setSeriesThickness(10);
  setInteractivity(InteractivityImpl.create());
  setEmptyMessage(newEmptyMessage());
  ChartModelHelper.instance().updateExtendedProperties(getExtendedProperties());
}

Fixed version (ground truth):
/** 
 * Note: Manually written
 */
protected void initialize(){
  setVersion(VERSION);
  block=BlockImpl.create();
  TitleBlock tb=(TitleBlock)TitleBlockImpl.create();
  Plot pl=(Plot)PlotImpl.create();
  Legend lg=(Legend)LegendImpl.create();
  block.add(tb);
  block.add(pl);
  block.add(lg);
  Text txtChartTitle=tb.getLabel().getCaption();
  txtChartTitle.setValue("String_Node_Str");
  txtChartTitle.getFont().setSize(16);
  txtChartTitle.getFont().setBold(true);
  TextAlignment taTitle=TextAlignmentImpl.create();
  taTitle.setHorizontalAlignment(HorizontalAlignment.CENTER_LITERAL);
  taTitle.setVerticalAlignment(VerticalAlignment.CENTER_LITERAL);
  txtChartTitle.getFont().setAlignment(taTitle);
  setDimension(ChartDimension.TWO_DIMENSIONAL_LITERAL);
  setSeriesThickness(10);
  setInteractivity(InteractivityImpl.create());
  setEmptyMessage(newEmptyMessage());
  ChartModelHelper.instance().updateExtendedProperties(getExtendedProperties());
}
Program: 67627
Project: 67627
Buggy source:
private void showChart(Dimension dSize){
  Bounds bo=BoundsImpl.create(0,0,dSize.width,dSize.height);
  bo.scale(72d / idr.getDisplayServer().getDpiResolution());
  idr.setProperty(IDeviceRenderer.GRAPHICS_CONTEXT,gc);
  Generator gr=Generator.instance();
  ChartAdapter.beginIgnoreNotifications();
  cm.clearSections(IConstants.RUN_TIME);
  cm.createSampleRuntimeSeries();
  ChartAdapter.endIgnoreNotifications();
  try {
    Chart cmRunTime=cm.copyInstance();
    removeScaleInfoForSample(cmRunTime);
    RunTimeContext rtc=new RunTimeContext();
    rtc.setScriptingEnabled(false);
    rtc.setMessageLookup(new BIRTDesignerMessageLookup(crii.getHandle()));
    rtc.setRightToLeft(crii.isLayoutDirectionRTL());
    rtc.setRightToLeftText(crii.getHandle().isDirectionRTL());
    rtc.setResourceFinder(crii);
    rtc.setExternalizer(crii);
    boolean bPlotChart=ChartCubeUtil.isPlotChart(crii.getHandle());
    if (bPlotChart) {
      rtc.setSharedScale(createSharedScaleFromSampleData());
    }
    gr.render(idr,gr.build(idr.getDisplayServer(),cmRunTime,bo,null,rtc,new ChartReportStyleProcessor(crii.getHandle(),true)));
  }
 catch (  ChartException gex) {
    showException(gc,gex);
  }
}

Fixed version (ground truth):
private void showChart(Dimension dSize){
  Bounds bo=BoundsImpl.create(0,0,dSize.width,dSize.height);
  bo.scale(72d / idr.getDisplayServer().getDpiResolution());
  idr.setProperty(IDeviceRenderer.GRAPHICS_CONTEXT,gc);
  Generator gr=Generator.instance();
  gr.setHighContrast(Display.getCurrent().getHighContrast());
  ChartAdapter.beginIgnoreNotifications();
  cm.clearSections(IConstants.RUN_TIME);
  cm.createSampleRuntimeSeries();
  ChartAdapter.endIgnoreNotifications();
  try {
    Chart cmRunTime=cm.copyInstance();
    removeScaleInfoForSample(cmRunTime);
    RunTimeContext rtc=new RunTimeContext();
    rtc.setScriptingEnabled(false);
    rtc.setMessageLookup(new BIRTDesignerMessageLookup(crii.getHandle()));
    rtc.setRightToLeft(crii.isLayoutDirectionRTL());
    rtc.setRightToLeftText(crii.getHandle().isDirectionRTL());
    rtc.setResourceFinder(crii);
    rtc.setExternalizer(crii);
    boolean bPlotChart=ChartCubeUtil.isPlotChart(crii.getHandle());
    if (bPlotChart) {
      rtc.setSharedScale(createSharedScaleFromSampleData());
    }
    gr.render(idr,gr.build(idr.getDisplayServer(),cmRunTime,bo,null,rtc,new ChartReportStyleProcessor(crii.getHandle(),true)));
  }
 catch (  ChartException gex) {
    showException(gc,gex);
  }
}
Program: 67630
Project: 67630
Buggy source:
private void doTestRollingLog(int logRollingSize,int maxBackupIndex,int expectLogNum) throws EngineException {
  EngineConfig config=new EngineConfig();
  String tmpPath=System.getProperty("String_Node_Str") + System.nanoTime();
  config.setLogConfig(tmpPath,Level.ALL);
  config.setLogRollingSize(logRollingSize);
  config.setLogMaxBackupIndex(maxBackupIndex);
  engine=createReportEngine(config);
  engine.changeLogLevel(Level.ALL);
  new File("String_Node_Str").mkdirs();
  copyResource("String_Node_Str","String_Node_Str");
  IReportRunnable runnable=engine.openReportDesign("String_Node_Str");
  IRunTask task=engine.createRunTask(runnable);
  task.setParameter("String_Node_Str","String_Node_Str","String_Node_Str");
  task.run("String_Node_Str");
  task.close();
  task=engine.createRunTask(runnable);
  task.setParameter("String_Node_Str","String_Node_Str","String_Node_Str");
  task.run("String_Node_Str");
  task.close();
  engine.destroy();
  File tmpDir=new File(tmpPath);
  File[] logFiles=tmpDir.listFiles(new FilenameFilter(){
    @Override public boolean accept(    File parent,    String name){
      return name.matches("String_Node_Str");
    }
  }
);
  int logFileNum=logFiles.length;
  for (  File f : logFiles) {
    f.delete();
  }
  tmpDir.delete();
  assertEquals(expectLogNum,logFileNum);
}

Fixed version (ground truth):
private void doTestRollingLog(int logRollingSize,int maxBackupIndex,int expectLogNum) throws EngineException {
  EngineConfig config=new EngineConfig();
  String tmpPath=System.getProperty("String_Node_Str") + System.nanoTime();
  config.setLogConfig(tmpPath,Level.ALL);
  config.setLogRollingSize(logRollingSize);
  config.setLogMaxBackupIndex(maxBackupIndex);
  engine=createReportEngine(config);
  engine.changeLogLevel(Level.ALL);
  new File("String_Node_Str").mkdirs();
  copyResource("String_Node_Str","String_Node_Str");
  IReportRunnable runnable=engine.openReportDesign("String_Node_Str");
  IRunTask task=engine.createRunTask(runnable);
  task.setParameter("String_Node_Str","String_Node_Str","String_Node_Str");
  task.run("String_Node_Str");
  task.close();
  task=engine.createRunTask(runnable);
  task.setParameter("String_Node_Str","String_Node_Str","String_Node_Str");
  task.run("String_Node_Str");
  task.close();
  engine.destroy();
  File tmpDir=new File(tmpPath);
  File[] logFiles=tmpDir.listFiles(new FilenameFilter(){
    public boolean accept(    File parent,    String name){
      return name.matches("String_Node_Str");
    }
  }
);
  int logFileNum=logFiles.length;
  for (  File f : logFiles) {
    f.delete();
  }
  tmpDir.delete();
  assertEquals(expectLogNum,logFileNum);
}
Program: 67631
Project: 67631
Buggy source:
@Override public boolean accept(File parent,String name){
  return name.matches("String_Node_Str");
}

Fixed version (ground truth):
public boolean accept(File parent,String name){
  return name.matches("String_Node_Str");
}
Program: 67632
Project: 67632
Buggy source:
public ISelectDataComponent getSeriesDataComponent(int seriesType,SeriesDefinition seriesDefn,ChartWizardContext context,String sTitle){
  if (seriesType == ISelectDataCustomizeUI.ORTHOGONAL_SERIES) {
    return new BaseDataDefinitionComponent(BaseDataDefinitionComponent.BUTTON_AGGREGATION,sTitle,seriesDefn,ChartUIUtil.getDataQuery(seriesDefn,0),context,sTitle);
  }
 else   if (seriesType == ISelectDataCustomizeUI.GROUPING_SERIES) {
    BaseDataDefinitionComponent ddc=new BaseDataDefinitionComponent(sTitle,seriesDefn,seriesDefn.getQuery(),context,sTitle);
    return ddc;
  }
  return new DefaultSelectDataComponent();
}

Fixed version (ground truth):
public ISelectDataComponent getSeriesDataComponent(int seriesType,SeriesDefinition seriesDefn,ChartWizardContext context,String sTitle){
  if (seriesType == ISelectDataCustomizeUI.ORTHOGONAL_SERIES) {
    return new BaseDataDefinitionComponent(BaseDataDefinitionComponent.BUTTON_AGGREGATION,sTitle,seriesDefn,ChartUIUtil.getDataQuery(seriesDefn,0),context,sTitle);
  }
 else   if (seriesType == ISelectDataCustomizeUI.GROUPING_SERIES) {
    BaseDataDefinitionComponent ddc=new YOptionalDataDefinitionComponent(BaseDataDefinitionComponent.BUTTON_GROUP,ChartUIConstants.QUERY_OPTIONAL,seriesDefn,seriesDefn.getQuery(),context,sTitle);
    return ddc;
  }
  return new DefaultSelectDataComponent();
}
Program: 67633
Project: 67633
Buggy source:
private void createDataArea(){
  fDataArea=new ScrolledComposite(foSashForm,SWT.VERTICAL);
{
    GridLayout gl=new GridLayout();
    fDataArea.setLayout(gl);
    GridData gd=new GridData(GridData.FILL_VERTICAL);
    fDataArea.setLayoutData(gd);
    fDataArea.setExpandHorizontal(true);
    fDataArea.setExpandVertical(true);
  }
  Composite dataComposite=new Composite(fDataArea,SWT.NONE);
{
    GridLayout gl=new GridLayout(2,false);
    gl.marginLeft=fLeftSize.x;
    dataComposite.setLayout(gl);
    GridData gd=new GridData(GridData.FILL_BOTH);
    dataComposite.setLayoutData(gd);
  }
  fDataArea.setContent(dataComposite);
  getDataSheet().createDataSelector(dataComposite);
  GridData gd=new GridData(GridData.FILL_HORIZONTAL);
  gd.widthHint=fRightSize.x;
  new Label(dataComposite,SWT.NONE).setLayoutData(gd);
  getDataSheet().createDataDragSource(dataComposite);
  getDataSheet().createActionButtons(dataComposite);
  new Label(dataComposite,SWT.NONE);
}

Fixed version (ground truth):
private void createDataArea(){
  fDataArea=new ScrolledComposite(foSashForm,SWT.VERTICAL);
{
    GridLayout gl=new GridLayout();
    fDataArea.setLayout(gl);
    GridData gd=new GridData(GridData.FILL_VERTICAL);
    fDataArea.setLayoutData(gd);
    fDataArea.setExpandHorizontal(true);
    fDataArea.setExpandVertical(true);
  }
  Composite dataComposite=new Composite(fDataArea,SWT.NONE);
{
    GridLayout gl=new GridLayout(2,false);
    gl.marginLeft=fLeftSize.x;
    dataComposite.setLayout(gl);
    GridData gd=new GridData(GridData.FILL_BOTH);
    dataComposite.setLayoutData(gd);
  }
  fDataArea.setContent(dataComposite);
  getDataSheet().createDataSelector(dataComposite);
  GridData gd=new GridData();
  gd.widthHint=fRightSize.x - 40;
  new Label(dataComposite,SWT.NONE).setLayoutData(gd);
  getDataSheet().createDataDragSource(dataComposite);
  getDataSheet().createActionButtons(dataComposite);
  new Label(dataComposite,SWT.NONE);
}
Program: 67634
Project: 67634
Buggy source:
public Object visitValue(TextTemplate.ValueNode node,Object value){
  Object result=null;
  if (values != null) {
    String keyExpr=node.getValue();
    if (keyExpr != null) {
      keyExpr=keyExpr.trim();
    }
    result=values.get(keyExpr);
  }
  String text=formatValue(node,result);
  buffer.append(text);
  return value;
}

Fixed version (ground truth):
public Object visitValue(TextTemplate.ValueNode node,Object value){
  String expression=node.getValue();
  if (expression != null) {
    expression=expression.trim();
    if ("String_Node_Str".equals(expression) || "String_Node_Str".equals(expression)) {
      Object result=ExpressionUtil.evaluate(context,Expression.newScript(expression));
      String text=formatValue(node,result);
      buffer.append(text);
    }
 else {
      Object result=null;
      if (values != null) {
        String keyExpr=node.getValue();
        if (keyExpr != null) {
          keyExpr=keyExpr.trim();
        }
        result=values.get(keyExpr);
      }
      String text=formatValue(node,result);
      buffer.append(text);
    }
  }
  return value;
}
Program: 67636
Project: 67636
Buggy source:
protected final void initialize(){
  super.initialize();
  setExplosion(20);
  setLabelPosition(Position.OUTSIDE_LITERAL);
  setLeaderLineAttributes(LineAttributesImpl.create(ColorDefinitionImpl.BLACK(),LineStyle.SOLID_LITERAL,1));
  setLeaderLineLength(40);
  setLeaderLineStyle(LeaderLineStyle.STRETCH_TO_SIDE_LITERAL);
  getLabel().setVisible(true);
  final Label la=LabelImpl.create();
  la.getCaption().getFont().setSize(16);
  la.getCaption().getFont().setBold(true);
  setTitle(la);
  setTitlePosition(Position.BELOW_LITERAL);
}

Fixed version (ground truth):
protected final void initialize(){
  super.initialize();
  setExplosion(20);
  setLabelPosition(Position.OUTSIDE_LITERAL);
  setLeaderLineAttributes(LineAttributesImpl.create(null,LineStyle.SOLID_LITERAL,1));
  setLeaderLineLength(40);
  setLeaderLineStyle(LeaderLineStyle.STRETCH_TO_SIDE_LITERAL);
  getLabel().setVisible(true);
  final Label la=LabelImpl.create();
  la.getCaption().getFont().setSize(16);
  la.getCaption().getFont().setBold(true);
  setTitle(la);
  setTitlePosition(Position.BELOW_LITERAL);
}
Program: 67637
Project: 67637
Buggy source:
protected final void initialize(){
  super.initialize();
  setLabelPosition(Position.ABOVE_LITERAL);
  final LineAttributes lia=LineAttributesImpl.create(ColorDefinitionImpl.BLACK(),LineStyle.SOLID_LITERAL,0);
  lia.setVisible(true);
  setLineAttributes(lia);
}

Fixed version (ground truth):
protected final void initialize(){
  super.initialize();
  setLabelPosition(Position.ABOVE_LITERAL);
  final LineAttributes lia=LineAttributesImpl.create(null,LineStyle.SOLID_LITERAL,0);
  lia.setVisible(true);
  setLineAttributes(lia);
}
Program: 67639
Project: 67639
Buggy source:
public BIRTCubeResultSetEvaluator(ICubeQueryResults qr){
  this.rs=null;
  this.qr=qr;
}

Fixed version (ground truth):
public BIRTCubeResultSetEvaluator(ICubeQueryResults qr) throws BirtException {
  this.rs=null;
  this.qr=qr;
  try {
    initCubeCursor();
  }
 catch (  OLAPException e) {
    logger.log(e);
  }
}
Program: 67640
Project: 67640
Buggy source:
/** 
 * Constructor.
 * @param qr
 * @param queryDefinition
 * @param cm
 */
public SharedCubeResultSetEvaluator(ICubeQueryResults qr,IBaseCubeQueryDefinition queryDefinition,Chart cm){
  super(qr);
  parseLevelIndex(queryDefinition,cm);
}

Fixed version (ground truth):
/** 
 * Constructor.
 * @param qr
 * @param queryDefinition
 * @param cm
 */
public SharedCubeResultSetEvaluator(ICubeQueryResults qr,IBaseCubeQueryDefinition queryDefinition,Chart cm) throws BirtException {
  super(qr);
  parseLevelIndex(queryDefinition,cm);
}
Program: 67641
Project: 67641
Buggy source:
public ImageData(IImageContent image,int imageWidth,int styleId,int datatype,Image imageInfo,XlsContainer currentContainer,int heightDpi,int widthDpi){
  super();
  this.dataType=datatype;
  this.styleId=styleId;
  height=ExcelUtil.convertDimensionType(image.getHeight(),imageInfo.getHeight() * 1000 * ExcelUtil.INCH_PT / heightDpi,heightDpi) / 1000;
  imageHeight=(int)height;
  width=Math.min(currentContainer.getSizeInfo().getWidth(),imageWidth);
  altText=image.getAltText();
  imageUrl=image.getURI();
  this.imageData=imageInfo.getData();
  rowSpanInDesign=0;
  this.imageInfo=imageInfo;
}

Fixed version (ground truth):
public ImageData(IImageContent image,byte[] imageData,int imageWidth,int imageHeight,int styleId,int datatype,XlsContainer currentContainer){
  super();
  this.dataType=datatype;
  this.styleId=styleId;
  height=imageHeight / 1000;
  this.imageHeight=(int)height;
  width=Math.min(currentContainer.getSizeInfo().getWidth(),imageWidth);
  altText=image.getAltText();
  imageUrl=image.getURI();
  this.imageData=imageData;
  rowSpanInDesign=0;
}
Program: 67642
Project: 67642
Buggy source:
private SheetData createImageData(IImageContent image,int imageWidth,StyleEntry entry,XlsContainer container,int imageHeightDpi,int imageWidhtDpi){
  int type=SheetData.IMAGE;
  entry.setProperty(StyleConstant.DATA_TYPE_PROP,type);
  String uri=image.getURI();
  String mimeType=image.getMIMEType();
  String extension=image.getExtension();
  String altText=image.getAltText();
  if (FlashFile.isFlash(mimeType,uri,extension)) {
    if (null == altText) {
      altText=messageFlashObjectNotSupported;
    }
    entry.setProperty(StyleConstant.DATA_TYPE_PROP,SheetData.STRING);
    return createData(altText,entry);
  }
  try {
    Image imageInfo=EmitterUtil.parseImage(image,image.getImageSource(),image.getURI(),image.getMIMEType(),image.getExtension());
    byte[] data=imageInfo.getData();
    if (data != null) {
      return createData(image,imageWidth,entry,container,type,imageInfo,imageHeightDpi,imageWidhtDpi);
    }
 else {
      entry.setProperty(StyleConstant.DATA_TYPE_PROP,SheetData.STRING);
      return createData(image.getAltText(),entry);
    }
  }
 catch (  IOException e) {
    logger.log(Level.WARNING,e.getLocalizedMessage());
    entry.setProperty(StyleConstant.DATA_TYPE_PROP,SheetData.STRING);
    return createData(image.getAltText(),entry);
  }
}

Fixed version (ground truth):
private SheetData createImageData(IImageContent image,byte[] imageData,int imageWidth,int imageHeight,StyleEntry entry,XlsContainer container){
  int type=SheetData.IMAGE;
  entry.setProperty(StyleConstant.DATA_TYPE_PROP,type);
  String uri=image.getURI();
  String mimeType=image.getMIMEType();
  String extension=image.getExtension();
  String altText=image.getAltText();
  if (FlashFile.isFlash(mimeType,uri,extension)) {
    if (null == altText) {
      altText=messageFlashObjectNotSupported;
    }
    entry.setProperty(StyleConstant.DATA_TYPE_PROP,SheetData.STRING);
    return createData(altText,entry);
  }
  if (imageData != null) {
    return createData(image,imageData,imageWidth,imageHeight,entry,container,type);
  }
 else {
    entry.setProperty(StyleConstant.DATA_TYPE_PROP,SheetData.STRING);
    return createData(image.getAltText(),entry);
  }
}
Program: 67644
Project: 67644
Buggy source:
public static ColumnsInfo createImage(IImageContent image,int width,int imageWidthDpi){
  width=getImageWidth(image,width,imageWidthDpi);
  int[] column=new int[]{width};
  return new ColumnsInfo(column);
}

Fixed version (ground truth):
public static ColumnsInfo createImage(int width){
  int[] column=new int[]{width};
  return new ColumnsInfo(column);
}
Program: 67645
Project: 67645
Buggy source:
public static int getImageWidth(IImageContent image,int width,int imageWidthDpi){
  int dpi=imageWidthDpi;
  DimensionType value=image.getWidth();
  if (value != null) {
    width=getElementWidth(value,width,dpi);
  }
 else {
    try {
      Image imageInfo=EmitterUtil.parseImage(image,image.getImageSource(),image.getURI(),image.getMIMEType(),image.getExtension());
      width=(int)(imageInfo.getWidth() * ExcelUtil.INCH_PT / dpi * 1000);
    }
 catch (    IOException e1) {
      log.log(Level.WARNING,e1.getLocalizedMessage());
    }
  }
  return width;
}

Fixed version (ground truth):
public static int getImageWidth(DimensionType value,int parentWidth,int imageInfoWidth,int dpi){
  int width;
  if (value != null) {
    width=getElementWidth(value,parentWidth,dpi);
  }
 else {
    width=(int)(imageInfoWidth * ExcelUtil.INCH_PT / dpi);
  }
  return width;
}
Program: 67647
Project: 67647
Buggy source:
public void testSave() throws IOException {
  ArchiveFile file=new ArchiveFile("String_Node_Str","String_Node_Str");
  ArchiveEntry entry=file.createEntry("String_Node_Str");
  byte[] bytes=new byte[255];
  for (int i=0; i < 255; i++) {
    bytes[i]=(byte)i;
  }
  entry.write(0,bytes,0,255);
  file.save();
  copyFile("String_Node_Str","String_Node_Str");
  file.close();
  assertTrue(new File("String_Node_Str").exists());
  file=new ArchiveFile("String_Node_Str","String_Node_Str");
  entry=file.openEntry("String_Node_Str");
  assertTrue(entry != null);
  entry.read(0,bytes,0,255);
  for (int i=0; i < 255; i++) {
    assertEquals(bytes[i],(byte)i);
  }
  entry.close();
  file.close();
  new File("String_Node_Str").delete();
  new File("String_Node_Str").delete();
}

Fixed version (ground truth):
public void testSave() throws IOException {
  ArchiveFile file=new ArchiveFile("String_Node_Str","String_Node_Str");
  ArchiveEntry entry=file.createEntry("String_Node_Str");
  byte[] bytes=new byte[255];
  for (int i=0; i < 255; i++) {
    bytes[i]=(byte)i;
  }
  entry.write(0,bytes,0,255);
  file.save();
  file.close();
  copyFile("String_Node_Str","String_Node_Str");
  assertTrue(new File("String_Node_Str").exists());
  file=new ArchiveFile("String_Node_Str","String_Node_Str");
  entry=file.openEntry("String_Node_Str");
  assertTrue(entry != null);
  entry.read(0,bytes,0,255);
  for (int i=0; i < 255; i++) {
    assertEquals(bytes[i],(byte)i);
  }
  entry.close();
  file.close();
  new File("String_Node_Str").delete();
  new File("String_Node_Str").delete();
}
Program: 67648
Project: 67648
Buggy source:
/** 
 * Get the margin of the current element.
 * @param retValue The margin value of the current element.
 * @return The maring's new value of the current element.
 */
public Insets getMargin(Insets retValue){
  if (retValue == null) {
    retValue=new Insets();
  }
 else {
    retValue=new Insets(retValue);
  }
  int fontSize=DEUtil.getFontSizeIntValue(getHandle());
  double px=0;
  Object prop=getHandle().getProperty(StyleHandle.MARGIN_TOP_PROP);
  if (!DesignChoiceConstants.MARGIN_AUTO.equals(prop)) {
    px=DEUtil.convertToPixel(prop,fontSize);
  }
  double py=0;
  prop=getHandle().getProperty(StyleHandle.MARGIN_BOTTOM_PROP);
  if (!DesignChoiceConstants.MARGIN_AUTO.equals(prop)) {
    py=DEUtil.convertToPixel(prop,fontSize);
  }
  retValue.top=(int)px;
  retValue.bottom=(int)py;
  px=py=0;
  prop=getHandle().getProperty(StyleHandle.MARGIN_LEFT_PROP);
  if (!DesignChoiceConstants.MARGIN_AUTO.equals(prop)) {
    px=DEUtil.convertToPixel(prop,fontSize);
  }
  prop=getHandle().getProperty(StyleHandle.MARGIN_RIGHT_PROP);
  if (!DesignChoiceConstants.MARGIN_AUTO.equals(prop)) {
    py=DEUtil.convertToPixel(prop,fontSize);
  }
  retValue.left=(int)px;
  retValue.right=(int)py;
  return retValue;
}

Fixed version (ground truth):
/** 
 * Get the margin of the current element.
 * @param retValue The margin value of the current element.
 * @return The maring's new value of the current element.
 */
public Insets getMargin(Insets retValue,Dimension size){
  if (retValue == null) {
    retValue=new Insets();
  }
 else {
    retValue=new Insets(retValue);
  }
  int fontSize=DEUtil.getFontSizeIntValue(getHandle());
  double px=0;
  Object prop=getHandle().getProperty(StyleHandle.MARGIN_TOP_PROP);
  if (!DesignChoiceConstants.MARGIN_AUTO.equals(prop)) {
    px=DEUtil.convertToPixel(prop,fontSize);
  }
  double py=0;
  prop=getHandle().getProperty(StyleHandle.MARGIN_BOTTOM_PROP);
  if (!DesignChoiceConstants.MARGIN_AUTO.equals(prop)) {
    py=DEUtil.convertToPixel(prop,fontSize);
  }
  retValue.top=(int)px;
  retValue.bottom=(int)py;
  px=py=0;
  prop=getHandle().getProperty(StyleHandle.MARGIN_LEFT_PROP);
  if (!DesignChoiceConstants.MARGIN_AUTO.equals(prop)) {
    if (isPercentageValue(prop) && size.width > 0) {
      px=getMeasure(prop) * size.width / 100;
    }
 else {
      px=DEUtil.convertToPixel(prop,fontSize);
    }
  }
  prop=getHandle().getProperty(StyleHandle.MARGIN_RIGHT_PROP);
  if (!DesignChoiceConstants.MARGIN_AUTO.equals(prop)) {
    if (isPercentageValue(prop) && size.width > 0) {
      py=getMeasure(prop) * size.width / 100;
    }
 else {
      py=DEUtil.convertToPixel(prop,fontSize);
    }
  }
  retValue.left=(int)px;
  retValue.right=(int)py;
  return retValue;
}
Program: 67649
Project: 67649
Buggy source:
public void run(){
  if (!(getModel() instanceof DesignElementHandle)) {
    return;
  }
  if (isDelete()) {
    return;
  }
  EditPart parent=getParent();
  while (parent != null) {
    if (parent instanceof RootEditPart) {
      break;
    }
    parent=parent.getParent();
  }
  if (parent == null) {
    return;
  }
  if (((DeferredGraphicalViewer)getViewer()).getFigureCanvas() == null) {
    return;
  }
  DesignElementHandle handle=(DesignElementHandle)getModel();
  EditPart part=ReportElementEditPart.this;
  while (part != null && !(part instanceof RootEditPart)) {
    part=part.getParent();
  }
  if (getModelAdapter() == null || part == null) {
    return;
  }
  Object[] backGroundPosition=getBackgroundPosition(handle);
  Object xPosition=backGroundPosition[0];
  Object yPosition=backGroundPosition[1];
  boolean needRefresh=false;
  if (xPosition instanceof DimensionValue) {
    needRefresh=true;
  }
  if (yPosition instanceof DimensionValue) {
    needRefresh=true;
  }
  if (needRefresh) {
    refreshVisuals();
  }
}

Fixed version (ground truth):
public void run(){
  if (!(getModel() instanceof DesignElementHandle)) {
    return;
  }
  if (isDelete()) {
    return;
  }
  EditPart parent=getParent();
  while (parent != null) {
    if (parent instanceof RootEditPart) {
      break;
    }
    parent=parent.getParent();
  }
  if (parent == null) {
    return;
  }
  if (((DeferredGraphicalViewer)getViewer()).getFigureCanvas() == null) {
    return;
  }
  DesignElementHandle handle=(DesignElementHandle)getModel();
  EditPart part=ReportElementEditPart.this;
  while (part != null && !(part instanceof RootEditPart)) {
    part=part.getParent();
  }
  if (getModelAdapter() == null || part == null) {
    return;
  }
  Object[] backGroundPosition=getBackgroundPosition(handle);
  Object xPosition=backGroundPosition[0];
  Object yPosition=backGroundPosition[1];
  boolean needRefresh=false;
  if (xPosition instanceof DimensionValue) {
    needRefresh=true;
  }
  if (yPosition instanceof DimensionValue) {
    needRefresh=true;
  }
  if (isPercentageValue(handle.getProperty(StyleHandle.MARGIN_LEFT_PROP))) {
    needRefresh=true;
  }
  if (isPercentageValue(handle.getProperty(StyleHandle.MARGIN_RIGHT_PROP))) {
    needRefresh=true;
  }
  if (needRefresh) {
    refreshVisuals();
  }
}
Program: 67650
Project: 67650
Buggy source:
/** 
 * Refresh Margin property for this element.
 */
protected void refreshMargin(){
  if (getFigure() instanceof IReportElementFigure) {
    ((IReportElementFigure)getFigure()).setMargin(getModelAdapter().getMargin(null));
  }
}

Fixed version (ground truth):
/** 
 * Refresh Margin property for this element.
 */
protected void refreshMargin(){
  if (getFigure() instanceof IReportElementFigure) {
    if (isFixLayout() && getFigure().getParent() != null) {
      ((IReportElementFigure)getFigure()).setMargin(getModelAdapter().getMargin(null,getFigure().getParent().getClientArea().getSize()));
    }
 else {
      ((IReportElementFigure)getFigure()).setMargin(getModelAdapter().getMargin(null));
    }
  }
}
Program: 67652
Project: 67652
Buggy source:
/** 
 * Returns a brighter fill.
 * @param fill
 * @return brighter color or image
 */
public static Fill getBrighterFill(Fill fill){
  if (fill instanceof ColorDefinition) {
    return goFactory.brighter((ColorDefinition)fill);
  }
  if (fill instanceof Gradient) {
    ColorDefinition cdStart=((Gradient)fill).getStartColor();
    ColorDefinition cdEnd=((Gradient)fill).getEndColor();
    return goFactory.createGradient(goFactory.brighter(cdStart),goFactory.brighter(cdEnd));
  }
  if (fill instanceof MultipleFill) {
    List<Fill> fills=((MultipleFill)fill).getFills();
    ColorDefinition cd0=(ColorDefinition)fills.get(0);
    ColorDefinition cd1=(ColorDefinition)fills.get(1);
    MultipleFill newFill=MultipleFillImpl.create();
    newFill.getFills().add(goFactory.brighter(cd0));
    newFill.getFills().add(goFactory.brighter(cd1));
    return newFill;
  }
  if (fill instanceof Image) {
    return fill;
  }
  return fill;
}

Fixed version (ground truth):
/** 
 * Returns a brighter fill.
 * @param fill
 * @return brighter color or image
 */
public static Fill getBrighterFill(Fill fill){
  if (fill instanceof ColorDefinition) {
    return goFactory.brighter((ColorDefinition)fill);
  }
  if (fill instanceof Gradient) {
    ColorDefinition cdStart=((Gradient)fill).getStartColor();
    ColorDefinition cdEnd=((Gradient)fill).getEndColor();
    return goFactory.createGradient(goFactory.brighter(cdStart),goFactory.brighter(cdEnd));
  }
  if (fill instanceof MultipleFill) {
    List<Fill> fills=((MultipleFill)fill).getFills();
    MultipleFill newFill=MultipleFillImpl.create();
    for (    Fill fill_i : fills) {
      newFill.getFills().add(getBrighterFill(fill_i));
    }
    return newFill;
  }
  if (fill instanceof Image) {
    return fill.copyInstance();
  }
  return fill;
}
Program: 67653
Project: 67653
Buggy source:
/** 
 * Returns a color from various Fill.
 * @param fill
 * @param bSelBrighter , true if brighter color will be selected.
 * @return color
 * @since 2.5.1
 */
public static ColorDefinition getColor(Fill fill,boolean bSelBrighter){
  if (fill instanceof ColorDefinition) {
    return goFactory.copyOf(((ColorDefinition)fill));
  }
  if (fill instanceof Gradient) {
    ColorDefinition cdStart=((Gradient)fill).getStartColor();
    ColorDefinition cdEnd=((Gradient)fill).getEndColor();
    return goFactory.copyOf(getSortedColors(bSelBrighter,cdStart,cdEnd));
  }
  if (fill instanceof Image) {
    return goFactory.createColorDefinition(192,192,192);
  }
  if (fill instanceof MultipleFill) {
    List<Fill> fills=((MultipleFill)fill).getFills();
    ColorDefinition cdStart=(ColorDefinition)fills.get(0);
    ColorDefinition cdEnd=(ColorDefinition)fills.get(fills.size() - 1);
    return goFactory.copyOf(getSortedColors(bSelBrighter,cdStart,cdEnd));
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns a color from various Fill.
 * @param fill
 * @param bSelBrighter , true if brighter color will be selected.
 * @return color
 * @since 2.5.1
 */
public static ColorDefinition getColor(Fill fill,boolean bSelBrighter){
  if (fill instanceof ColorDefinition) {
    return goFactory.copyOf(((ColorDefinition)fill));
  }
  if (fill instanceof Gradient) {
    ColorDefinition cdStart=((Gradient)fill).getStartColor();
    ColorDefinition cdEnd=((Gradient)fill).getEndColor();
    return goFactory.copyOf(getSortedColors(bSelBrighter,cdStart,cdEnd));
  }
  if (fill instanceof Image) {
    return goFactory.createColorDefinition(192,192,192);
  }
  if (fill instanceof MultipleFill) {
    List<Fill> fills=((MultipleFill)fill).getFills();
    ColorDefinition cdStart=getColor(fills.get(0));
    ColorDefinition cdEnd=getColor(fills.get(fills.size() - 1));
    return goFactory.copyOf(getSortedColors(bSelBrighter,cdStart,cdEnd));
  }
  return null;
}
Program: 67654
Project: 67654
Buggy source:
public static Fill changeBrightness(Fill fill,double brightness){
  if (fill instanceof ColorDefinition) {
    ColorDefinition new_fill=goFactory.copyOf((ColorDefinition)fill);
    applyBrightness(new_fill,brightness);
    return new_fill;
  }
 else {
    return fill;
  }
}

Fixed version (ground truth):
public static Fill changeBrightness(Fill fill,double brightness){
  if (fill instanceof ColorDefinition) {
    ColorDefinition new_fill=goFactory.copyOf((ColorDefinition)fill);
    applyBrightness(new_fill,brightness);
    return new_fill;
  }
  return fill;
}
Program: 67655
Project: 67655
Buggy source:
public static Fill convertFillToGradient3D(Fill fill,boolean bTransposed){
  if (fill instanceof ColorDefinition) {
    Gradient gradient=AttributeFactory.eINSTANCE.createGradient();
    ColorDefinition newStartColor=(ColorDefinition)changeBrightness(fill,0.95);
    gradient.setStartColor(newStartColor);
    ColorDefinition newColor=(ColorDefinition)changeBrightness(fill,0.65);
    gradient.setEndColor(newColor);
    return gradient;
  }
 else {
    return convertFillToGradient(fill,bTransposed);
  }
}

Fixed version (ground truth):
public static Fill convertFillToGradient3D(Fill fill,boolean bTransposed){
  if (fill instanceof ColorDefinition) {
    Gradient gradient=AttributeFactory.eINSTANCE.createGradient();
    ColorDefinition newStartColor=(ColorDefinition)changeBrightness(fill,0.95);
    gradient.setStartColor(newStartColor);
    ColorDefinition newColor=(ColorDefinition)changeBrightness(fill,0.65);
    gradient.setEndColor(newColor);
    return gradient;
  }
  return convertFillToGradient(fill,bTransposed);
}
Program: 67656
Project: 67656
Buggy source:
/** 
 * Returns a darker color.
 * @param fill
 * @return darker color
 */
public static ColorDefinition getDarkerColor(Fill fill){
  if (fill instanceof ColorDefinition) {
    return goFactory.darker((ColorDefinition)fill);
  }
  if (fill instanceof Gradient) {
    ColorDefinition cdStart=((Gradient)fill).getStartColor();
    ColorDefinition cdEnd=((Gradient)fill).getEndColor();
    return goFactory.darker(getSortedColors(false,cdStart,cdEnd));
  }
  if (fill instanceof Image) {
    return goFactory.createColorDefinition(128,128,128);
  }
  if (fill instanceof MultipleFill) {
    List<Fill> fills=((MultipleFill)fill).getFills();
    ColorDefinition cd0=(ColorDefinition)fills.get(0);
    ColorDefinition cd1=(ColorDefinition)fills.get(1);
    return goFactory.darker(getSortedColors(false,cd0,cd1));
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns a darker color.
 * @param fill
 * @return darker color
 */
public static ColorDefinition getDarkerColor(Fill fill){
  if (fill instanceof ColorDefinition) {
    return goFactory.darker((ColorDefinition)fill);
  }
  if (fill instanceof Gradient) {
    ColorDefinition cdStart=((Gradient)fill).getStartColor();
    ColorDefinition cdEnd=((Gradient)fill).getEndColor();
    return goFactory.darker(getSortedColors(false,cdStart,cdEnd));
  }
  if (fill instanceof Image) {
    return goFactory.createColorDefinition(128,128,128);
  }
  if (fill instanceof MultipleFill) {
    List<Fill> fills=((MultipleFill)fill).getFills();
    ColorDefinition cd0=getColor(fills.get(0));
    ColorDefinition cd1=getColor(fills.get(1));
    return goFactory.darker(getSortedColors(false,cd0,cd1));
  }
  return null;
}
Program: 67657
Project: 67657
Buggy source:
/** 
 * Returns a brighter color.
 * @param fill
 * @return brighter color
 */
public static ColorDefinition getBrighterColor(Fill fill){
  if (fill instanceof ColorDefinition) {
    return goFactory.brighter(((ColorDefinition)fill));
  }
  if (fill instanceof Gradient) {
    ColorDefinition cdStart=((Gradient)fill).getStartColor();
    ColorDefinition cdEnd=((Gradient)fill).getEndColor();
    return goFactory.brighter(getSortedColors(true,cdStart,cdEnd));
  }
  if (fill instanceof Image) {
    return goFactory.createColorDefinition(192,192,192);
  }
  if (fill instanceof MultipleFill) {
    List<Fill> fills=((MultipleFill)fill).getFills();
    ColorDefinition cd0=(ColorDefinition)fills.get(0);
    ColorDefinition cd1=(ColorDefinition)fills.get(1);
    return goFactory.brighter(getSortedColors(true,cd0,cd1));
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns a brighter color.
 * @param fill
 * @return brighter color
 */
public static ColorDefinition getBrighterColor(Fill fill){
  if (fill instanceof ColorDefinition) {
    return goFactory.brighter(((ColorDefinition)fill));
  }
  if (fill instanceof Gradient) {
    ColorDefinition cdStart=((Gradient)fill).getStartColor();
    ColorDefinition cdEnd=((Gradient)fill).getEndColor();
    return goFactory.brighter(getSortedColors(true,cdStart,cdEnd));
  }
  if (fill instanceof Image) {
    return goFactory.createColorDefinition(192,192,192);
  }
  if (fill instanceof MultipleFill) {
    List<Fill> fills=((MultipleFill)fill).getFills();
    ColorDefinition cd0=getColor(fills.get(0));
    ColorDefinition cd1=getColor(fills.get(1));
    return goFactory.brighter(getSortedColors(true,cd0,cd1));
  }
  return null;
}
Program: 67658
Project: 67658
Buggy source:
/** 
 * Returns a darker fill.
 * @param fill
 * @return darker color or image
 */
public static Fill getDarkerFill(Fill fill){
  if (fill instanceof ColorDefinition) {
    return goFactory.darker((ColorDefinition)fill);
  }
  if (fill instanceof Gradient) {
    ColorDefinition cdStart=((Gradient)fill).getStartColor();
    ColorDefinition cdEnd=((Gradient)fill).getEndColor();
    return goFactory.createGradient(goFactory.darker(cdStart),goFactory.darker(cdEnd));
  }
  if (fill instanceof MultipleFill) {
    List<Fill> fills=((MultipleFill)fill).getFills();
    ColorDefinition cd0=(ColorDefinition)fills.get(0);
    ColorDefinition cd1=(ColorDefinition)fills.get(1);
    MultipleFill newFill=MultipleFillImpl.create();
    newFill.getFills().add(goFactory.darker(cd0));
    newFill.getFills().add(goFactory.darker(cd1));
    return newFill;
  }
  if (fill instanceof Image) {
    return fill;
  }
  return fill;
}

Fixed version (ground truth):
/** 
 * Returns a darker fill.
 * @param fill
 * @return darker color or image
 */
public static Fill getDarkerFill(Fill fill){
  if (fill instanceof ColorDefinition) {
    return goFactory.darker((ColorDefinition)fill);
  }
  if (fill instanceof Gradient) {
    ColorDefinition cdStart=((Gradient)fill).getStartColor();
    ColorDefinition cdEnd=((Gradient)fill).getEndColor();
    return goFactory.createGradient(goFactory.darker(cdStart),goFactory.darker(cdEnd));
  }
  if (fill instanceof MultipleFill) {
    List<Fill> fills=((MultipleFill)fill).getFills();
    MultipleFill newFill=MultipleFillImpl.create();
    for (    Fill fill_i : fills) {
      newFill.getFills().add(getDarkerFill(fill_i));
    }
    return newFill;
  }
  if (fill instanceof Image) {
    return fill.copyInstance();
  }
  return fill;
}
Program: 67661
Project: 67661
Buggy source:
private void preview(String uri){
  try {
    previewCanvas.loadImage(new URL(uri));
  }
 catch (  Exception e) {
    logger.log(e);
  }
}

Fixed version (ground truth):
private void preview(String uri){
  previewCanvas.update(uri);
}
Program: 67662
Project: 67662
Buggy source:
private void updateButtons(){
  boolean complete=uriEditor.getText() != null && uriEditor.getText().trim().length() > 0;
  URL url=null;
  try {
    url=new URL(removeQuote(uriEditor.getText().trim()));
    if (selectedType == EMBEDDED_TYPE) {
      File file=new File(url.getPath());
      complete=file.exists() && file.isAbsolute();
    }
  }
 catch (  Exception e) {
    complete=false;
  }
  previewButton.setEnabled(complete);
  getButton(IDialogConstants.OK_ID).setEnabled(complete);
  if (!complete) {
    previewCanvas.clear();
  }
  browseButton.setVisible(embedded.getSelection());
}

Fixed version (ground truth):
private void updateButtons(){
  boolean complete=uriEditor.getText() != null && uriEditor.getText().trim().length() > 0;
  URL url=null;
  try {
    url=new URL(removeQuote(uriEditor.getText().trim()));
    if (selectedType == EMBEDDED_TYPE) {
      File file=new File(url.getPath());
      complete=file.exists() && file.isAbsolute();
    }
  }
 catch (  Exception e) {
    complete=false;
  }
  previewButton.setEnabled(complete);
  getButton(IDialogConstants.OK_ID).setEnabled(complete);
  if (!complete) {
  }
  browseButton.setVisible(embedded.getSelection());
}
Program: 67663
Project: 67663
Buggy source:
private void createPreviewArea(Composite composite){
  Composite previewArea=new Composite(composite,SWT.BORDER);
  GridData gd=new GridData(GridData.FILL_BOTH);
  gd.widthHint=250;
  gd.heightHint=300;
  previewArea.setLayoutData(gd);
  previewArea.setLayout(new FillLayout());
  previewCanvas=new IconCanvas(previewArea);
}

Fixed version (ground truth):
private void createPreviewArea(Composite composite){
  Composite previewArea=new Composite(composite,SWT.BORDER);
  GridData gd=new GridData(GridData.FILL_BOTH);
  gd.widthHint=250;
  gd.heightHint=300;
  previewArea.setLayoutData(gd);
  previewArea.setLayout(new FillLayout());
  previewCanvas=new ImageCanvas(previewArea);
}
Program: 67664
Project: 67664
Buggy source:
protected boolean initDialog(){
  getShell().setText(Messages.getString("String_Node_Str"));
  initURIEditor();
  if (fCurrent instanceof EmbeddedImage) {
    embedded.setSelection(true);
    selectedType=EMBEDDED_TYPE;
  }
 else {
    uri.setSelection(true);
    selectedType=URI_TYPE;
  }
  if (selectedType == EMBEDDED_TYPE) {
    title.setText(Messages.getString("String_Node_Str"));
  }
 else {
    title.setText(Messages.getString("String_Node_Str"));
  }
  getButton(IDialogConstants.OK_ID).setEnabled(false);
  browseButton.setVisible(embedded.getSelection());
  return true;
}

Fixed version (ground truth):
protected boolean initDialog(){
  getShell().setText(Messages.getString("String_Node_Str"));
  initURIEditor();
  if (fCurrent instanceof EmbeddedImage) {
    embedded.setSelection(true);
    selectedType=EMBEDDED_TYPE;
  }
 else {
    uri.setSelection(true);
    selectedType=URI_TYPE;
  }
  if (selectedType == EMBEDDED_TYPE) {
    title.setText(Messages.getString("String_Node_Str"));
  }
 else {
    title.setText(Messages.getString("String_Node_Str"));
  }
  getButton(IDialogConstants.OK_ID).setEnabled(false);
  browseButton.setVisible(embedded.getSelection());
  initPreview();
  return true;
}
Program: 67665
Project: 67665
Buggy source:
private void initURIEditor(){
  String uri="String_Node_Str";
  if (fCurrent instanceof Image && !(fCurrent instanceof PatternImage)) {
    uri=((Image)fCurrent).getURL();
    if (fCurrent instanceof EmbeddedImage) {
      imageData=((EmbeddedImage)fCurrent).getData();
    }
  }
  uriEditor.setText(uri);
  uriEditor.setFocus();
  clearPreview();
}

Fixed version (ground truth):
private void initURIEditor(){
  String uri="String_Node_Str";
  if (fCurrent instanceof Image && !(fCurrent instanceof PatternImage)) {
    uri=((Image)fCurrent).getURL();
    if (fCurrent instanceof EmbeddedImage) {
      imageData=((EmbeddedImage)fCurrent).getData();
    }
  }
  uriEditor.setText(uri);
  uriEditor.setFocus();
}
Program: 67666
Project: 67666
Buggy source:
public void shellClosed(ShellEvent e){
  clearColorSelection();
}

Fixed version (ground truth):
@Override public void shellClosed(ShellEvent e){
  clearColorSelection();
}
Program: 67668
Project: 67668
Buggy source:
/** 
 * @param parent
 * @param style
 * @param wizardContext
 * @param fCurrent If null, create a Fill using adapters from wizard context
 * @param bEnableGradient
 * @param bEnableImage
 * @param bEnableAuto Indicates whether auto button will be displayed.
 * @param bEnableTransparent Indicates whether transparent button will be displayed.
 * @param bPositiveNegative Indicates whether positive/negative button will be displayed.
 */
public FillChooserComposite(Composite parent,int style,ChartWizardContext wizardContext,Fill fCurrent,boolean bEnableGradient,boolean bEnableImage,boolean bEnableAuto,boolean bEnableTransparent,boolean bPositiveNegative){
  super(parent,style);
  this.fCurrent=fCurrent;
  this.bGradientEnabled=bEnableGradient;
  this.bImageEnabled=bEnableImage;
  this.bAutoEnabled=bEnableAuto;
  this.bTransparentEnabled=bEnableTransparent;
  this.bPositiveNegativeEnabled=bPositiveNegative;
  this.wizardContext=wizardContext;
  init();
  placeComponents();
  initAccessible();
}

Fixed version (ground truth):
/** 
 * @param parent
 * @param style
 * @param wizardContext
 * @param fCurrent If null, create a Fill using adapters from wizard context
 * @param bEnableGradient
 * @param bEnableImage
 * @param bEnableAuto Indicates whether auto button will be displayed.
 * @param bEnableTransparent Indicates whether transparent button will be displayed.
 * @param bPositiveNegative Indicates whether positive/negative button will be displayed.
 */
public FillChooserComposite(Composite parent,int style,ChartWizardContext wizardContext,Fill fCurrent,boolean bEnableGradient,boolean bEnableImage,boolean bEnableAuto,boolean bEnableTransparent,boolean bPositiveNegative,boolean bEnablePattern){
  super(parent,style);
  this.fCurrent=fCurrent;
  this.bGradientEnabled=bEnableGradient;
  this.bImageEnabled=bEnableImage;
  this.bAutoEnabled=bEnableAuto;
  this.bTransparentEnabled=bEnableTransparent;
  this.bPositiveNegativeEnabled=bPositiveNegative;
  this.bPatternFillEnabled=bEnablePattern;
  this.wizardContext=wizardContext;
  init();
  placeComponents();
  initAccessible();
}
Program: 67669
Project: 67669
Buggy source:
public void setEnabled(boolean bState){
  btnDown.setEnabled(bState);
  cnvSelection.setEnabled(bState);
  cnvSelection.redraw();
  this.bEnabled=bState;
}

Fixed version (ground truth):
@Override public void setEnabled(boolean bState){
  btnDown.setEnabled(bState);
  cnvSelection.setEnabled(bState);
  cnvSelection.redraw();
  this.bEnabled=bState;
}
Program: 67670
Project: 67670
Buggy source:
public boolean isEnabled(){
  return this.bEnabled;
}

Fixed version (ground truth):
@Override public boolean isEnabled(){
  return this.bEnabled;
}
Program: 67673
Project: 67673
Buggy source:
public ImageData(IImageContent image,int styleId,int datatype,Image imageInfo,XlsContainer currentContainer,int heightDpi,int widthDpi){
  super();
  this.dataType=datatype;
  this.styleId=styleId;
  height=ExcelUtil.convertDimensionType(image.getHeight(),imageInfo.getHeight() * 1000 * ExcelUtil.INCH_PT / heightDpi,heightDpi) / 1000;
  imageHeight=(int)height;
  int imageWidth=(int)ExcelUtil.convertDimensionType(image.getWidth(),imageInfo.getWidth() * 1000 * ExcelUtil.INCH_PT / widthDpi,widthDpi);
  width=Math.min(currentContainer.getSizeInfo().getWidth(),imageWidth);
  altText=image.getAltText();
  imageUrl=image.getURI();
  this.imageData=imageInfo.getData();
  rowSpanInDesign=0;
  this.imageInfo=imageInfo;
}

Fixed version (ground truth):
public ImageData(IImageContent image,int imageWidth,int styleId,int datatype,Image imageInfo,XlsContainer currentContainer,int heightDpi,int widthDpi){
  super();
  this.dataType=datatype;
  this.styleId=styleId;
  height=ExcelUtil.convertDimensionType(image.getHeight(),imageInfo.getHeight() * 1000 * ExcelUtil.INCH_PT / heightDpi,heightDpi) / 1000;
  imageHeight=(int)height;
  width=Math.min(currentContainer.getSizeInfo().getWidth(),imageWidth);
  altText=image.getAltText();
  imageUrl=image.getURI();
  this.imageData=imageInfo.getData();
  rowSpanInDesign=0;
  this.imageInfo=imageInfo;
}
Program: 67674
Project: 67674
Buggy source:
private SheetData createImageData(IImageContent image,StyleEntry entry,XlsContainer container,int imageHeightDpi,int imageWidhtDpi){
  int type=SheetData.IMAGE;
  entry.setProperty(StyleConstant.DATA_TYPE_PROP,type);
  String uri=image.getURI();
  String mimeType=image.getMIMEType();
  String extension=image.getExtension();
  String altText=image.getAltText();
  if (FlashFile.isFlash(mimeType,uri,extension)) {
    if (null == altText) {
      altText=messageFlashObjectNotSupported;
    }
    entry.setProperty(StyleConstant.DATA_TYPE_PROP,SheetData.STRING);
    return createData(altText,entry);
  }
  try {
    Image imageInfo=EmitterUtil.parseImage(image,image.getImageSource(),image.getURI(),image.getMIMEType(),image.getExtension());
    byte[] data=imageInfo.getData();
    if (data != null) {
      return createData(image,entry,container,type,imageInfo,imageHeightDpi,imageWidhtDpi);
    }
 else {
      entry.setProperty(StyleConstant.DATA_TYPE_PROP,SheetData.STRING);
      return createData(image.getAltText(),entry);
    }
  }
 catch (  IOException e) {
    logger.log(Level.WARNING,e.getLocalizedMessage());
    entry.setProperty(StyleConstant.DATA_TYPE_PROP,SheetData.STRING);
    return createData(image.getAltText(),entry);
  }
}

Fixed version (ground truth):
private SheetData createImageData(IImageContent image,int imageWidth,StyleEntry entry,XlsContainer container,int imageHeightDpi,int imageWidhtDpi){
  int type=SheetData.IMAGE;
  entry.setProperty(StyleConstant.DATA_TYPE_PROP,type);
  String uri=image.getURI();
  String mimeType=image.getMIMEType();
  String extension=image.getExtension();
  String altText=image.getAltText();
  if (FlashFile.isFlash(mimeType,uri,extension)) {
    if (null == altText) {
      altText=messageFlashObjectNotSupported;
    }
    entry.setProperty(StyleConstant.DATA_TYPE_PROP,SheetData.STRING);
    return createData(altText,entry);
  }
  try {
    Image imageInfo=EmitterUtil.parseImage(image,image.getImageSource(),image.getURI(),image.getMIMEType(),image.getExtension());
    byte[] data=imageInfo.getData();
    if (data != null) {
      return createData(image,imageWidth,entry,container,type,imageInfo,imageHeightDpi,imageWidhtDpi);
    }
 else {
      entry.setProperty(StyleConstant.DATA_TYPE_PROP,SheetData.STRING);
      return createData(image.getAltText(),entry);
    }
  }
 catch (  IOException e) {
    logger.log(Level.WARNING,e.getLocalizedMessage());
    entry.setProperty(StyleConstant.DATA_TYPE_PROP,SheetData.STRING);
    return createData(image.getAltText(),entry);
  }
}