nus-yam/ex-repair huggingface dataset:
Program: 68365
Project: 68365
Buggy source:
public boolean performFinish(){
  if (!canFinish())   return false;
  if (useTransaction) {
    Utility.getCommandStack().startTrans(CREATE_DATA_SET_TRANS_NAME);
  }
  DataSetHandle dataSetHandle=dataSetPage.createSelectedDataSet();
  if (dataSetHandle != null) {
    if (dataSetHandle instanceof ScriptDataSetHandle) {
      columnDefPage.saveResult(dataSetHandle);
    }
    if (useTransaction) {
      Utility.getCommandStack().commit();
    }
    try {
      createSelectedDataSetTearDown(dataSetHandle);
      DataSetUIUtil.updateColumnCache(dataSetHandle);
    }
 catch (    Exception e) {
      if (e instanceof SWTException) {
        SWTException swtException=(SWTException)e;
        if (swtException.code == SWT.ERROR_WIDGET_DISPOSED)         Utility.log(e);
      }
      ExceptionHandler.handle(e);
    }
  }
 else {
    if (useTransaction) {
      Utility.getCommandStack().rollback();
    }
    return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean performFinish(){
  if (!canFinish())   return false;
  if (useTransaction) {
    Utility.getCommandStack().startTrans(CREATE_DATA_SET_TRANS_NAME);
  }
  dataSetHandle=dataSetPage.createSelectedDataSet();
  if (dataSetHandle != null) {
    if (dataSetHandle instanceof ScriptDataSetHandle) {
      columnDefPage.saveResult(dataSetHandle);
    }
    if (useTransaction) {
      Utility.getCommandStack().commit();
    }
    try {
      createSelectedDataSetTearDown(dataSetHandle);
      DataSetUIUtil.updateColumnCache(dataSetHandle);
    }
 catch (    Exception e) {
      if (e instanceof SWTException) {
        SWTException swtException=(SWTException)e;
        if (swtException.code == SWT.ERROR_WIDGET_DISPOSED)         Utility.log(e);
      }
      ExceptionHandler.handle(e);
    }
  }
 else {
    if (useTransaction) {
      Utility.getCommandStack().rollback();
    }
    return false;
  }
  return true;
}
Program: 68368
Project: 68368
Buggy source:
private void copyOutputData() throws IOException {
  if (tempWriter != null) {
    BufferedReader reader=null;
    try {
      reader=new BufferedReader(new FileReader(new File(tempFilePath)));
      String line=reader.readLine();
      XMLWriterXLS xlsWriter=writer.getWriter();
      while (line != null) {
        xlsWriter.literal("String_Node_Str");
        xlsWriter.literal(line);
        line=reader.readLine();
      }
    }
  finally {
      if (reader != null) {
        reader.close();
        reader=null;
      }
    }
  }
}

Fixed version (ground truth):
private void copyOutputData() throws IOException {
  if (tempWriter != null) {
    tempWriter.close();
    BufferedReader reader=null;
    try {
      reader=new BufferedReader(new FileReader(new File(tempFilePath)));
      String line=reader.readLine();
      XMLWriterXLS xlsWriter=writer.getWriter();
      while (line != null) {
        xlsWriter.literal("String_Node_Str");
        xlsWriter.literal(line);
        line=reader.readLine();
      }
    }
  finally {
      if (reader != null) {
        reader.close();
        reader=null;
      }
    }
  }
}
Program: 68369
Project: 68369
Buggy source:
public void end() throws IOException {
  writer.end();
}

Fixed version (ground truth):
public void end() throws IOException {
  writer.end();
  File file=new File(tempFilePath);
  if (file.exists() && file.isFile()) {
    file.delete();
  }
}
Program: 68370
Project: 68370
Buggy source:
/** 
 * @param dataSetHandle
 * @param dataSetDesign
 * @param queryDefn
 * @return
 * @throws BirtException
 */
public IQueryResults execute(DataSetHandle dataSetHandle,IBaseDataSetDesign dataSetDesign,IQueryDefinition queryDefn,ExecutionContext context,DataRequestSession session) throws BirtException {
  if (!(dataSetHandle instanceof JointDataSetHandle || dataSetHandle instanceof DerivedDataSetHandle) && context != null) {
    if (dataSetHandle.getDataSource() != null) {
      session.defineDataSource(session.getModelAdaptor().adaptDataSource(dataSetHandle.getDataSource()));
    }
    session.defineDataSet(dataSetDesign);
  }
  IQueryResults resultSet=executeQuery(session,queryDefn);
  saveResultToDataItems(dataSetHandle,resultSet);
  return resultSet;
}

Fixed version (ground truth):
/** 
 * @param dataSetHandle
 * @param dataSetDesign
 * @param queryDefn
 * @return
 * @throws BirtException
 */
public IQueryResults execute(DataSetHandle dataSetHandle,IBaseDataSetDesign dataSetDesign,IQueryDefinition queryDefn,ExecutionContext context,DataRequestSession session) throws BirtException {
  if (!(dataSetHandle instanceof JointDataSetHandle || dataSetHandle instanceof DerivedDataSetHandle)) {
    if (dataSetHandle.getDataSource() != null) {
      session.defineDataSource(session.getModelAdaptor().adaptDataSource(dataSetHandle.getDataSource()));
    }
    session.defineDataSet(dataSetDesign);
  }
  IQueryResults resultSet=executeQuery(session,queryDefn);
  saveResultToDataItems(dataSetHandle,resultSet);
  return resultSet;
}
Program: 68371
Project: 68371
Buggy source:
protected boolean doAction() throws Exception {
  if (Policy.TRACING_ACTIONS) {
    System.out.println("String_Node_Str");
  }
  DataSourceHandle handle=(DataSourceHandle)getSelection();
  DataSourceEditor dialog=new DataSourceEditor(PlatformUI.getWorkbench().getDisplay().getActiveShell(),handle);
  return (dialog.open() == IDialogConstants.OK_ID);
}

Fixed version (ground truth):
protected boolean doAction() throws Exception {
  if (Policy.TRACING_ACTIONS) {
    System.out.println("String_Node_Str");
  }
  DataSourceHandle handle=(DataSourceHandle)getSelection();
  DataSourceEditor dialog=new AdvancedDataSourceEditor(PlatformUI.getWorkbench().getDisplay().getActiveShell(),handle);
  return (dialog.open() == IDialogConstants.OK_ID);
}
Program: 68372
Project: 68372
Buggy source:
protected boolean performEdit(ReportElementHandle handle){
  if (!(handle instanceof ScriptDataSourceHandle) && handle.canEdit()) {
    DataSourceEditor dialog=new DataSourceEditor(PlatformUI.getWorkbench().getDisplay().getActiveShell(),(DataSourceHandle)handle);
    return dialog.open() == Dialog.OK;
  }
  return false;
}

Fixed version (ground truth):
protected boolean performEdit(ReportElementHandle handle){
  if (!(handle instanceof ScriptDataSourceHandle) && handle.canEdit()) {
    DataSourceEditor dialog=new AdvancedDataSourceEditor(PlatformUI.getWorkbench().getDisplay().getActiveShell(),(DataSourceHandle)handle);
    return dialog.open() == Dialog.OK;
  }
  return false;
}
Program: 68373
Project: 68373
Buggy source:
/** 
 * @see org.eclipse.birt.report.data.adapter.api.IModelAdapter#adaptDataSet(org.eclipse.birt.report.model.api.DataSetHandle)
 */
public BaseDataSetDesign adaptDataSet(DataSetHandle handle) throws BirtException {
  BaseDataSetDesign design=null;
  if (handle instanceof OdaDataSetHandle) {
    Scriptable propBindingScope=context.hasExternalScope() ? context.getTopScope() : null;
    design=new OdaDataSetAdapter((OdaDataSetHandle)handle,propBindingScope,this,context.getDataEngineContext());
  }
  if (handle instanceof ScriptDataSetHandle)   design=new ScriptDataSetAdapter((ScriptDataSetHandle)handle,this);
  if (handle instanceof JointDataSetHandle)   design=new JointDataSetAdapter((JointDataSetHandle)handle,this);
  if (design != null) {
    if (handle.getACLExpression() != null)     design.setDataSetACL(this.adaptExpression((Expression)handle.getACLExpression().getValue()));
    if (handle.getRowACLExpression() != null)     design.setRowACL(this.adaptExpression((Expression)handle.getRowACLExpression().getValue()));
    Iterator columnHintIterator=handle.columnHintsIterator();
    while (columnHintIterator.hasNext()) {
      ColumnHintHandle ch=(ColumnHintHandle)columnHintIterator.next();
      design.setDataSetColumnACL(ch.getColumnName(),this.adaptExpression((Expression)ch.getACLExpression().getValue()));
    }
  }
  logger.warning("String_Node_Str" + (handle == null ? "String_Node_Str" : handle.getClass().getName()));
  return null;
}

Fixed version (ground truth):
/** 
 * @see org.eclipse.birt.report.data.adapter.api.IModelAdapter#adaptDataSet(org.eclipse.birt.report.model.api.DataSetHandle)
 */
public BaseDataSetDesign adaptDataSet(DataSetHandle handle) throws BirtException {
  BaseDataSetDesign design=null;
  if (handle instanceof OdaDataSetHandle) {
    Scriptable propBindingScope=context.hasExternalScope() ? context.getTopScope() : null;
    design=new OdaDataSetAdapter((OdaDataSetHandle)handle,propBindingScope,this,context.getDataEngineContext());
  }
  if (handle instanceof ScriptDataSetHandle)   design=new ScriptDataSetAdapter((ScriptDataSetHandle)handle,this);
  if (handle instanceof JointDataSetHandle)   design=new JointDataSetAdapter((JointDataSetHandle)handle,this);
  if (design != null) {
    if (handle.getACLExpression() != null)     design.setDataSetACL(this.adaptExpression((Expression)handle.getACLExpression().getValue()));
    if (handle.getRowACLExpression() != null)     design.setRowACL(this.adaptExpression((Expression)handle.getRowACLExpression().getValue()));
    Iterator columnHintIterator=handle.columnHintsIterator();
    while (columnHintIterator.hasNext()) {
      ColumnHintHandle ch=(ColumnHintHandle)columnHintIterator.next();
      design.setDataSetColumnACL(ch.getColumnName(),this.adaptExpression((Expression)ch.getACLExpression().getValue()));
    }
  }
  logger.warning("String_Node_Str" + (handle == null ? "String_Node_Str" : handle.getClass().getName()));
  return design;
}
Program: 68375
Project: 68375
Buggy source:
protected void updateWriterParameters(ImageWriteParam iwp){
  if (isQualitySet) {
    iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    iwp.setCompressionQuality(jpegQuality);
  }
}

Fixed version (ground truth):
protected void updateWriterParameters(ImageWriteParam iwp){
  float quality=isQualitySet ? jpegQuality : 0.95f;
  iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
  iwp.setCompressionQuality(quality);
}
Program: 68376
Project: 68376
Buggy source:
/** 
 * Set the Jpeg compression quality into the renderer. The value must be  between 0 (better compression) and 1 (better quality). The default value is 0.75 (no visual loss)
 * @param jpegQuality
 */
public void setCompressionQuality(final int jpegQuality){
  if (jpegQuality < 0 || jpegQuality > 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else {
    isQualitySet=true;
    this.jpegQuality=jpegQuality;
  }
}

Fixed version (ground truth):
/** 
 * Set the Jpeg compression quality into the renderer. The value must be between 0 (better compression) and 1 (better quality). The default value is 0.95 (no visual loss)
 * @param jpegQuality
 */
public void setCompressionQuality(final int jpegQuality){
  if (jpegQuality < 0 || jpegQuality > 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else {
    isQualitySet=true;
    this.jpegQuality=jpegQuality;
  }
}
Program: 68378
Project: 68378
Buggy source:
protected Control createContents(Composite parent){
  ChartUIUtil.bindHelp(parent,ChartHelpContextIds.DIALOG_COLOR_GRADIENT);
  getShell().setText(Messages.getString("String_Node_Str"));
  getShell().setSize(420,220);
  UIHelper.centerOnScreen(getShell());
  return super.createContents(parent);
}

Fixed version (ground truth):
protected Control createContents(Composite parent){
  ChartUIUtil.bindHelp(parent,ChartHelpContextIds.DIALOG_COLOR_POSNEG);
  getShell().setText(Messages.getString("String_Node_Str"));
  getShell().setSize(420,220);
  UIHelper.centerOnScreen(getShell());
  return super.createContents(parent);
}
Program: 68379
Project: 68379
Buggy source:
public void run(){
  if (!(getModel() instanceof DesignElementHandle)) {
    return;
  }
  DesignElementHandle handle=(DesignElementHandle)getModel();
  EditPart part=ReportElementEditPart.this;
  while (part.getParent() != 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;
  }
  DesignElementHandle handle=(DesignElementHandle)getModel();
  EditPart part=ReportElementEditPart.this;
  while (part.getParent() != 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();
  }
}
Program: 68380
Project: 68380
Buggy source:
public void activate(){
  if (isActive())   return;
  super.activate();
  refreshPageClip();
  getFigure().addMouseMotionListener(new MouseMotionListener.Stub(){
    public void mouseEntered(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseExited(    MouseEvent me){
      delayRemoveGuideFeedBack();
    }
    public void mouseHover(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseMoved(    MouseEvent me){
      addGuideFeedBack();
    }
  }
);
  getFigure().setFocusTraversable(true);
  updateLayoutPreference();
  Display.getCurrent().asyncExec(new Runnable(){
    public void run(){
      if (!(getModel() instanceof DesignElementHandle)) {
        return;
      }
      DesignElementHandle handle=(DesignElementHandle)getModel();
      EditPart part=ReportElementEditPart.this;
      while (part.getParent() != 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 activate(){
  if (isActive())   return;
  super.activate();
  refreshPageClip();
  getFigure().addMouseMotionListener(new MouseMotionListener.Stub(){
    public void mouseEntered(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseExited(    MouseEvent me){
      delayRemoveGuideFeedBack();
    }
    public void mouseHover(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseMoved(    MouseEvent me){
      addGuideFeedBack();
    }
  }
);
  getFigure().setFocusTraversable(true);
  updateLayoutPreference();
  Display.getCurrent().asyncExec(new Runnable(){
    public void run(){
      if (!(getModel() instanceof DesignElementHandle)) {
        return;
      }
      DesignElementHandle handle=(DesignElementHandle)getModel();
      EditPart part=ReportElementEditPart.this;
      while (part.getParent() != 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();
      }
    }
  }
);
}
Program: 68383
Project: 68383
Buggy source:
/** 
 * Save the column meta data to data set handle.
 * @param dataSetHandle
 * @param holdEvent
 */
public static void updateColumnCache(DataSetHandle dataSetHandle,boolean holdEvent){
  try {
    if (dataSetHandle.getModuleHandle() instanceof ReportDesignHandle) {
      EngineConfig ec=new EngineConfig();
      ReportEngine engine=(ReportEngine)new ReportEngineFactory().createReportEngine(ec);
      DummyEngineTask engineTask=new DummyEngineTask(engine,new ReportEngineHelper(engine).openReportDesign((ReportDesignHandle)dataSetHandle.getModuleHandle()),dataSetHandle.getModuleHandle());
      DataRequestSession session=engineTask.getDataSession();
      Map appContext=new HashMap();
      appContext.put(DataEngine.MEMORY_DATA_SET_CACHE,Integer.valueOf(dataSetHandle.getRowFetchLimit()));
      engineTask.setAppContext(appContext);
      engineTask.run();
      session.refreshMetaData(dataSetHandle,holdEvent);
      engineTask.close();
      engine.destroy();
    }
 else {
      DataSessionContext context=new DataSessionContext(DataEngineContext.DIRECT_PRESENTATION,dataSetHandle.getRoot(),null);
      DataRequestSession drSession=DataRequestSession.newSession(context);
      drSession.refreshMetaData(dataSetHandle,holdEvent);
      drSession.shutdown();
    }
  }
 catch (  BirtException ex) {
    logger.entering(DataSetUIUtil.class.getName(),"String_Node_Str",new Object[]{ex});
  }
}

Fixed version (ground truth):
/** 
 * Save the column meta data to data set handle.
 * @param dataSetHandle
 * @param holdEvent
 */
public static void updateColumnCache(DataSetHandle dataSetHandle,boolean holdEvent){
  try {
    if (dataSetHandle.getModuleHandle() instanceof ReportDesignHandle) {
      EngineConfig ec=new EngineConfig();
      ReportEngine engine=(ReportEngine)new ReportEngineFactory().createReportEngine(ec);
      ReportDesignHandle copy=(ReportDesignHandle)(dataSetHandle.getModuleHandle().copy().getHandle(null));
      DummyEngineTask engineTask=new DummyEngineTask(engine,new ReportEngineHelper(engine).openReportDesign(copy),copy);
      DataRequestSession session=engineTask.getDataSession();
      Map appContext=new HashMap();
      appContext.put(DataEngine.MEMORY_DATA_SET_CACHE,Integer.valueOf(dataSetHandle.getRowFetchLimit()));
      engineTask.setAppContext(appContext);
      engineTask.run();
      session.refreshMetaData(dataSetHandle,holdEvent);
      engineTask.close();
      engine.destroy();
    }
 else {
      DataSessionContext context=new DataSessionContext(DataEngineContext.DIRECT_PRESENTATION,dataSetHandle.getRoot(),null);
      DataRequestSession drSession=DataRequestSession.newSession(context);
      drSession.refreshMetaData(dataSetHandle,holdEvent);
      drSession.shutdown();
    }
  }
 catch (  BirtException ex) {
    logger.entering(DataSetUIUtil.class.getName(),"String_Node_Str",new Object[]{ex});
  }
}
Program: 68384
Project: 68384
Buggy source:
public void startContent(IContent content) throws BirtException {
  boolean isInline=PropertyUtil.isInlineElement(content);
  if (isInline) {
    if (current.isInlineStacking()) {
    }
 else {
      setContainer(af.createLineArea(current,context));
    }
  }
 else {
    if (current.isInlineStacking()) {
      while (current.isInlineStacking()) {
        closeContainer();
      }
    }
  }
  ILayout layout=af.createLayout(current,context,content);
  if (layout != null) {
    layout.layout();
  }
}

Fixed version (ground truth):
public void startContent(IContent content) throws BirtException {
  boolean isInline=PropertyUtil.isInlineElement(content);
  if (isInline) {
    if (!unfinishedContents.isEmpty() && content.getParent() == unfinishedContents.peek()) {
      IContent parent=unfinishedContents.poll();
      _startContainer(parent);
    }
 else {
      if (current != null && current.isInlineStacking()) {
      }
 else {
        setContainer(af.createLineArea(current,context));
      }
    }
  }
 else {
    while (current != null && current.isInlineStacking()) {
      if (null != current.getContent()) {
        unfinishedContents.add(current.getContent());
      }
      closeContainer();
    }
  }
  ILayout layout=af.createLayout(current,context,content);
  if (layout != null) {
    layout.layout();
  }
}
Program: 68385
Project: 68385
Buggy source:
protected void _startContainer(IContent container) throws BirtException {
  boolean isInline=PropertyUtil.isInlineElement(container);
  if (isInline) {
    if (current != null && current.isInlineStacking()) {
    }
 else {
      setContainer(af.createLineArea(current,context));
    }
  }
 else {
    if (current != null && current.isInlineStacking()) {
      while (current != null && current.isInlineStacking()) {
        closeContainer();
      }
    }
  }
  ContainerArea area=(ContainerArea)af.createArea(current,context,container);
  setContainer(area);
}

Fixed version (ground truth):
protected void _startContainer(IContent container) throws BirtException {
  boolean isInline=PropertyUtil.isInlineElement(container);
  if (isInline) {
    if (!unfinishedContents.isEmpty() && container.getParent() == unfinishedContents.peek()) {
      IContent parent=unfinishedContents.poll();
      _startContainer(parent);
    }
 else {
      if (current != null && current.isInlineStacking()) {
      }
 else {
        setContainer(af.createLineArea(current,context));
      }
    }
  }
 else {
    while (current != null && current.isInlineStacking()) {
      if (null != current.getContent()) {
        unfinishedContents.add(current.getContent());
      }
      closeContainer();
    }
  }
  ContainerArea area=(ContainerArea)af.createArea(current,context,container);
  setContainer(area);
}
Program: 68386
Project: 68386
Buggy source:
public void endContent(IContent content) throws BirtException {
}

Fixed version (ground truth):
public void endContent(IContent content) throws BirtException {
  if (!unfinishedContents.isEmpty()) {
    IContent c=unfinishedContents.peek();
    if (c == content) {
      unfinishedContents.poll();
    }
  }
}
Program: 68387
Project: 68387
Buggy source:
protected void _endContainer(IContent container) throws BirtException {
  boolean isInline=PropertyUtil.isInlineElement(container);
  if (isInline) {
    if (current != null && current.isInlineStacking()) {
    }
 else {
    }
  }
 else {
    if (current != null && current.isInlineStacking()) {
      while (current != null && current.isInlineStacking()) {
        closeContainer();
      }
    }
 else {
    }
  }
  closeContainer();
}

Fixed version (ground truth):
protected void _endContainer(IContent container) throws BirtException {
  if (!unfinishedContents.isEmpty()) {
    IContent content=unfinishedContents.peek();
    if (container == content) {
      unfinishedContents.poll();
      return;
    }
  }
  boolean isInline=PropertyUtil.isInlineElement(container);
  if (isInline) {
    if (current != null && current.isInlineStacking()) {
    }
 else {
    }
  }
 else {
    while (current != null && current.isInlineStacking()) {
      closeContainer();
    }
  }
  closeContainer();
}
Program: 68388
Project: 68388
Buggy source:
public void run(){
  if (!(getModel() instanceof DesignElementHandle)) {
    return;
  }
  DesignElementHandle handle=(DesignElementHandle)getModel();
  if (getModelAdapter() == 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;
  }
  DesignElementHandle handle=(DesignElementHandle)getModel();
  EditPart part=ReportElementEditPart.this;
  while (part.getParent() != 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();
  }
}
Program: 68389
Project: 68389
Buggy source:
public void activate(){
  if (isActive())   return;
  super.activate();
  refreshPageClip();
  getFigure().addMouseMotionListener(new MouseMotionListener.Stub(){
    public void mouseEntered(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseExited(    MouseEvent me){
      delayRemoveGuideFeedBack();
    }
    public void mouseHover(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseMoved(    MouseEvent me){
      addGuideFeedBack();
    }
  }
);
  getFigure().setFocusTraversable(true);
  updateLayoutPreference();
  Display.getCurrent().asyncExec(new Runnable(){
    public void run(){
      if (!(getModel() instanceof DesignElementHandle)) {
        return;
      }
      DesignElementHandle handle=(DesignElementHandle)getModel();
      if (getModelAdapter() == 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 activate(){
  if (isActive())   return;
  super.activate();
  refreshPageClip();
  getFigure().addMouseMotionListener(new MouseMotionListener.Stub(){
    public void mouseEntered(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseExited(    MouseEvent me){
      delayRemoveGuideFeedBack();
    }
    public void mouseHover(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseMoved(    MouseEvent me){
      addGuideFeedBack();
    }
  }
);
  getFigure().setFocusTraversable(true);
  updateLayoutPreference();
  Display.getCurrent().asyncExec(new Runnable(){
    public void run(){
      if (!(getModel() instanceof DesignElementHandle)) {
        return;
      }
      DesignElementHandle handle=(DesignElementHandle)getModel();
      EditPart part=ReportElementEditPart.this;
      while (part.getParent() != 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();
      }
    }
  }
);
}
Program: 68390
Project: 68390
Buggy source:
public void run(){
  if (!(getModel() instanceof DesignElementHandle)) {
    return;
  }
  DesignElementHandle handle=(DesignElementHandle)getModel();
  EditPart part=ReportElementEditPart.this;
  while (part.getParent() != 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;
  }
  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();
  }
}
Program: 68391
Project: 68391
Buggy source:
public void activate(){
  if (isActive())   return;
  super.activate();
  refreshPageClip();
  getFigure().addMouseMotionListener(new MouseMotionListener.Stub(){
    public void mouseEntered(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseExited(    MouseEvent me){
      delayRemoveGuideFeedBack();
    }
    public void mouseHover(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseMoved(    MouseEvent me){
      addGuideFeedBack();
    }
  }
);
  getFigure().setFocusTraversable(true);
  updateLayoutPreference();
  Display.getCurrent().asyncExec(new Runnable(){
    public void run(){
      if (!(getModel() instanceof DesignElementHandle)) {
        return;
      }
      DesignElementHandle handle=(DesignElementHandle)getModel();
      EditPart part=ReportElementEditPart.this;
      while (part.getParent() != 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 activate(){
  if (isActive())   return;
  super.activate();
  refreshPageClip();
  getFigure().addMouseMotionListener(new MouseMotionListener.Stub(){
    public void mouseEntered(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseExited(    MouseEvent me){
      delayRemoveGuideFeedBack();
    }
    public void mouseHover(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseMoved(    MouseEvent me){
      addGuideFeedBack();
    }
  }
);
  getFigure().setFocusTraversable(true);
  updateLayoutPreference();
  Display.getCurrent().asyncExec(new Runnable(){
    public void run(){
      if (!(getModel() instanceof DesignElementHandle)) {
        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();
      }
    }
  }
);
}
Program: 68392
Project: 68392
Buggy source:
public final void paintClientArea(Graphics g){
  if (bPainting) {
    return;
  }
  final Rectangle r=getClientArea().getCopy();
  if (r.width <= 0 || r.height <= 0) {
    return;
  }
  bPainting=true;
  if (bDirty) {
    bDirty=false;
    final Display d=Display.getCurrent();
    Dimension dSize=r.getSize();
    if (imgChart == null || imgChart.getImageData().width != dSize.width || imgChart.getImageData().height != dSize.height) {
      if (gc != null) {
        gc.dispose();
      }
      if (imgChart != null) {
        imgChart.dispose();
      }
      bDirty=true;
      final ImageData ida=new ImageData(dSize.width,dSize.height,32,PALETTE_DATA);
      ida.transparentPixel=TRANSPARENT_COLOR;
      imgChart=new Image(d,ida);
      gc=new GC(imgChart);
    }
    final Color clrPreviousBG=gc.getBackground();
    gc.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    gc.fillRectangle(0,0,imgChart.getImageData().width,imgChart.getImageData().height);
    gc.setBackground(clrPreviousBG);
    if (cm == null) {
      showNullChart(dSize);
    }
 else {
      showChart(dSize);
    }
  }
  if (imgChart != null) {
    g.drawImage(imgChart,r.x,r.y);
  }
  bPainting=false;
}

Fixed version (ground truth):
public final void paintClientArea(Graphics g){
  if (bPainting) {
    return;
  }
  final Rectangle r=getClientArea().getCopy();
  if (r.width <= 0 || r.height <= 0) {
    return;
  }
  bPainting=true;
  if (bDirty) {
    bDirty=false;
    final Display d=Display.getCurrent();
    Dimension dSize=r.getSize();
    if (imgChart == null || imgChart.getImageData().width != dSize.width || imgChart.getImageData().height != dSize.height) {
      if (gc != null) {
        gc.dispose();
      }
      if (imgChart != null) {
        imgChart.dispose();
      }
      bDirty=true;
      final ImageData ida=new ImageData(dSize.width,dSize.height,32,PALETTE_DATA);
      ida.transparentPixel=TRANSPARENT_COLOR;
      imgChart=new Image(d,ida);
      gc=new GC(imgChart);
    }
    if (Platform.OS_MACOSX.equals(Platform.getOS()) && gc != null && !gc.isDisposed()) {
      gc.dispose();
      gc=new GC(imgChart);
    }
    final Color clrPreviousBG=gc.getBackground();
    gc.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    gc.fillRectangle(0,0,imgChart.getImageData().width,imgChart.getImageData().height);
    gc.setBackground(clrPreviousBG);
    if (cm == null) {
      showNullChart(dSize);
    }
 else {
      showChart(dSize);
    }
  }
  if (imgChart != null) {
    g.drawImage(imgChart,r.x,r.y);
  }
  bPainting=false;
}
Program: 68393
Project: 68393
Buggy source:
public void run(){
  if (!(getModel() instanceof DesignElementHandle)) {
    return;
  }
  DesignElementHandle handle=(DesignElementHandle)getModel();
  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;
  }
  DesignElementHandle handle=(DesignElementHandle)getModel();
  if (getModelAdapter() == 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();
  }
}
Program: 68394
Project: 68394
Buggy source:
public void activate(){
  if (isActive())   return;
  super.activate();
  refreshPageClip();
  getFigure().addMouseMotionListener(new MouseMotionListener.Stub(){
    public void mouseEntered(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseExited(    MouseEvent me){
      delayRemoveGuideFeedBack();
    }
    public void mouseHover(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseMoved(    MouseEvent me){
      addGuideFeedBack();
    }
  }
);
  getFigure().setFocusTraversable(true);
  updateLayoutPreference();
  Display.getCurrent().asyncExec(new Runnable(){
    public void run(){
      if (!(getModel() instanceof DesignElementHandle)) {
        return;
      }
      DesignElementHandle handle=(DesignElementHandle)getModel();
      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 activate(){
  if (isActive())   return;
  super.activate();
  refreshPageClip();
  getFigure().addMouseMotionListener(new MouseMotionListener.Stub(){
    public void mouseEntered(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseExited(    MouseEvent me){
      delayRemoveGuideFeedBack();
    }
    public void mouseHover(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseMoved(    MouseEvent me){
      addGuideFeedBack();
    }
  }
);
  getFigure().setFocusTraversable(true);
  updateLayoutPreference();
  Display.getCurrent().asyncExec(new Runnable(){
    public void run(){
      if (!(getModel() instanceof DesignElementHandle)) {
        return;
      }
      DesignElementHandle handle=(DesignElementHandle)getModel();
      if (getModelAdapter() == 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();
      }
    }
  }
);
}
Program: 68396
Project: 68396
Buggy source:
/** 
 * @param n
 * @param objectName
 * @return
 */
private static String getScriptObjectName(Node n,String objectName){
  if (n == null)   return null;
  String result=null;
  if (n.getType() == Token.NAME) {
    if (objectName.equals(n.getString())) {
      Node dimNameNode=n.getNext();
      if (dimNameNode == null || dimNameNode.getType() != Token.STRING)       return null;
      return dimNameNode.getString();
    }
  }
  result=getScriptObjectName(n.getFirstChild(),objectName);
  if (result == null)   result=getScriptObjectName(n.getLastChild(),objectName);
  return result;
}

Fixed version (ground truth):
/** 
 * @param n
 * @param objectName
 * @return
 */
private static String getScriptObjectName(Node n,String objectName){
  if (n == null)   return null;
  String result=null;
  if (n.getType() == Token.NAME) {
    if (objectName.equals(n.getString())) {
      Node dimNameNode=n.getNext();
      if (dimNameNode == null || dimNameNode.getType() != Token.STRING)       return null;
      return dimNameNode.getString();
    }
  }
  result=getScriptObjectName(n.getFirstChild(),objectName);
  if (result == null)   result=getScriptObjectName(n.getLastChild(),objectName);
  if (result == null)   result=getScriptObjectName(n.getNext(),objectName);
  return result;
}
Program: 68397
Project: 68397
Buggy source:
public int getParameterMode(int param) throws OdaException {
  logger.logp(java.util.logging.Level.FINE,SPParameterMetaData.class.getName(),"String_Node_Str","String_Node_Str");
  assertNotNull(paramMetadataArray);
  int result=IParameterMetaData.parameterModeUnknown;
  ParameterDefn paramDefn=(ParameterDefn)paramMetadataArray[param - 1];
  if (paramDefn.getParamInOutType() == java.sql.ParameterMetaData.parameterModeIn)   result=IParameterMetaData.parameterModeIn;
 else   if (paramDefn.getParamInOutType() == java.sql.ParameterMetaData.parameterModeOut)   result=IParameterMetaData.parameterModeOut;
 else   if (paramDefn.getParamInOutType() == java.sql.ParameterMetaData.parameterModeInOut)   result=IParameterMetaData.parameterModeInOut;
  return result;
}

Fixed version (ground truth):
public int getParameterMode(int param) throws OdaException {
  logger.logp(java.util.logging.Level.FINE,SPParameterMetaData.class.getName(),"String_Node_Str","String_Node_Str");
  assertNotNull(paramMetadataArray);
  int result=IParameterMetaData.parameterModeUnknown;
  ParameterDefn paramDefn=(ParameterDefn)paramMetadataArray[param - 1];
  if (paramDefn.getParamInOutType() == java.sql.ParameterMetaData.parameterModeIn)   result=IParameterMetaData.parameterModeIn;
 else   if (paramDefn.getParamInOutType() == java.sql.ParameterMetaData.parameterModeOut)   result=IParameterMetaData.parameterModeOut;
 else   if (paramDefn.getParamInOutType() == java.sql.ParameterMetaData.parameterModeInOut)   result=IParameterMetaData.parameterModeInOut;
 else   if (paramDefn.getParamInOutType() == 5)   result=IParameterMetaData.parameterModeOut;
  return result;
}
Program: 68399
Project: 68399
Buggy source:
protected void createAndInitCustomControl(Composite parent,Properties profileProps){
  if (m_pageHelper == null)   m_pageHelper=new JDBCSelectionPageHelper(this);
  m_pageHelper.createCustomControl(parent);
  m_pageHelper.addBidiSettingsButton(parent,profileProps);
  this.setPingButtonVisible(false);
  m_pageHelper.initCustomControl(profileProps);
}

Fixed version (ground truth):
protected void createAndInitCustomControl(Composite parent,Properties profileProps){
  if (m_pageHelper == null)   m_pageHelper=new JDBCSelectionPageHelper(this);
  Composite content=m_pageHelper.createCustomControl(parent);
  m_pageHelper.addBidiSettingsButton(content,profileProps);
  this.setPingButtonVisible(false);
  m_pageHelper.initCustomControl(profileProps);
}
Program: 68400
Project: 68400
Buggy source:
public void testMemoryCache() throws IOException {
  long used1=ArchiveFile.getTotalUsedCache();
  System.out.println(used1);
  ArchiveFile[] afs=new ArchiveFile[100];
  for (int i=0; i < afs.length; i++) {
    afs[i]=createArchiveFile("String_Node_Str" + i);
  }
  long used2=ArchiveFile.getTotalUsedCache();
  System.out.println(used2);
  ArchiveEntry[] entries=openEntries(afs[0],100);
  long used3=ArchiveFile.getTotalUsedCache();
  System.out.println(used3);
  closeEntries(entries);
  long used4=ArchiveFile.getTotalUsedCache();
  System.out.println(used4);
  for (int i=0; i < afs.length; i++) {
    afs[i].close();
  }
  long used5=ArchiveFile.getTotalUsedCache();
  System.out.println(used5);
}

Fixed version (ground truth):
public void testMemoryCache() throws IOException {
  long used1=ArchiveFile.getTotalUsedCache();
  System.out.println("String_Node_Str" + used1);
  ArchiveFile[] afs=new ArchiveFile[10];
  for (int i=0; i < afs.length; i++) {
    afs[i]=createArchiveFile("String_Node_Str" + i);
  }
  long used2=ArchiveFile.getTotalUsedCache();
  System.out.println("String_Node_Str" + used2);
  ArchiveEntry[] entries=openEntries(afs[0],100);
  long used3=ArchiveFile.getTotalUsedCache();
  System.out.println("String_Node_Str" + used3);
  closeEntries(entries);
  long used4=ArchiveFile.getTotalUsedCache();
  System.out.println("String_Node_Str" + used4);
  for (int i=0; i < afs.length; i++) {
    afs[i].close();
  }
  long used5=ArchiveFile.getTotalUsedCache();
  System.out.println("String_Node_Str" + used5);
}
Program: 68401
Project: 68401
Buggy source:
protected ArchiveEntry[] openEntries(ArchiveFile af,int size) throws IOException {
  ArchiveEntry[] entries=new ArchiveEntry[size];
  for (int i=0; i < entries.length; i++) {
    entries[i]=af.openEntry("String_Node_Str" + i);
  }
  return entries;
}

Fixed version (ground truth):
protected ArchiveEntry[] openEntries(ArchiveFile af,int size) throws IOException {
  ArchiveEntry[] entries=new ArchiveEntry[size];
  for (int i=0; i < entries.length; i++) {
    entries[i]=af.openEntry("String_Node_Str" + i);
    entries[i].read(0,new byte[13],0,13);
  }
  return entries;
}
Program: 68402
Project: 68402
Buggy source:
public synchronized boolean removeEntry(String name) throws IOException {
  assertWritable();
  ArchiveEntryV2 entry=(ArchiveEntryV2)entries.get(name);
  if (entry != null) {
    entries.remove(name);
    entryTbl.removeEntry(entry.entry);
    if (entry.index != null) {
      allocTbl.removeEntry(entry.index);
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
public synchronized boolean removeEntry(String name) throws IOException {
  assertWritable();
  NameEntry nameEntry=entries.get(name);
  if (nameEntry != null) {
    entries.remove(name);
    entryTbl.removeEntry(nameEntry);
    int blockId=nameEntry.getBlock();
    if (blockId != -1) {
      AllocEntry allocEntry=allocTbl.loadEntry(blockId);
      if (allocEntry != null) {
        allocTbl.removeEntry(allocEntry);
      }
    }
    return true;
  }
  return false;
}
Program: 68403
Project: 68403
Buggy source:
synchronized public Object lockEntry(String name) throws IOException {
  assertOpen();
  ArchiveEntryV2 entry=entries.get(name);
  if (entry == null) {
    if (!isWritable) {
      throw new FileNotFoundException(name);
    }
    entry=(ArchiveEntryV2)createEntry(name);
  }
  if (useNativeLock) {
    if (!isTransient) {
      entry.ensureSize(1);
      int blockId=entry.index.getBlock(0);
      return rf.getChannel().lock(blockId * BLOCK_SIZE,1,false);
    }
  }
  return entry;
}

Fixed version (ground truth):
synchronized public Object lockEntry(String name) throws IOException {
  assertOpen();
  NameEntry entry=entries.get(name);
  if (entry == null) {
    if (!isWritable) {
      throw new FileNotFoundException(name);
    }
    entry=entryTbl.createEntry(name);
    entries.put(name,entry);
  }
  return entry;
}
Program: 68404
Project: 68404
Buggy source:
/** 
 * open the archive file for read or rw.
 * @throws IOException
 */
private void openDocument() throws IOException {
  try {
    if (rf == null) {
      if (!isWritable && !useNativeLock) {
        rf=new RandomAccessFile(archiveName,"String_Node_Str");
      }
 else {
        ensureParentFolderCreated();
        rf=new RandomAccessFile(archiveName,"String_Node_Str");
      }
    }
    head=ArchiveHeader.read(rf);
    if (systemId == null) {
      systemId=head.systemId;
    }
    if (dependId == null) {
      dependId=head.dependId;
    }
    BLOCK_SIZE=head.blockSize;
    totalBlocks=(int)((rf.length() + BLOCK_SIZE - 1) / BLOCK_SIZE);
    totalDiskBlocks=totalBlocks;
    allocTbl=AllocTable.loadTable(this);
    entryTbl=NameTable.loadTable(this);
    entries=new HashMap();
    Iterator iter=entryTbl.listEntries().iterator();
    while (iter.hasNext()) {
      NameEntry nameEnt=(NameEntry)iter.next();
      entries.put(nameEnt.getName(),new ArchiveEntryV2(this,nameEnt));
    }
  }
 catch (  IOException ex) {
    if (rf != null) {
      rf.close();
      rf=null;
    }
    throw ex;
  }
}

Fixed version (ground truth):
/** 
 * open the archive file for read or rw.
 * @throws IOException
 */
private void openDocument() throws IOException {
  try {
    if (rf == null) {
      if (!isWritable) {
        rf=new RandomAccessFile(archiveName,"String_Node_Str");
      }
 else {
        ensureParentFolderCreated();
        rf=new RandomAccessFile(archiveName,"String_Node_Str");
      }
    }
    head=ArchiveHeader.read(rf);
    if (systemId == null) {
      systemId=head.systemId;
    }
    if (dependId == null) {
      dependId=head.dependId;
    }
    BLOCK_SIZE=head.blockSize;
    totalBlocks=(int)((rf.length() + BLOCK_SIZE - 1) / BLOCK_SIZE);
    totalDiskBlocks=totalBlocks;
    allocTbl=AllocTable.loadTable(this);
    entryTbl=NameTable.loadTable(this);
    entries=new HashMap();
    Iterator iter=entryTbl.listEntries().iterator();
    while (iter.hasNext()) {
      NameEntry nameEnt=(NameEntry)iter.next();
      entries.put(nameEnt.getName(),nameEnt);
    }
  }
 catch (  IOException ex) {
    if (rf != null) {
      rf.close();
      rf=null;
    }
    throw ex;
  }
}
Program: 68405
Project: 68405
Buggy source:
public synchronized ArchiveEntry openEntry(String name) throws IOException {
  ArchiveEntryV2 entry=entries.get(name);
  if (entry != null) {
    return entry;
  }
  throw new FileNotFoundException(name);
}

Fixed version (ground truth):
public synchronized ArchiveEntry openEntry(String name) throws IOException {
  NameEntry nameEnt=entries.get(name);
  if (nameEnt != null) {
    return new ArchiveEntryV2(this,nameEnt);
  }
  throw new FileNotFoundException(name);
}