nus-yam/ex-repair huggingface dataset:
Program: 70695
Project: 70695
Buggy source:
private void writeHyperlinkStyle(boolean isHyperlink){
  if (isHyperlink) {
    writeAttrTag("String_Node_Str","String_Node_Str");
    writeAttrTag("String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
private void writeHyperlinkStyle(boolean isHyperlink,IStyle style){
  if (isHyperlink) {
    writeAttrTag("String_Node_Str","String_Node_Str");
  }
 else {
    writeTextUnderline(style);
    writeTextColor(style);
  }
}
Program: 70697
Project: 70697
Buggy source:
private static Series copyInstanceThis(Series src){
  if (src == null) {
    return null;
  }
  SeriesImpl dest=new SeriesImpl();
  if (src.getLabel() != null) {
    dest.setLabel(LabelImpl.copyInstance(src.getLabel()));
  }
  if (src.getDataDefinition() != null) {
    EList<Query> list=dest.getDataDefinition();
    for (    Query element : src.getDataDefinition()) {
      list.add(QueryImpl.copyInstance(element));
    }
  }
  if (src.getDataPoint() != null) {
    dest.setDataPoint(DataPointImpl.copyInstance(src.getDataPoint()));
  }
  if (src.getDataSets() != null) {
    EMap<String,DataSet> map=dest.getDataSets();
    map.putAll(src.getDataSets());
  }
  if (src.getTriggers() != null) {
    EList<Trigger> list=dest.getTriggers();
    for (    Trigger element : src.getTriggers()) {
      list.add(TriggerImpl.copyInstance(element));
    }
  }
  if (src.getCurveFitting() != null) {
    dest.setCurveFitting(CurveFittingImpl.copyInstance(src.getCurveFitting()));
  }
  if (src.getCursor() != null) {
    dest.setCursor(CursorImpl.copyInstance(src.getCursor()));
  }
  dest.visible=src.isVisible();
  dest.visibleESet=src.isSetVisible();
  dest.seriesIdentifier=src.getSeriesIdentifier();
  dest.labelPosition=src.getLabelPosition();
  dest.labelPositionESet=src.isSetLabelPosition();
  dest.stacked=src.isStacked();
  dest.stackedESet=src.isSetStacked();
  dest.translucent=src.isTranslucent();
  dest.translucentESet=src.isSetTranslucent();
  return dest;
}

Fixed version (ground truth):
private static Series copyInstanceThis(Series src){
  if (src == null) {
    return null;
  }
  SeriesImpl dest=new SeriesImpl();
  if (src.getLabel() != null) {
    dest.setLabel(LabelImpl.copyInstance(src.getLabel()));
  }
  if (src.getDataDefinition() != null) {
    EList<Query> list=dest.getDataDefinition();
    for (    Query element : src.getDataDefinition()) {
      list.add(QueryImpl.copyInstance(element));
    }
  }
  if (src.getDataPoint() != null) {
    dest.setDataPoint(DataPointImpl.copyInstance(src.getDataPoint()));
  }
  if (src.getDataSets() != null) {
    EMap<String,DataSet> map=dest.getDataSets();
    for (    Map.Entry<String,DataSet> entry : src.getDataSets().entrySet()) {
      map.put(entry.getKey(),DataSetImpl.copyInstance(entry.getValue()));
    }
  }
  if (src.getTriggers() != null) {
    EList<Trigger> list=dest.getTriggers();
    for (    Trigger element : src.getTriggers()) {
      list.add(TriggerImpl.copyInstance(element));
    }
  }
  if (src.getCurveFitting() != null) {
    dest.setCurveFitting(CurveFittingImpl.copyInstance(src.getCurveFitting()));
  }
  if (src.getCursor() != null) {
    dest.setCursor(CursorImpl.copyInstance(src.getCursor()));
  }
  dest.visible=src.isVisible();
  dest.visibleESet=src.isSetVisible();
  dest.seriesIdentifier=src.getSeriesIdentifier();
  dest.labelPosition=src.getLabelPosition();
  dest.labelPositionESet=src.isSetLabelPosition();
  dest.stacked=src.isStacked();
  dest.stackedESet=src.isSetStacked();
  dest.translucent=src.isTranslucent();
  dest.translucentESet=src.isSetTranslucent();
  return dest;
}
Program: 70700
Project: 70700
Buggy source:
public static int covertDimensionType(DimensionType value,int parent){
  if (DimensionType.UNITS_PERCENTAGE.equals(value.getUnits())) {
    return (int)(value.getMeasure() / 100 * parent);
  }
 else {
    return (int)(value.convertTo(DimensionType.UNITS_PT));
  }
}

Fixed version (ground truth):
public static int covertDimensionType(DimensionType value,int parent){
  if (DimensionType.UNITS_PERCENTAGE.equals(value.getUnits())) {
    return (int)(value.getMeasure() / 100 * parent);
  }
  if (DimensionType.UNITS_PX.equalsIgnoreCase(value.getUnits())) {
    return (int)(value.getMeasure() * PX_PT);
  }
  if (DimensionType.UNITS_EM.equalsIgnoreCase(value.getUnits()) || DimensionType.UNITS_EX.equalsIgnoreCase(value.getUnits())) {
    return (int)value.getMeasure() * 12;
  }
 else {
    return (int)(value.convertTo(DimensionType.UNITS_PT));
  }
}
Program: 70702
Project: 70702
Buggy source:
public void setHyperlinkDef(HyperlinkDef def){
  this.hyperLink=def;
  if (hyperLink != null) {
    style.setProperty(StyleConstant.COLOR_PROP,HYPERLINK_COLOR);
    style.setProperty(StyleConstant.TEXT_UNDERLINE_PROP,HYPERLINK_UNDERLINE);
  }
}

Fixed version (ground truth):
public void setHyperlinkDef(HyperlinkDef def){
  this.hyperLink=def;
  if (hyperLink != null) {
    style.setProperty(StyleConstant.COLOR_PROP,HYPERLINK_COLOR);
    style.setProperty(StyleConstant.TEXT_UNDERLINE_PROP,HYPERLINK_UNDERLINE);
    style.setName(StyleEntry.ENTRYNAME_HYPERLINK);
  }
}
Program: 70703
Project: 70703
Buggy source:
boolean visitScalarParameter(ScalarParameterHandle param,Object userData){
  String name=param.getName();
  if (!inputValues.containsKey(name)) {
    Object value=convertToType(param.getDefaultValue(),param.getDataType());
    executionContext.setParameterValue(name,value);
    runValues.put(name,value);
  }
  return true;
}

Fixed version (ground truth):
boolean visitScalarParameter(ScalarParameterHandle param,Object userData){
  String name=param.getName();
  if (!inputValues.containsKey(name)) {
    Object value=convertToType(param.getDefaultValueList(),param.getDataType(),param.getParamType());
    executionContext.setParameterValue(name,value);
    runValues.put(name,value);
  }
  return true;
}
Program: 70704
Project: 70704
Buggy source:
/** 
 * use the user setting parameters values to setup the execution context. the user setting values and default values are merged here.
 */
protected void usingParameterValues(){
  if (!parameterChanged) {
    return;
  }
  parameterChanged=false;
  executionContext.clearParameters();
  runValues.clear();
  Iterator iterator=inputValues.entrySet().iterator();
  while (iterator.hasNext()) {
    Map.Entry entry=(Map.Entry)iterator.next();
    Object key=entry.getKey();
    ParameterAttribute attribute=(ParameterAttribute)entry.getValue();
    runValues.put(key,attribute.getValue());
    executionContext.setParameter((String)key,attribute.getValue(),attribute.getDisplayText());
  }
  IReportRunnable runnable=executionContext.getRunnable();
  if (runnable == null) {
    return;
  }
  new ParameterVisitor(){
    boolean visitScalarParameter(    ScalarParameterHandle param,    Object userData){
      String name=param.getName();
      if (!inputValues.containsKey(name)) {
        Object value=convertToType(param.getDefaultValue(),param.getDataType());
        executionContext.setParameterValue(name,value);
        runValues.put(name,value);
      }
      return true;
    }
    boolean visitParameterGroup(    ParameterGroupHandle group,    Object value){
      return visitParametersInGroup(group,value);
    }
  }
.visit((ReportDesignHandle)runnable.getDesignHandle());
}

Fixed version (ground truth):
/** 
 * use the user setting parameters values to setup the execution context. the user setting values and default values are merged here.
 */
protected void usingParameterValues(){
  if (!parameterChanged) {
    return;
  }
  parameterChanged=false;
  executionContext.clearParameters();
  runValues.clear();
  Iterator iterator=inputValues.entrySet().iterator();
  while (iterator.hasNext()) {
    Map.Entry entry=(Map.Entry)iterator.next();
    Object key=entry.getKey();
    ParameterAttribute attribute=(ParameterAttribute)entry.getValue();
    runValues.put(key,attribute.getValue());
    executionContext.setParameter((String)key,attribute.getValue(),attribute.getDisplayText());
  }
  IReportRunnable runnable=executionContext.getRunnable();
  if (runnable == null) {
    return;
  }
  new ParameterVisitor(){
    boolean visitScalarParameter(    ScalarParameterHandle param,    Object userData){
      String name=param.getName();
      if (!inputValues.containsKey(name)) {
        Object value=convertToType(param.getDefaultValueList(),param.getDataType(),param.getParamType());
        executionContext.setParameterValue(name,value);
        runValues.put(name,value);
      }
      return true;
    }
    boolean visitParameterGroup(    ParameterGroupHandle group,    Object value){
      return visitParametersInGroup(group,value);
    }
  }
.visit((ReportDesignHandle)runnable.getDesignHandle());
}
Program: 70705
Project: 70705
Buggy source:
protected Object convertToType(Object value,String type){
  try {
    return convertParameterType(value,type);
  }
 catch (  BirtException e) {
    log.log(Level.SEVERE,e.getLocalizedMessage(),e);
  }
  return null;
}

Fixed version (ground truth):
protected Object convertToType(List<String> values,String type,String paramType){
  if (values == null) {
    return null;
  }
  try {
    if (DesignChoiceConstants.SCALAR_PARAM_TYPE_MULTI_VALUE.equals(paramType)) {
      List<Object> list=new ArrayList<Object>();
      for (      String string : values) {
        list.add(convertParameterType(string,type));
      }
      return list.toArray();
    }
 else {
      if (values.size() == 0) {
        return null;
      }
      return convertParameterType(values.get(0),type);
    }
  }
 catch (  BirtException e) {
    log.log(Level.SEVERE,e.getLocalizedMessage(),e);
  }
  return null;
}
Program: 70708
Project: 70708
Buggy source:
public HyperlinkDef parseHyperLink(IContent content){
  HyperlinkDef hyperlink=null;
  IHyperlinkAction linkAction=content.getHyperlinkAction();
  if (linkAction != null) {
    String tooltip=linkAction.getTooltip();
    String bookmark=linkAction.getBookmark();
    IReportRunnable reportRunnable=service.getReportRunnable();
    IReportContext reportContext=service.getReportContext();
    IHTMLActionHandler actionHandler=(IHTMLActionHandler)service.getOption(RenderOption.ACTION_HANDLER);
switch (linkAction.getType()) {
case IHyperlinkAction.ACTION_BOOKMARK:
      hyperlink=new HyperlinkDef(bookmark,IHyperlinkAction.ACTION_BOOKMARK,tooltip);
    break;
case IHyperlinkAction.ACTION_HYPERLINK:
  String url=org.eclipse.birt.report.engine.layout.emitter.EmitterUtil.getHyperlinkUrl(linkAction,reportRunnable,actionHandler,reportContext);
hyperlink=new HyperlinkDef(url,IHyperlinkAction.ACTION_HYPERLINK,tooltip);
break;
case IHyperlinkAction.ACTION_DRILLTHROUGH:
url=org.eclipse.birt.report.engine.layout.emitter.EmitterUtil.getHyperlinkUrl(linkAction,reportRunnable,actionHandler,reportContext);
hyperlink=new HyperlinkDef(url,IHyperlinkAction.ACTION_DRILLTHROUGH,tooltip);
break;
}
}
return hyperlink;
}

Fixed version (ground truth):
public HyperlinkDef parseHyperLink(IContent content){
  HyperlinkDef hyperlink=null;
  IHyperlinkAction linkAction=content.getHyperlinkAction();
  if (linkAction != null) {
    String tooltip=linkAction.getTooltip();
    String bookmark=linkAction.getBookmark();
    IReportRunnable reportRunnable=service.getReportRunnable();
    IReportContext reportContext=service.getReportContext();
    IHTMLActionHandler actionHandler=(IHTMLActionHandler)service.getOption(RenderOption.ACTION_HANDLER);
switch (linkAction.getType()) {
case IHyperlinkAction.ACTION_BOOKMARK:
      hyperlink=new HyperlinkDef(bookmark,IHyperlinkAction.ACTION_BOOKMARK,tooltip);
    break;
case IHyperlinkAction.ACTION_HYPERLINK:
  String url=EmitterUtil.getHyperlinkUrl(linkAction,reportRunnable,actionHandler,reportContext);
hyperlink=new HyperlinkDef(url,IHyperlinkAction.ACTION_HYPERLINK,tooltip);
break;
case IHyperlinkAction.ACTION_DRILLTHROUGH:
url=EmitterUtil.getHyperlinkUrl(linkAction,reportRunnable,actionHandler,reportContext);
hyperlink=new HyperlinkDef(url,IHyperlinkAction.ACTION_DRILLTHROUGH,tooltip);
break;
}
}
return hyperlink;
}
Program: 70709
Project: 70709
Buggy source:
private SheetData createImageData(IImageContent image,StyleEntry entry,XlsContainer container){
  int type=SheetData.IMAGE;
  entry.setProperty(StyleConstant.DATA_TYPE_PROP,Integer.toString(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;
    }
    return createData(altText,entry);
  }
  org.eclipse.birt.report.engine.layout.emitter.Image imageInfo=EmitterUtil.parseImage(image,image.getImageSource(),image.getURI(),image.getMIMEType(),image.getExtension());
  byte[] data=imageInfo.getData();
  if (data != null) {
    return new ImageData(image,entry,type,imageInfo,container);
  }
 else {
    return createData(image.getAltText(),entry);
  }
}

Fixed version (ground truth):
private SheetData createImageData(IImageContent image,StyleEntry entry,XlsContainer container){
  int type=SheetData.IMAGE;
  entry.setProperty(StyleConstant.DATA_TYPE_PROP,Integer.toString(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;
    }
    return createData(altText,entry);
  }
  Image imageInfo=EmitterUtil.parseImage(image,image.getImageSource(),image.getURI(),image.getMIMEType(),image.getExtension());
  byte[] data=imageInfo.getData();
  if (data != null) {
    return new ImageData(image,entry,type,imageInfo,container);
  }
 else {
    return createData(image.getAltText(),entry);
  }
}
Program: 70710
Project: 70710
Buggy source:
protected HyperlinkInfo getHyperlink(IContent content){
  HyperlinkInfo hyperlink=null;
  IHyperlinkAction linkAction=content.getHyperlinkAction();
  if (linkAction != null) {
    String tooltip=linkAction.getTooltip();
    String bookmark=linkAction.getBookmark();
switch (linkAction.getType()) {
case IHyperlinkAction.ACTION_BOOKMARK:
      bookmark=bookmark.replaceAll("String_Node_Str","String_Node_Str");
    hyperlink=new HyperlinkInfo(HyperlinkInfo.BOOKMARK,bookmark,tooltip);
  break;
case IHyperlinkAction.ACTION_HYPERLINK:
case IHyperlinkAction.ACTION_DRILLTHROUGH:
String url=org.eclipse.birt.report.engine.layout.emitter.EmitterUtil.getHyperlinkUrl(linkAction,reportRunnable,actionHandler,reportContext);
hyperlink=new HyperlinkInfo(HyperlinkInfo.HYPERLINK,url,tooltip);
break;
}
}
return hyperlink;
}

Fixed version (ground truth):
protected HyperlinkInfo getHyperlink(IContent content){
  HyperlinkInfo hyperlink=null;
  IHyperlinkAction linkAction=content.getHyperlinkAction();
  if (linkAction != null) {
    String tooltip=linkAction.getTooltip();
    String bookmark=linkAction.getBookmark();
switch (linkAction.getType()) {
case IHyperlinkAction.ACTION_BOOKMARK:
      bookmark=bookmark.replaceAll("String_Node_Str","String_Node_Str");
    hyperlink=new HyperlinkInfo(HyperlinkInfo.BOOKMARK,bookmark,tooltip);
  break;
case IHyperlinkAction.ACTION_HYPERLINK:
case IHyperlinkAction.ACTION_DRILLTHROUGH:
String url=EmitterUtil.getHyperlinkUrl(linkAction,reportRunnable,actionHandler,reportContext);
hyperlink=new HyperlinkInfo(HyperlinkInfo.HYPERLINK,url,tooltip);
break;
}
}
return hyperlink;
}
Program: 70711
Project: 70711
Buggy source:
public void startImage(IImageContent image){
  IStyle style=image.getComputedStyle();
  InlineFlag inlineFlag=getInlineFlag(style);
  String uri=image.getURI();
  String mimeType=image.getMIMEType();
  String extension=image.getExtension();
  String altText=image.getAltText();
  if (FlashFile.isFlash(mimeType,uri,extension)) {
    if (altText == null) {
      altText=messageFlashObjectNotSupported;
    }
    wordWriter.drawImage(null,0.0,0.0,null,style,inlineFlag,altText,uri);
    return;
  }
  Image imageInfo=org.eclipse.birt.report.engine.layout.emitter.EmitterUtil.parseImage(image,image.getImageSource(),uri,mimeType,extension);
  byte[] data=imageInfo.getData();
  if (data == null || data.length == 0) {
    wordWriter.drawImage(null,0.0,0.0,null,style,inlineFlag,altText,uri);
    return;
  }
  double height=WordUtil.convertImageSize(image.getHeight(),imageInfo.getHeight());
  double width=WordUtil.convertImageSize(image.getWidth(),imageInfo.getWidth());
  writeBookmark(image);
  writeToc(image);
  HyperlinkInfo hyper=getHyperlink(image);
  wordWriter.drawImage(data,height,width,hyper,style,inlineFlag,altText,uri);
}

Fixed version (ground truth):
public void startImage(IImageContent image){
  IStyle style=image.getComputedStyle();
  InlineFlag inlineFlag=getInlineFlag(style);
  String uri=image.getURI();
  String mimeType=image.getMIMEType();
  String extension=image.getExtension();
  String altText=image.getAltText();
  if (FlashFile.isFlash(mimeType,uri,extension)) {
    if (altText == null) {
      altText=messageFlashObjectNotSupported;
    }
    wordWriter.drawImage(null,0.0,0.0,null,style,inlineFlag,altText,uri);
    return;
  }
  Image imageInfo=EmitterUtil.parseImage(image,image.getImageSource(),uri,mimeType,extension);
  byte[] data=imageInfo.getData();
  if (data == null || data.length == 0) {
    wordWriter.drawImage(null,0.0,0.0,null,style,inlineFlag,altText,uri);
    return;
  }
  double height=WordUtil.convertImageSize(image.getHeight(),imageInfo.getHeight());
  double width=WordUtil.convertImageSize(image.getWidth(),imageInfo.getWidth());
  writeBookmark(image);
  writeToc(image);
  HyperlinkInfo hyper=getHyperlink(image);
  wordWriter.drawImage(data,height,width,hyper,style,inlineFlag,altText,uri);
}
Program: 70712
Project: 70712
Buggy source:
/** 
 * Transfer background for current page to Doc format. Now, the exported file will apply the first background properties, and followed background will ignore. In addition, Since the Word only support fill-in background, the background attach, pos, posX, posY and repeat are not mapped to Word easyly. At present, ignore those properties.
 * @throws IOException
 * @TODO support background properties. attach, pos, posx, posy and repeat.
 */
protected void drawDocumentBackground() throws IOException {
  IStyle style=previousPage.getComputedStyle();
  String backgroundColor=style.getBackgroundColor();
  String backgroundImageUrl=org.eclipse.birt.report.engine.layout.emitter.EmitterUtil.getBackgroundImageUrl(style,reportContent.getDesign().getReportDesign());
  wordWriter.drawDocumentBackground(backgroundColor,backgroundImageUrl);
}

Fixed version (ground truth):
/** 
 * Transfer background for current page to Doc format. Now, the exported file will apply the first background properties, and followed background will ignore. In addition, Since the Word only support fill-in background, the background attach, pos, posX, posY and repeat are not mapped to Word easyly. At present, ignore those properties.
 * @throws IOException
 * @TODO support background properties. attach, pos, posx, posy and repeat.
 */
protected void drawDocumentBackground() throws IOException {
  IStyle style=previousPage.getComputedStyle();
  String backgroundColor=style.getBackgroundColor();
  String backgroundImageUrl=EmitterUtil.getBackgroundImageUrl(style,reportContent.getDesign().getReportDesign());
  wordWriter.drawDocumentBackground(backgroundColor,backgroundImageUrl);
}
Program: 70714
Project: 70714
Buggy source:
protected void readField(int version,int filedId,DataInputStream in,ClassLoader loader) throws IOException {
switch (filedId) {
case FIELD_ROW_SPAN:
    rowSpan=IOUtil.readInt(in);
  break;
case FIELD_COL_SPAN:
colSpan=IOUtil.readInt(in);
break;
case FIELD_COLUMN:
column=IOUtil.readInt(in);
break;
case FIELD_START_OF_GROUP:
IOUtil.readBool(in);
break;
case FIELD_DISPLAY_GROUP_ICON:
displayGroupIcon=Boolean.valueOf(IOUtil.readBool(in));
break;
case FIELD_DIAGONAL_NUMBER:
diagonalNumber=IOUtil.readInt(in);
case FIELD_DIAGONAL_STYLE:
diagonalStyle=IOUtil.readString(in);
case FIELD_DIAGONAL_WIDTH:
diagonalWidth=new DimensionType();
diagonalWidth.readObject(in);
case FIELD_ANTIDIAGONAL_NUMBER:
antidiagonalNumber=IOUtil.readInt(in);
case FIELD_ANTIDIAGONAL_STYLE:
antidiagonalStyle=IOUtil.readString(in);
case FIELD_ANTIDIAGONAL_WIDTH:
antidiagonalWidth=new DimensionType();
antidiagonalWidth.readObject(in);
default :
super.readField(version,filedId,in,loader);
}
}

Fixed version (ground truth):
protected void readField(int version,int filedId,DataInputStream in,ClassLoader loader) throws IOException {
switch (filedId) {
case FIELD_ROW_SPAN:
    rowSpan=IOUtil.readInt(in);
  break;
case FIELD_COL_SPAN:
colSpan=IOUtil.readInt(in);
break;
case FIELD_COLUMN:
column=IOUtil.readInt(in);
break;
case FIELD_START_OF_GROUP:
IOUtil.readBool(in);
break;
case FIELD_DISPLAY_GROUP_ICON:
displayGroupIcon=Boolean.valueOf(IOUtil.readBool(in));
break;
case FIELD_DIAGONAL_NUMBER:
diagonalNumber=IOUtil.readInt(in);
break;
case FIELD_DIAGONAL_STYLE:
diagonalStyle=IOUtil.readString(in);
break;
case FIELD_DIAGONAL_WIDTH:
diagonalWidth=new DimensionType();
diagonalWidth.readObject(in);
break;
case FIELD_ANTIDIAGONAL_NUMBER:
antidiagonalNumber=IOUtil.readInt(in);
break;
case FIELD_ANTIDIAGONAL_STYLE:
antidiagonalStyle=IOUtil.readString(in);
break;
case FIELD_ANTIDIAGONAL_WIDTH:
antidiagonalWidth=new DimensionType();
antidiagonalWidth.readObject(in);
break;
default :
super.readField(version,filedId,in,loader);
break;
}
}
Program: 70715
Project: 70715
Buggy source:
public void relocate(IFigure target){
  Rectangle bounds;
  if (getReference() instanceof HandleBounds)   bounds=((HandleBounds)getReference()).getHandleBounds();
 else   bounds=getReference().getBounds();
  Dimension dim=((MultipleGuideHandle)target).calculateIndicatorDimension();
  bounds=new PrecisionRectangle(new Rectangle(bounds.x,bounds.y + bounds.height,dim.width,dim.height));
  getReference().translateToAbsolute(bounds);
  target.translateToRelative(bounds);
  target.setBounds(bounds);
  relocateChildren(target,getReference());
}

Fixed version (ground truth):
public void relocate(IFigure target){
  Rectangle bounds;
  if (getReference() instanceof HandleBounds)   bounds=((HandleBounds)getReference()).getHandleBounds();
 else   bounds=getReference().getBounds();
  Dimension dim=((MultipleGuideHandle)target).calculateIndicatorDimension();
  bounds=new PrecisionRectangle(new Rectangle(bounds.x,bounds.y + bounds.height,dim.width,dim.height));
  Rectangle copy=bounds.getCopy();
  getReference().translateToAbsolute(bounds);
  target.translateToRelative(bounds);
  bounds.width=copy.width;
  bounds.height=copy.height;
  target.setBounds(bounds);
  relocateChildren(target,getReference());
}
Program: 70717
Project: 70717
Buggy source:
/** 
 * Clear the model event, when the model trans Roll back.
 */
protected void clearEvent(){
  int size=listenerList.size();
  for (int i=0; i < size; i++) {
    IModelEventProcessor processor=(IModelEventProcessor)listenerList.get(i);
    processor.clear();
  }
}

Fixed version (ground truth):
/** 
 * Clear the model event, when the model trans Roll back.
 */
protected void clearEvent(){
  int size=listenerList.size();
  List list=new ArrayList(listenerList);
  for (int i=0; i < size; i++) {
    IModelEventProcessor processor=(IModelEventProcessor)list.get(i);
    processor.clear();
  }
}
Program: 70718
Project: 70718
Buggy source:
/** 
 * extract zip file and import files into project
 * @param srcZipFile
 * @param destPath
 * @param monitor
 * @param query
 * @throws CoreException
 */
private static void importFilesFromZip(ZipFile srcZipFile,IPath destPath,IProgressMonitor monitor,IOverwriteQuery query) throws CoreException {
  try {
    ZipFileStructureProvider structureProvider=new ZipFileStructureProvider(srcZipFile);
    List list=prepareFileList(structureProvider,structureProvider.getRoot(),null);
    ImportOperation op=new ImportOperation(destPath,structureProvider.getRoot(),structureProvider,query,list);
    op.run(monitor);
  }
 catch (  Exception e) {
    String message=srcZipFile.getName() + "String_Node_Str" + e.getMessage();
    Logger.logException(e);
    throw ChartIntegrationException.getException(message,e);
  }
}

Fixed version (ground truth):
/** 
 * extract zip file and import files into project
 * @param srcZipFile
 * @param destPath
 * @param monitor
 * @param query
 * @throws CoreException
 */
private static void importFilesFromZip(ZipFile srcZipFile,IPath destPath,IProgressMonitor monitor,IOverwriteQuery query) throws CoreException {
  try {
    ZipFileStructureProvider structureProvider=new ZipFileStructureProvider(srcZipFile);
    List list=prepareFileList(structureProvider,structureProvider.getRoot(),null);
    ImportOperation op=new ImportOperation(destPath,structureProvider.getRoot(),structureProvider,query,list);
    op.run(monitor);
  }
 catch (  InterruptedException e) {
  }
catch (  InvocationTargetException e) {
    String message=srcZipFile.getName() + "String_Node_Str" + e.getMessage();
    throw ChartIntegrationException.getException(message,e);
  }
}
Program: 70719
Project: 70719
Buggy source:
/** 
 * Set whether the level is mirrored.
 * @param isMirrored
 * @return
 */
public void creatMirrorDefinition(ILevelDefinition level,boolean breakHierarchy);

Fixed version (ground truth):
/** 
 * @param level The mirror starting level
 * @param breakHierarchy Whether to keep the relation ship between levels.
 * @return
 */
public void creatMirrorDefinition(ILevelDefinition level,boolean breakHierarchy);
Program: 70720
Project: 70720
Buggy source:
private void startCell(int cellindex,int colspan,int rowspan,int styleid,HyperlinkDef hyperLink,BookmarkDef linkedBookmark){
  writer.openTag("String_Node_Str");
  writer.attribute("String_Node_Str",cellindex);
  writer.attribute("String_Node_Str",styleid);
  if (hyperLink != null) {
    String urlAddress=hyperLink.getUrl();
    if (hyperLink.getType() == IHyperlinkAction.ACTION_BOOKMARK) {
      if (linkedBookmark != null)       urlAddress="String_Node_Str" + linkedBookmark.getValidName();
 else {
        logger.log(Level.WARNING,"String_Node_Str" + urlAddress + "String_Node_Str");
      }
    }
    if (urlAddress.length() >= 255) {
      logger.log(Level.WARNING,"String_Node_Str" + urlAddress + "String_Node_Str");
      urlAddress=urlAddress.substring(0,254);
    }
    writer.attribute("String_Node_Str",urlAddress);
  }
  writer.attribute("String_Node_Str",colspan);
  writer.attribute("String_Node_Str",rowspan);
}

Fixed version (ground truth):
private void startCell(int cellindex,int colspan,int rowspan,int styleid,HyperlinkDef hyperLink,BookmarkDef linkedBookmark){
  writer.openTag("String_Node_Str");
  writer.attribute("String_Node_Str",cellindex);
  writer.attribute("String_Node_Str",styleid);
  if (hyperLink != null) {
    String urlAddress=hyperLink.getUrl();
    if (hyperLink.getType() == IHyperlinkAction.ACTION_BOOKMARK) {
      if (linkedBookmark != null)       urlAddress="String_Node_Str" + linkedBookmark.getValidName();
 else {
        logger.log(Level.WARNING,"String_Node_Str" + urlAddress + "String_Node_Str");
      }
    }
    if (urlAddress != null && urlAddress.length() >= 255) {
      logger.log(Level.WARNING,"String_Node_Str" + urlAddress + "String_Node_Str");
      urlAddress=urlAddress.substring(0,254);
    }
    writer.attribute("String_Node_Str",urlAddress);
  }
  writer.attribute("String_Node_Str",colspan);
  writer.attribute("String_Node_Str",rowspan);
}
Program: 70721
Project: 70721
Buggy source:
public void startCell(ICellContent cell){
  logger.log(Level.FINE,"String_Node_Str");
  boolean isHead=isCellInHead(cell);
  if (isHead) {
    writer.openTag(HTMLTags.TAG_TH);
  }
 else {
    writer.openTag(HTMLTags.TAG_TD);
  }
  String styleClass=cell.getStyleClass();
  setStyleName(styleClass,cell);
  int colSpan=cell.getColSpan();
  if (colSpan > 1) {
    writer.attribute(HTMLTags.ATTR_COLSPAN,colSpan);
  }
  int rowSpan=cell.getRowSpan();
  if (rowSpan > 1) {
    writer.attribute(HTMLTags.ATTR_ROWSPAN,rowSpan);
  }
  StringBuffer styleBuffer=new StringBuffer();
  htmlEmitter.buildCellStyle(cell,styleBuffer,isHead);
  writer.attribute(HTMLTags.ATTR_STYLE,styleBuffer.toString());
  htmlEmitter.handleCellAlign(cell);
  if (!startedGroups.isEmpty()) {
    IGroupContent group=(IGroupContent)startedGroups.firstElement();
    String bookmark=group.getBookmark();
    if (bookmark == null) {
      bookmark=idGenerator.generateUniqueID();
      group.setBookmark(bookmark);
    }
    HTMLEmitterUtil.setBookmark(writer,null,htmlIDNamespace,bookmark);
    startedGroups.remove(group);
    Iterator iter=startedGroups.iterator();
    while (iter.hasNext()) {
      group=(IGroupContent)iter.next();
      outputBookmark(group);
    }
    startedGroups.clear();
  }
  if (enableMetadata) {
    metadataEmitter.startCell(cell);
  }
}

Fixed version (ground truth):
public void startCell(ICellContent cell){
  logger.log(Level.FINE,"String_Node_Str");
  boolean isHead=isCellInHead(cell);
  if (isHead) {
    writer.openTag(HTMLTags.TAG_TH);
  }
 else {
    writer.openTag(HTMLTags.TAG_TD);
  }
  writer.attribute("String_Node_Str",cell.getScope());
  writer.attribute("String_Node_Str",cell.getBookmark());
  writer.attribute("String_Node_Str",cell.getHeaders());
  String styleClass=cell.getStyleClass();
  setStyleName(styleClass,cell);
  int colSpan=cell.getColSpan();
  if (colSpan > 1) {
    writer.attribute(HTMLTags.ATTR_COLSPAN,colSpan);
  }
  int rowSpan=cell.getRowSpan();
  if (rowSpan > 1) {
    writer.attribute(HTMLTags.ATTR_ROWSPAN,rowSpan);
  }
  StringBuffer styleBuffer=new StringBuffer();
  htmlEmitter.buildCellStyle(cell,styleBuffer,isHead);
  writer.attribute(HTMLTags.ATTR_STYLE,styleBuffer.toString());
  htmlEmitter.handleCellAlign(cell);
  if (!startedGroups.isEmpty()) {
    IGroupContent group=(IGroupContent)startedGroups.firstElement();
    String bookmark=group.getBookmark();
    if (bookmark == null) {
      bookmark=idGenerator.generateUniqueID();
      group.setBookmark(bookmark);
    }
    HTMLEmitterUtil.setBookmark(writer,null,htmlIDNamespace,bookmark);
    startedGroups.remove(group);
    Iterator iter=startedGroups.iterator();
    while (iter.hasNext()) {
      group=(IGroupContent)iter.next();
      outputBookmark(group);
    }
    startedGroups.clear();
  }
  if (enableMetadata) {
    metadataEmitter.startCell(cell);
  }
}
Program: 70722
Project: 70722
Buggy source:
public IContent execute(){
  CellDesign cellDesign=(CellDesign)getDesign();
  ICellContent cellContent=report.createCellContent();
  setContent(cellContent);
  executeQuery();
  initializeContent(cellDesign,cellContent);
  processAction(cellDesign,cellContent);
  processBookmark(cellDesign,cellContent);
  processStyle(cellDesign,cellContent);
  processVisibility(cellDesign,cellContent);
  if (context.isInFactory()) {
    handleOnCreate(cellContent);
  }
  startTOCEntry(cellContent);
  currentItem=0;
  return content;
}

Fixed version (ground truth):
public IContent execute(){
  CellDesign cellDesign=(CellDesign)getDesign();
  ICellContent cellContent=report.createCellContent();
  setContent(cellContent);
  executeQuery();
  initializeContent(cellDesign,cellContent);
  processAction(cellDesign,cellContent);
  processBookmark(cellDesign,cellContent);
  processScope(cellDesign,cellContent);
  processHeaders(cellDesign,cellContent);
  processStyle(cellDesign,cellContent);
  processVisibility(cellDesign,cellContent);
  if (context.isInFactory()) {
    handleOnCreate(cellContent);
  }
  startTOCEntry(cellContent);
  currentItem=0;
  return content;
}
Program: 70723
Project: 70723
Buggy source:
public void visitCell(CellHandle handle){
  CellDesign cell=new CellDesign();
  setupStyledElement(cell,handle);
  SlotHandle contentSlot=handle.getContent();
  for (int i=0; i < contentSlot.getCount(); i++) {
    apply(contentSlot.get(i));
    if (currentElement != null) {
      cell.addContent((ReportItemDesign)currentElement);
    }
  }
  cell.setColSpan(handle.getColumnSpan());
  int columnId=handle.getColumn() - 1;
  if (columnId < 0) {
    columnId=-1;
  }
  cell.setColumn(columnId);
  cell.setRowSpan(handle.getRowSpan());
  if (isCellInGroupHeader(handle)) {
    cell.setDrop(handle.getDrop());
  }
  String onCreate=handle.getOnCreate();
  String onCreateScriptText=createExpression(onCreate);
  if (null != onCreateScriptText) {
    String id=ModuleUtil.getScriptUID(handle.getPropertyHandle(ICellModel.ON_CREATE_METHOD));
    ScriptExpression scriptExpr=new ScriptExpression(onCreateScriptText,id);
    cell.setOnCreate(scriptExpr);
  }
  String OnRenderScriptText=handle.getOnRender();
  if (null != OnRenderScriptText) {
    String id=ModuleUtil.getScriptUID(handle.getPropertyHandle(ICellModel.ON_RENDER_METHOD));
    ScriptExpression scriptExpr=new ScriptExpression(OnRenderScriptText,id);
    cell.setOnRender(scriptExpr);
  }
  setupHighlight(cell,null);
  setCurrentElement(cell);
}

Fixed version (ground truth):
public void visitCell(CellHandle handle){
  CellDesign cell=new CellDesign();
  setupStyledElement(cell,handle);
  setupAuralInfomation(cell,handle);
  SlotHandle contentSlot=handle.getContent();
  for (int i=0; i < contentSlot.getCount(); i++) {
    apply(contentSlot.get(i));
    if (currentElement != null) {
      cell.addContent((ReportItemDesign)currentElement);
    }
  }
  cell.setColSpan(handle.getColumnSpan());
  int columnId=handle.getColumn() - 1;
  if (columnId < 0) {
    columnId=-1;
  }
  cell.setColumn(columnId);
  cell.setRowSpan(handle.getRowSpan());
  if (isCellInGroupHeader(handle)) {
    cell.setDrop(handle.getDrop());
  }
  String onCreate=handle.getOnCreate();
  String onCreateScriptText=createExpression(onCreate);
  if (null != onCreateScriptText) {
    String id=ModuleUtil.getScriptUID(handle.getPropertyHandle(ICellModel.ON_CREATE_METHOD));
    ScriptExpression scriptExpr=new ScriptExpression(onCreateScriptText,id);
    cell.setOnCreate(scriptExpr);
  }
  String OnRenderScriptText=handle.getOnRender();
  if (null != OnRenderScriptText) {
    String id=ModuleUtil.getScriptUID(handle.getPropertyHandle(ICellModel.ON_RENDER_METHOD));
    ScriptExpression scriptExpr=new ScriptExpression(OnRenderScriptText,id);
    cell.setOnRender(scriptExpr);
  }
  setupHighlight(cell,null);
  setCurrentElement(cell);
}
Program: 70726
Project: 70726
Buggy source:
public static void copy(Shell shell,String path,String desFileName,URL srcURL){
  final File targetfile=new File(path,desFileName);
  if (targetfile.exists()) {
    if (!MessageDialog.openConfirm(shell,Messages.getString("String_Node_Str"),Messages.getFormattedString("String_Node_Str",new Object[]{desFileName}))) {
      return;
    }
  }
  OutputStream output=null;
  InputStream input=null;
  try {
    output=new FileOutputStream(targetfile);
    input=srcURL.openStream();
    int offset;
    byte[] buf=new byte[1024 * 4];
    while ((offset=input.read(buf)) > -1) {
      output.write(buf,0,offset);
    }
  }
 catch (  IOException e) {
    ExceptionHandler.handle(e);
  }
 finally {
    try {
      input.close();
      output.close();
    }
 catch (    IOException e) {
      ExceptionHandler.handle(e);
    }
  }
}

Fixed version (ground truth):
public static void copy(Shell shell,String path,String desFileName,URL srcURL){
  final File targetfile=new File(path,desFileName);
  if (targetfile.exists()) {
    if (!MessageDialog.openConfirm(shell,Messages.getString("String_Node_Str"),Messages.getFormattedString("String_Node_Str",new Object[]{desFileName}))) {
      return;
    }
  }
  OutputStream output=null;
  InputStream input=null;
  try {
    output=new FileOutputStream(targetfile);
    input=srcURL.openStream();
    int offset;
    byte[] buf=new byte[1024 * 4];
    while ((offset=input.read(buf)) > -1) {
      output.write(buf,0,offset);
    }
  }
 catch (  IOException e) {
    ExceptionHandler.handle(e);
  }
 finally {
    if (input != null) {
      try {
        input.close();
      }
 catch (      IOException e) {
        ExceptionHandler.handle(e);
      }
    }
    if (output != null) {
      try {
        output.close();
      }
 catch (      IOException e) {
        ExceptionHandler.handle(e);
      }
    }
  }
}
Program: 70728
Project: 70728
Buggy source:
private void fillExpression(Combo control){
  String te="String_Node_Str";
  if (handle != null) {
    te=handle.getTestExpression();
  }
  if ((designHandle instanceof DataItemHandle) && (((DataItemHandle)designHandle).getResultSetColumn() != null)) {
    control.add(VALUE_OF_THIS_DATA_ITEM);
  }
  if (control.getItemCount() == 0) {
    control.add(DEUtil.resolveNull(null));
    control.select(control.getItemCount() - 1);
  }
}

Fixed version (ground truth):
private void fillExpression(Combo control){
  if ((designHandle instanceof DataItemHandle) && (((DataItemHandle)designHandle).getResultSetColumn() != null)) {
    control.add(VALUE_OF_THIS_DATA_ITEM);
  }
  if (control.getItemCount() == 0) {
    control.add(DEUtil.resolveNull(null));
    control.select(control.getItemCount() - 1);
  }
}
Program: 70730
Project: 70730
Buggy source:
/** 
 * Obtains singleton instance.
 * @return browser manager instance
 */
public static BrowserManager getInstance(){
  if (instance == null) {
    instance=new BrowserManager();
    instance.init();
  }
  return instance;
}

Fixed version (ground truth):
/** 
 * Obtains singleton instance.
 * @return browser manager instance
 */
synchronized public static BrowserManager getInstance(){
  if (instance == null) {
    instance=new BrowserManager();
    instance.init();
  }
  return instance;
}
Program: 70731
Project: 70731
Buggy source:
private EditPart getEditPartUnderMouse(){
  EditPart editPart=getCurrentViewer().findObjectAtExcluding(getLocation(),new ArrayList());
  return editPart;
}

Fixed version (ground truth):
private EditPart getEditPartUnderMouse(){
  if (getCurrentViewer() == null) {
    return null;
  }
  EditPart editPart=getCurrentViewer().findObjectAtExcluding(getLocation(),new ArrayList());
  return editPart;
}
Program: 70732
Project: 70732
Buggy source:
public void run(){
  if (!getSourceEditPart().isActive()) {
    return;
  }
  EditPartViewer viewer=getSourceEditPart().getViewer();
  EditPart parent=getSourceEditPart().getParent();
  if (activeHelper == this && getSourceEditPart().isActive() && viewer.getControl() != null && !viewer.getControl().isDisposed()) {
    if (viewer.getSelectedEditParts().size() == 1) {
      if (parent.getAdapter(IDelaySelectionDragTracker.class) != null) {
        proxy=(IDelaySelectionDragTracker)parent.getAdapter(IDelaySelectionDragTracker.class);
        if (viewer instanceof DeferredGraphicalViewer)         ((DeferredGraphicalViewer)viewer).setSelection(new StructuredSelection(proxy.getSourceEditPart()),true);
        if (getSourceEditPart() != getEditPartUnderMouse()) {
          IFigure figure=((GraphicalEditPart)getSourceEditPart()).getFigure();
          Rectangle center=figure.getBounds().getCopy();
          figure.translateToAbsolute(center);
          proxy.setStartLocation(center.getCenter());
        }
 else {
          proxy.setStartLocation(getStartLocation());
        }
        proxy.setState(STATE_DRAG_IN_PROGRESS);
      }
      setFlag(FLAG_DELAY_SELECTION,true);
    }
 else {
      setFlag(FLAG_DELAY_SELECTION,false);
    }
  }
 else {
    setFlag(FLAG_DELAY_SELECTION,false);
  }
  activeHelper=null;
}

Fixed version (ground truth):
public void run(){
  if (!getSourceEditPart().isActive()) {
    return;
  }
  EditPartViewer viewer=getSourceEditPart().getViewer();
  EditPart parent=getSourceEditPart().getParent();
  if (activeHelper == this && getSourceEditPart().isActive() && viewer.getControl() != null && !viewer.getControl().isDisposed()) {
    viewer.getControl().removeFocusListener(focus);
    viewer.getControl().removeKeyListener(key);
    if (viewer.getSelectedEditParts().size() == 1) {
      if (parent.getAdapter(IDelaySelectionDragTracker.class) != null) {
        proxy=(IDelaySelectionDragTracker)parent.getAdapter(IDelaySelectionDragTracker.class);
        if (viewer instanceof DeferredGraphicalViewer)         ((DeferredGraphicalViewer)viewer).setSelection(new StructuredSelection(proxy.getSourceEditPart()),true);
        if (getSourceEditPart() != getEditPartUnderMouse()) {
          IFigure figure=((GraphicalEditPart)getSourceEditPart()).getFigure();
          Rectangle center=figure.getBounds().getCopy();
          figure.translateToAbsolute(center);
          proxy.setStartLocation(center.getCenter());
        }
 else {
          proxy.setStartLocation(getStartLocation());
        }
        proxy.setState(STATE_DRAG_IN_PROGRESS);
      }
      setFlag(FLAG_DELAY_SELECTION,true);
    }
 else {
      setFlag(FLAG_DELAY_SELECTION,false);
    }
  }
 else {
    setFlag(FLAG_DELAY_SELECTION,false);
  }
  activeHelper=null;
}
Program: 70733
Project: 70733
Buggy source:
public DelaySelectionHelper(){
  activeHelper=this;
  Display.getCurrent().timerExec(DELAY_TIME,this);
}

Fixed version (ground truth):
public DelaySelectionHelper(){
  activeHelper=this;
  hookControl(getSourceEditPart().getViewer().getControl());
  Display.getCurrent().timerExec(DELAY_TIME,this);
}
Program: 70734
Project: 70734
Buggy source:
/** 
 * @param objClass
 * @return
 */
public static boolean isValidDataType(Class objClass){
  for (int i=0; i < classes.length; i++) {
    if (classes[i].equals(objClass)) {
      return true;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * @param objClass
 * @return
 */
public static boolean isValidDataType(Class objClass){
  for (int i=0; i < classes.length; i++) {
    if (classes[i].equals(objClass)) {
      return true;
    }
  }
  return false;
}
Program: 70735
Project: 70735
Buggy source:
public static String formatDateTime(String format,Locale locale){
  String language=locale.getLanguage();
  String code=locale2Code.get(locale);
  if (code == null) {
    code=locale2Code.get(new Locale(language));
  }
  return code + format;
}

Fixed version (ground truth):
public static String formatDateTime(String format,ULocale locale){
  String language=locale.getLanguage();
  String code=locale2Code.get(locale);
  if (code == null) {
    code=locale2Code.get(new Locale(language));
  }
  return code + format;
}
Program: 70736
Project: 70736
Buggy source:
public void initialize(IEmitterServices service) throws EngineException {
  this.service=service;
  if (service != null) {
    this.out=EmitterUtil.getOuputStream(service,"String_Node_Str" + getOutputFormat());
  }
  context.setTempFileDir(service.getReportEngine().getConfig().getTempDir());
  IReportContext reportContext=service.getReportContext();
  if (reportContext != null) {
    Locale locale=reportContext.getLocale();
    if (locale != null)     context.setLocale(ULocale.forLocale(locale));
  }
}

Fixed version (ground truth):
public void initialize(IEmitterServices service) throws EngineException {
  this.service=service;
  if (service != null) {
    this.out=EmitterUtil.getOuputStream(service,"String_Node_Str" + getOutputFormat());
  }
  context.setTempFileDir(service.getReportEngine().getConfig().getTempDir());
  IReportContext reportContext=service.getReportContext();
  if (reportContext != null) {
    Locale locale=reportContext.getLocale();
    if (locale != null) {
      context.setLocale(ULocale.forLocale(locale));
    }
 else     context.setLocale(ULocale.getDefault());
  }
}
Program: 70737
Project: 70737
Buggy source:
public void run(){
  if (!viewer.getTree().isDisposed()) {
    IMemento memento=viewerMemento.getChild(provider.getElementType());
    if (memento == null) {
      expandToDefaultLevel();
      if (viewer.getTree().getItemCount() > 0) {
        Memento elementMemento=(Memento)viewerMemento.createChild(provider.getElementType(),MementoElement.Type_Element);
        elementMemento.getMementoElement().setValue(new Integer(0));
      }
    }
 else     if (memento instanceof Memento) {
      expandToDefaultLevel();
      expandTreeFromMemento((Memento)memento);
    }
  }
  execMemento=false;
}

Fixed version (ground truth):
public void run(){
  if (!viewer.getTree().isDisposed()) {
    IMemento memento=viewerMemento.getChild(provider.getElementType());
    if (memento == null) {
      expandToDefaultLevel();
      if (viewer.getTree().getItemCount() > 0) {
        Memento elementMemento=(Memento)viewerMemento.createChild(provider.getElementType(),MementoElement.Type_Element);
        elementMemento.getMementoElement().setValue(Integer.valueOf(0));
      }
    }
 else     if (memento instanceof Memento) {
      expandToDefaultLevel();
      expandTreeFromMemento((Memento)memento);
    }
  }
  execMemento=false;
}
Program: 70738
Project: 70738
Buggy source:
public void postElementEvent(){
  if (!viewer.getTree().isDisposed()) {
    if (getControl().isFocusControl()) {
      IMemento memento=viewerMemento.getChild(provider.getElementType());
      if (memento == null) {
        expandToDefaultLevel();
        if (viewer.getTree().getItemCount() > 0) {
          Memento elementMemento=(Memento)viewerMemento.createChild(provider.getElementType(),MementoElement.Type_Element);
          elementMemento.getMementoElement().setValue(new Integer(0));
        }
      }
      if (memento != null && memento instanceof Memento) {
        expandToDefaultLevel();
        expandTreeFromMemento((Memento)memento);
      }
      changed=false;
    }
 else {
      changed=true;
    }
  }
 else {
    deRegisterEventManager();
  }
}

Fixed version (ground truth):
public void postElementEvent(){
  if (!viewer.getTree().isDisposed()) {
    if (getControl().isFocusControl()) {
      IMemento memento=viewerMemento.getChild(provider.getElementType());
      if (memento == null) {
        expandToDefaultLevel();
        if (viewer.getTree().getItemCount() > 0) {
          Memento elementMemento=(Memento)viewerMemento.createChild(provider.getElementType(),MementoElement.Type_Element);
          elementMemento.getMementoElement().setValue(Integer.valueOf(0));
        }
      }
      if (memento != null && memento instanceof Memento) {
        expandToDefaultLevel();
        expandTreeFromMemento((Memento)memento);
      }
      changed=false;
    }
 else {
      changed=true;
    }
  }
 else {
    deRegisterEventManager();
  }
}
Program: 70739
Project: 70739
Buggy source:
protected MementoElement[] createItemPath(TreeItem item){
  MementoElement tempMemento=null;
  while (item.getParentItem() != null) {
    TreeItem parent=item.getParentItem();
    for (int i=0; i < parent.getItemCount(); i++) {
      if (parent.getItem(i) == item) {
        MementoElement memento=new MementoElement(item.getText(),new Integer(i),MementoElement.Type_Element);
        if (tempMemento != null)         memento.addChild(tempMemento);
        tempMemento=memento;
        item=parent;
        break;
      }
    }
  }
  MementoElement memento=new MementoElement(item.getText(),new Integer(0),MementoElement.Type_Element);
  if (tempMemento != null)   memento.addChild(tempMemento);
  return provider.getNodePath(memento);
}

Fixed version (ground truth):
protected MementoElement[] createItemPath(TreeItem item){
  MementoElement tempMemento=null;
  while (item.getParentItem() != null) {
    TreeItem parent=item.getParentItem();
    for (int i=0; i < parent.getItemCount(); i++) {
      if (parent.getItem(i) == item) {
        MementoElement memento=new MementoElement(item.getText(),Integer.valueOf(i),MementoElement.Type_Element);
        if (tempMemento != null)         memento.addChild(tempMemento);
        tempMemento=memento;
        item=parent;
        break;
      }
    }
  }
  MementoElement memento=new MementoElement(item.getText(),Integer.valueOf(0),MementoElement.Type_Element);
  if (tempMemento != null)   memento.addChild(tempMemento);
  return provider.getNodePath(memento);
}