nus-yam/ex-repair huggingface dataset:
Program: 73099
Project: 73099
Buggy source:
/** 
 * Creates unique result set column names if column names are <code>null</code> or empty string.
 * @param resultSetColumn a list containing result set columns
 */
private static void createUniqueResultSetColumnNames(List columnInfo){
  if (columnInfo == null || columnInfo.isEmpty())   return;
  Set names=new HashSet();
  for (int i=0; i < columnInfo.size(); i++) {
    ResultSetColumnInfo tmpInfo=(ResultSetColumnInfo)columnInfo.get(i);
    OdaResultSetColumn column=tmpInfo.column;
    String nativeName=column.getNativeName();
    if (nativeName != null)     names.add(nativeName);
  }
  Set newNames=new HashSet();
  for (int i=0; i < columnInfo.size(); i++) {
    ResultSetColumnInfo tmpInfo=(ResultSetColumnInfo)columnInfo.get(i);
    OdaResultSetColumn column=tmpInfo.column;
    String nativeName=column.getNativeName();
    String name=column.getColumnName();
    if (!StringUtil.isBlank(name))     continue;
    String newName=IdentifierUtility.getUniqueColumnName(names,newNames,nativeName,i);
    newNames.add(newName);
    column.setColumnName(newName);
    if (tmpInfo.hint != null)     tmpInfo.hint.setProperty(ColumnHint.COLUMN_NAME_MEMBER,newName);
  }
  names.clear();
  newNames.clear();
}

Fixed version (ground truth):
/** 
 * Creates unique result set column names if column names are <code>null</code> or empty string.
 * @param resultSetColumn a list containing result set columns
 */
private static void createUniqueResultSetColumnNames(List columnInfo){
  if (columnInfo == null || columnInfo.isEmpty())   return;
  Set names=new HashSet();
  for (int i=0; i < columnInfo.size(); i++) {
    ResultSetColumnInfo tmpInfo=(ResultSetColumnInfo)columnInfo.get(i);
    OdaResultSetColumn column=tmpInfo.column;
    String nativeName=column.getNativeName();
    if (nativeName != null)     names.add(nativeName);
  }
  Set newNames=new HashSet();
  for (int i=0; i < columnInfo.size(); i++) {
    ResultSetColumnInfo tmpInfo=(ResultSetColumnInfo)columnInfo.get(i);
    OdaResultSetColumn column=tmpInfo.column;
    String nativeName=column.getNativeName();
    String name=column.getColumnName();
    if (!StringUtil.isBlank(name)) {
      newNames.add(name);
      continue;
    }
    String newName=IdentifierUtility.getUniqueColumnName(names,newNames,nativeName,i);
    newNames.add(newName);
    column.setColumnName(newName);
    if (tmpInfo.hint != null)     tmpInfo.hint.setProperty(ColumnHint.COLUMN_NAME_MEMBER,newName);
  }
  names.clear();
  newNames.clear();
}
Program: 73102
Project: 73102
Buggy source:
/** 
 * Pastes a report item to the slot. The item must be newly created and not yet added to the design.
 * @param copy the copy from the return value of <code>copy</code>
 * @param container the target container
 * @param propName the property name of the target container
 * @param newPos the target position
 * @return a list containing all errors for the pasted element
 * @throws SemanticException if the element is not allowed in the slot
 */
public static List paste(IElementCopy copy,DesignElementHandle container,String propName,int newPos) throws SemanticException {
  ContainerContext context=new ContainerContext(container.getElement(),propName);
  if (!canPaste(copy,container,propName))   throw ContentExceptionFactory.createContentException(context,ContentException.DESIGN_EXCEPTION_CONTENT_NOT_ALLOWED_PASTED);
  IDesignElement chosen=ContextCopyPastePolicy.getInstance().preWorkForPaste(context,copy,container.getModule());
  DesignElementHandle target=chosen.getHandle(container.getModule());
  container.getModuleHandle().rename(container,target);
  return container.paste(propName,chosen,newPos);
}

Fixed version (ground truth):
/** 
 * Pastes a report item to the slot. The item must be newly created and not yet added to the design.
 * @param copy the copy from the return value of <code>copy</code>
 * @param container the target container
 * @param propName the property name of the target container
 * @param newPos the target position
 * @return a list containing all errors for the pasted element
 * @throws SemanticException if the element is not allowed in the slot
 */
public static List paste(IElementCopy copy,DesignElementHandle container,String propName,int newPos) throws SemanticException {
  ContainerContext context=new ContainerContext(container.getElement(),propName);
  Module root=container.getModule();
  if (!canPaste(copy,container,propName))   throw ContentExceptionFactory.createContentException(context,ContentException.DESIGN_EXCEPTION_CONTENT_NOT_ALLOWED_PASTED);
  IDesignElement chosen=ContextCopyPastePolicy.getInstance().preWorkForPaste(context,copy,root);
  DesignElementHandle target=chosen.getHandle(root);
  container.getModuleHandle().rename(container,target);
  if (chosen == null)   return Collections.EMPTY_LIST;
  container.add(propName,target,newPos);
  return checkPostPasteErrors(target.getElement(),root);
}
Program: 73103
Project: 73103
Buggy source:
private Object getTableParent(){
  return DNDUtil.getTableParent(getHandle());
}

Fixed version (ground truth):
public Object getTableParent(){
  DesignElementHandle handle=getCellHandle();
  while (handle != null) {
    if (handle instanceof TableHandle) {
      return handle;
    }
    if (handle instanceof GridHandle) {
      return handle;
    }
    handle=handle.getContainer();
  }
  return null;
}
Program: 73104
Project: 73104
Buggy source:
/** 
 * Remove colleagure from mediator.
 * @param colleague
 */
public void removeGlobalColleague(IColleague colleague){
  if (DesignerConstants.TRACING_MEDIATOR_GLOBAL_COLLEAGUE_REMOVE) {
    System.out.println("String_Node_Str" + colleague);
  }
  globalListener.remove(colleague);
}

Fixed version (ground truth):
/** 
 * Remove colleagure from mediator.
 * @param colleague
 */
public static void removeGlobalColleague(IColleague colleague){
  if (DesignerConstants.TRACING_MEDIATOR_GLOBAL_COLLEAGUE_REMOVE) {
    System.out.println("String_Node_Str" + colleague);
  }
  globalListener.remove(colleague);
}
Program: 73105
Project: 73105
Buggy source:
/** 
 * Add global colleague
 * @param colleague
 */
public void addGlobalColleague(IColleague colleague){
  if (!globalListener.contains(colleague)) {
    if (DesignerConstants.TRACING_MEDIATOR_GLOBAL_COLLEAGUE_ADD) {
      System.out.println("String_Node_Str" + colleague);
    }
    globalListener.add(colleague);
  }
}

Fixed version (ground truth):
/** 
 * Add global colleague
 * @param colleague
 */
public static void addGlobalColleague(IColleague colleague){
  if (!globalListener.contains(colleague)) {
    if (DesignerConstants.TRACING_MEDIATOR_GLOBAL_COLLEAGUE_ADD) {
      System.out.println("String_Node_Str" + colleague);
    }
    globalListener.add(colleague);
  }
}
Program: 73107
Project: 73107
Buggy source:
protected static Command pasteParameterGroup(String commandType,Object childGroup,ParameterGroupHandle targetGroup) throws SemanticException {
  CompoundCommand commands=new CompoundCommand();
  ParameterGroupHandle childHandle=null;
  if (childGroup instanceof ParameterGroupHandle) {
    childHandle=(ParameterGroupHandle)childGroup;
  }
 else   if (DEUtil.isParameterGroup(childGroup)) {
    childHandle=(ParameterGroupHandle)((IDesignElement)childGroup).getHandle(SessionHandleAdapter.getInstance().getReportDesignHandle().getModule());
  }
  if (childHandle != null) {
    SlotHandle transferSlot=childHandle.getParameters();
    for (Iterator i=transferSlot.iterator(); i.hasNext(); ) {
      commands.add(getNewCommand(commandType,i.next(),targetGroup,-1));
    }
  }
  if (commandType.equals(TYPE_CUT)) {
    childHandle.drop();
  }
  return commands;
}

Fixed version (ground truth):
private static Command pasteParameterGroup(String commandType,Object childGroup,ParameterGroupHandle targetGroup) throws SemanticException {
  CompoundCommand commands=new CompoundCommand();
  ParameterGroupHandle childHandle=null;
  if (childGroup instanceof ParameterGroupHandle) {
    childHandle=(ParameterGroupHandle)childGroup;
  }
 else   if (DEUtil.isParameterGroup(childGroup)) {
    childHandle=(ParameterGroupHandle)((IDesignElement)childGroup).getHandle(SessionHandleAdapter.getInstance().getReportDesignHandle().getModule());
  }
  if (childHandle != null) {
    SlotHandle transferSlot=childHandle.getParameters();
    for (Iterator i=transferSlot.iterator(); i.hasNext(); ) {
      commands.add(getNewCommand(commandType,i.next(),targetGroup,-1));
    }
  }
  if (commandType.equals(TYPE_CUT)) {
    childHandle.drop();
  }
  return commands;
}
Program: 73108
Project: 73108
Buggy source:
protected static Object transferSlotHandle(String commandType,Object handle){
  Object cloneObj=cloneSource(handle);
  if (TYPE_CUT.equals(commandType)) {
    dropSource(handle);
  }
  return cloneObj;
}

Fixed version (ground truth):
private static Object transferSlotHandle(String commandType,Object handle){
  Object cloneObj=cloneSource(handle);
  if (TYPE_CUT.equals(commandType)) {
    dropSource(handle);
  }
  return cloneObj;
}
Program: 73109
Project: 73109
Buggy source:
protected static ColumnBandData getColumnHandle(Object transferData){
  if (transferData instanceof ColumnBandData) {
    return (ColumnBandData)transferData;
  }
  if (transferData instanceof Object[] && ((Object[])transferData).length == 1) {
    return getColumnHandle(((Object[])transferData)[0]);
  }
  return null;
}

Fixed version (ground truth):
private static ColumnBandData getColumnHandle(Object transferData){
  if (transferData instanceof ColumnBandData) {
    return (ColumnBandData)transferData;
  }
  if (transferData instanceof Object[] && ((Object[])transferData).length == 1) {
    return getColumnHandle(((Object[])transferData)[0]);
  }
  return null;
}
Program: 73110
Project: 73110
Buggy source:
/** 
 * Returns specified command
 * @param commandType command type, value is <code>TYPE_CUT</code> or <code>TYPE_COPY</code>
 * @param transferSource transfer source
 * @param newContainer the new container
 * @param position the position will be added
 * @return command
 */
protected static Command getNewCommand(String commandType,Object transferSource,Object newContainer,int position) throws SemanticException {
  boolean isCut=TYPE_CUT.equals(commandType);
  if (newContainer instanceof ParameterGroupHandle && (transferSource instanceof ParameterGroupHandle || DEUtil.isParameterGroup(transferSource))) {
    return pasteParameterGroup(commandType,transferSource,(ParameterGroupHandle)newContainer);
  }
 else   if (transferSource instanceof DesignElementHandle) {
    return new PasteCommand((DesignElementHandle)transferSource,newContainer,position,isCut);
  }
 else   if (transferSource instanceof IDesignElement) {
    return new PasteCommand((IDesignElement)transferSource,newContainer,position);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns specified command
 * @param commandType command type, value is <code>TYPE_CUT</code> or <code>TYPE_COPY</code>
 * @param transferSource transfer source
 * @param newContainer the new container
 * @param position the position will be added
 * @return command
 */
private static Command getNewCommand(String commandType,Object transferSource,Object newContainer,int position) throws SemanticException {
  boolean isCut=TYPE_CUT.equals(commandType);
  if (newContainer instanceof ParameterGroupHandle && (transferSource instanceof ParameterGroupHandle || DEUtil.isParameterGroup(transferSource))) {
    return pasteParameterGroup(commandType,transferSource,(ParameterGroupHandle)newContainer);
  }
 else   if (transferSource instanceof DesignElementHandle) {
    return new PasteCommand((DesignElementHandle)transferSource,newContainer,position,isCut);
  }
 else   if (transferSource instanceof IDesignElement) {
    return new PasteCommand((IDesignElement)transferSource,newContainer,position);
  }
  return null;
}
Program: 73111
Project: 73111
Buggy source:
/** 
 * Pastes table or grid columns to target
 * @param transferData column data
 * @param targetObj table
 * @param isNew true: insert and paste; false: override and paste
 * @return paste succeed or fail
 */
protected static boolean copyColumn(ColumnBandData transferData,Object targetObj,boolean isNew){
  try {
    int columnNumber=HandleAdapterFactory.getInstance().getColumnHandleAdapter(targetObj).getColumnNumber();
    Object parent=((ColumnHandle)targetObj).getContainer();
    if (parent instanceof TableHandle) {
      if (isNew) {
        ((TableHandle)parent).insertAndPasteColumn(transferData.copy(),columnNumber);
      }
 else {
        ((TableHandle)parent).pasteColumn(transferData.copy(),columnNumber,true);
      }
    }
 else     if (parent instanceof GridHandle) {
      if (isNew) {
        ((GridHandle)parent).insertAndPasteColumn(transferData.copy(),columnNumber);
      }
 else {
        ((GridHandle)parent).pasteColumn(transferData.copy(),columnNumber,true);
      }
    }
  }
 catch (  SemanticException e) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Pastes table or grid columns to target
 * @param transferData column data
 * @param targetObj table
 * @param isNew true: insert and paste; false: override and paste
 * @return paste succeed or fail
 */
private static boolean copyColumn(ColumnBandData transferData,Object targetObj,boolean isNew){
  try {
    int columnNumber=HandleAdapterFactory.getInstance().getColumnHandleAdapter(targetObj).getColumnNumber();
    Object parent=((ColumnHandle)targetObj).getContainer();
    if (parent instanceof TableHandle) {
      if (isNew) {
        ((TableHandle)parent).insertAndPasteColumn(transferData.copy(),columnNumber);
      }
 else {
        ((TableHandle)parent).pasteColumn(transferData.copy(),columnNumber,true);
      }
    }
 else     if (parent instanceof GridHandle) {
      if (isNew) {
        ((GridHandle)parent).insertAndPasteColumn(transferData.copy(),columnNumber);
      }
 else {
        ((GridHandle)parent).pasteColumn(transferData.copy(),columnNumber,true);
      }
    }
  }
 catch (  SemanticException e) {
    return false;
  }
  return true;
}
Program: 73112
Project: 73112
Buggy source:
protected static int handleValidateTargetCanContainByContainer(Object targetObj,Object[] childHandles,boolean validateContainer){
  if (childHandles.length == 0) {
    return CONTAIN_NO;
  }
  for (int i=0; i < childHandles.length; i++) {
    if (!(childHandles[i] instanceof DesignElementHandle) || handleValidateTargetCanContainByContainer(targetObj,(DesignElementHandle)childHandles[i],validateContainer) == CONTAIN_NO) {
      return CONTAIN_NO;
    }
  }
  return CONTAIN_THIS;
}

Fixed version (ground truth):
static int handleValidateTargetCanContainByContainer(Object targetObj,Object[] childHandles,boolean validateContainer){
  if (childHandles.length == 0) {
    return CONTAIN_NO;
  }
  for (int i=0; i < childHandles.length; i++) {
    if (!(childHandles[i] instanceof DesignElementHandle) || handleValidateTargetCanContainByContainer(targetObj,(DesignElementHandle)childHandles[i],validateContainer) == CONTAIN_NO) {
      return CONTAIN_NO;
    }
  }
  return CONTAIN_THIS;
}
Program: 73114
Project: 73114
Buggy source:
/** 
 * Operates elements. Operation type includes move or copy. Includes transaction.
 * @param transferData single or multiple transfer data, every data must be an instance of <code>DesignElementHandle</code> or <code>DesignElement</code>
 * @param targetObj target elements, class type could be <code>DesignElementHandle</code>,<code>SlotHandle</code> or <code>ReportElementModel</code>
 * @param position the position will be added
 * @param commandName
 * @param commandType TYPE_CUT or TYPE_COPY
 * @return if succeeding in operating data
 */
protected static boolean operateHandles(Object transferData,Object targetObj,int position,String commandName,String commandType){
  ModuleHandle designHandle=SessionHandleAdapter.getInstance().getReportDesignHandle();
  CommandStack stack=designHandle.getCommandStack();
  try {
    stack.startTrans(commandName);
    CompoundCommand commands=new CompoundCommand();
    if (transferData instanceof StructuredSelection) {
      transferData=((StructuredSelection)transferData).toArray();
    }
    addCommandToCompound(transferData,targetObj,position,commandName,commandType,commands);
    commands.execute();
    stack.commit();
  }
 catch (  Exception e) {
    stack.rollbackAll();
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Operates elements. Operation type includes move or copy. Includes transaction.
 * @param transferData single or multiple transfer data, every data must be an instance of <code>DesignElementHandle</code> or <code>DesignElement</code>
 * @param targetObj target elements, class type could be <code>DesignElementHandle</code>,<code>SlotHandle</code> or <code>ReportElementModel</code>
 * @param position the position will be added
 * @param commandName
 * @param commandType TYPE_CUT or TYPE_COPY
 * @return if succeeding in operating data
 */
private static boolean operateHandles(Object transferData,Object targetObj,int position,String commandName,String commandType){
  ModuleHandle designHandle=SessionHandleAdapter.getInstance().getReportDesignHandle();
  CommandStack stack=designHandle.getCommandStack();
  try {
    stack.startTrans(commandName);
    CompoundCommand commands=new CompoundCommand();
    if (transferData instanceof StructuredSelection) {
      transferData=((StructuredSelection)transferData).toArray();
    }
    addCommandToCompound(transferData,targetObj,position,commandName,commandType,commands);
    commands.execute();
    stack.commit();
  }
 catch (  Exception e) {
    stack.rollbackAll();
    return false;
  }
  return true;
}
Program: 73115
Project: 73115
Buggy source:
/** 
 * Returns if all objects are in the same column
 * @param objs the array of the object
 */
public static boolean isInSameColumn(Object[] objs){
}

Fixed version (ground truth):
/** 
 * Returns if all objects are in the same column
 * @param objs the array of the object
 */
static boolean isInSameColumn(Object[] objs){
}
Program: 73116
Project: 73116
Buggy source:
/** 
 * @return the current mediator
 */
public ReportMediator getMediator(){
  return getMediator(getReportDesignHandle());
}

Fixed version (ground truth):
/** 
 * @deprecated use {{@link #getMediator(ModuleHandle)}
 * @return the current mediator
 */
public ReportMediator getMediator(){
  return getMediator(getReportDesignHandle());
}
Program: 73117
Project: 73117
Buggy source:
/** 
 * @deprecated
 * @return wrapped report design handle.
 */
public ModuleHandle getReportDesignHandle(){
  if (model == null) {
    IWorkbenchWindow activeWindow=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    model=(ModuleHandle)reportHandleMap.get(activeWindow);
  }
  return model;
}

Fixed version (ground truth):
/** 
 * @deprecated always try find reprot handle in current context first
 * @return wrapped report design handle.
 */
public ModuleHandle getReportDesignHandle(){
  if (model == null) {
    IWorkbenchWindow activeWindow=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    model=(ModuleHandle)reportHandleMap.get(activeWindow);
  }
  return model;
}
Program: 73118
Project: 73118
Buggy source:
/** 
 * Get file type
 * @return File type
 */
public int getFileType(){
  return type;
}

Fixed version (ground truth):
/** 
 * Get file type
 * @return File type
 * @deprecated not used any more
 */
public int getFileType(){
  return type;
}
Program: 73119
Project: 73119
Buggy source:
/** 
 * @return Returns the first master page handle in given module
 */
public MasterPageHandle getFirstMasterPageHandle(ModuleHandle handle){
  SlotHandle slotHandle=handle.getMasterPages();
  if (slotHandle.getCount() > 0) {
    return (MasterPageHandle)slotHandle.getContents().get(0);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @return Returns the first master page handle in given module
 */
public MasterPageHandle getFirstMasterPageHandle(ModuleHandle handle){
  if (handle == null) {
    return null;
  }
  SlotHandle slotHandle=handle.getMasterPages();
  if (slotHandle.getCount() > 0) {
    return (MasterPageHandle)slotHandle.getContents().get(0);
  }
  return null;
}
Program: 73120
Project: 73120
Buggy source:
/** 
 * Sets report design.
 * @param handle the model
 */
public void setReportDesignHandle(ModuleHandle handle){
  PlatformUI.getWorkbench().removeWindowListener(pageListener);
  IWorkbenchWindow activeWindow=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  if (handle == null) {
    reportHandleMap.remove(activeWindow);
  }
 else {
    PlatformUI.getWorkbench().addWindowListener(pageListener);
  }
  if (activeWindow != null) {
    reportHandleMap.put(activeWindow,handle);
  }
  model=handle;
}

Fixed version (ground truth):
/** 
 * Sets report design in current session.
 * @param handle the model
 */
public void setReportDesignHandle(ModuleHandle handle){
  PlatformUI.getWorkbench().removeWindowListener(pageListener);
  IWorkbenchWindow activeWindow=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  if (handle == null) {
    reportHandleMap.remove(activeWindow);
  }
 else {
    PlatformUI.getWorkbench().addWindowListener(pageListener);
  }
  if (activeWindow != null) {
    reportHandleMap.put(activeWindow,handle);
  }
  model=handle;
}
Program: 73121
Project: 73121
Buggy source:
private WrapperCommandStack getCommandStack(){
  return new WrapperCommandStack();
}

Fixed version (ground truth):
private WrapperCommandStack getCommandStack(){
  return new WrapperCommandStack(getModel().getCommandStack());
}
Program: 73122
Project: 73122
Buggy source:
/** 
 * Clears the dirty flag.
 */
private void clearDirtyFlag(){
  IReportProvider provider=getProvider();
  if (provider != null && getErrorLIine(false) == -1) {
    unhookModelEventManager(getModel());
    getCommandStack().removeCommandStackListener(getCommandStackListener());
    ModuleHandle model=provider.getReportModuleHandle(getEditorInput(),true);
    SessionHandleAdapter.getInstance().setReportDesignHandle(model);
    SessionHandleAdapter.getInstance().getMediator().addColleague(this);
    hookModelEventManager(getModel());
    getCommandStack().addCommandStackListener(getCommandStackListener());
    setIsModified(false);
    getEditor().editorDirtyStateChanged();
    if (isActive() && !isLeaving) {
      getReportEditor().reloadOutlinePage();
    }
  }
}

Fixed version (ground truth):
/** 
 * Clears the dirty flag.
 */
private void clearDirtyFlag(){
  IReportProvider provider=getProvider();
  if (provider != null && getErrorLIine(false) == -1) {
    unhookModelEventManager(getModel());
    getCommandStack().removeCommandStackListener(getCommandStackListener());
    SessionHandleAdapter.getInstance().getMediator(getModel()).removeColleague(this);
    ModuleHandle model=provider.getReportModuleHandle(getEditorInput(),true);
    SessionHandleAdapter.getInstance().setReportDesignHandle(model);
    SessionHandleAdapter.getInstance().getMediator(model).addColleague(this);
    hookModelEventManager(getModel());
    getCommandStack().addCommandStackListener(getCommandStackListener());
    setIsModified(false);
    getEditor().editorDirtyStateChanged();
    if (isActive() && !isLeaving) {
      getReportEditor().reloadOutlinePage();
    }
  }
}
Program: 73123
Project: 73123
Buggy source:
public void dispose(){
  super.dispose();
  reportXMLEditor.dispose();
  reportXMLEditor=null;
  unhookModelEventManager(getModel());
}

Fixed version (ground truth):
public void dispose(){
  super.dispose();
  reportXMLEditor.dispose();
  reportXMLEditor=null;
  unhookModelEventManager(getModel());
  SessionHandleAdapter.getInstance().getMediator(getModel()).removeColleague(this);
}
Program: 73124
Project: 73124
Buggy source:
public void createPartControl(Composite parent){
  reportXMLEditor.createPartControl(parent);
  Control[] children=parent.getChildren();
  control=children[children.length - 1];
  SessionHandleAdapter.getInstance().getMediator().addColleague(this);
  if (SessionHandleAdapter.getInstance().getCommandStack() != null) {
    getCommandStack().addCommandStackListener(getCommandStackListener());
    hookModelEventManager(getModel());
  }
  reportXMLEditor.getTextViewer().addTextListener(new ITextListener(){
    public void textChanged(    TextEvent event){
      if (!isTextModified() && event.getOffset() != 0) {
        markDirty();
      }
    }
  }
);
  reportXMLEditor.getTextViewer().getTextWidget().addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      markDirty();
    }
  }
);
}

Fixed version (ground truth):
public void createPartControl(Composite parent){
  reportXMLEditor.createPartControl(parent);
  Control[] children=parent.getChildren();
  control=children[children.length - 1];
  SessionHandleAdapter.getInstance().getMediator(getModel()).addColleague(this);
  if (getModel() != null && getModel().getCommandStack() != null) {
    getCommandStack().addCommandStackListener(getCommandStackListener());
    hookModelEventManager(getModel());
  }
  reportXMLEditor.getTextViewer().addTextListener(new ITextListener(){
    public void textChanged(    TextEvent event){
      if (!isTextModified() && event.getOffset() != 0) {
        markDirty();
      }
    }
  }
);
  reportXMLEditor.getTextViewer().getTextWidget().addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      markDirty();
    }
  }
);
}
Program: 73125
Project: 73125
Buggy source:
public boolean onBroughtToTop(IReportEditorPage prePage){
  if (getEditorInput() != prePage.getEditorInput()) {
    setInput(prePage.getEditorInput());
  }
  if (prePage != this && (prePage.isDirty() || prePage.getStaleType() != IPageStaleType.NONE)) {
    prePage.doSave(null);
    prePage.markPageStale(IPageStaleType.NONE);
    refreshDocument();
    markPageStale(IPageStaleType.NONE);
  }
  hookModelEventManager(getModel());
  ReportRequest request=new ReportRequest(ReportXMLSourceEditorFormPage.this);
  List list=new ArrayList();
  request.setSelectionObject(list);
  request.setType(ReportRequest.SELECTION);
  SessionHandleAdapter.getInstance().getMediator().notifyRequest(request);
  return true;
}

Fixed version (ground truth):
public boolean onBroughtToTop(IReportEditorPage prePage){
  if (getEditorInput() != prePage.getEditorInput()) {
    setInput(prePage.getEditorInput());
  }
  if (prePage != this && (prePage.isDirty() || prePage.getStaleType() != IPageStaleType.NONE)) {
    prePage.doSave(null);
    prePage.markPageStale(IPageStaleType.NONE);
    refreshDocument();
    markPageStale(IPageStaleType.NONE);
  }
  hookModelEventManager(getModel());
  ReportRequest request=new ReportRequest(ReportXMLSourceEditorFormPage.this);
  List list=new ArrayList();
  request.setSelectionObject(list);
  request.setType(ReportRequest.SELECTION);
  SessionHandleAdapter.getInstance().getMediator(getModel()).notifyRequest(request);
  return true;
}
Program: 73126
Project: 73126
Buggy source:
public void testTotalPercentSum() throws Exception {
  IAggrFunction ag=buildInAggrFactory.getAggregation("String_Node_Str");
  Accumulator ac=ag.newAccumulator();
  assertEquals(IBuildInAggregation.TOTAL_PERCENTSUM_FUNC,ag.getName());
  assertEquals(IAggrFunction.RUNNING_AGGR,ag.getType());
  assertEquals(1,ag.getParameterDefn().length);
  assertTrue(!ag.getParameterDefn()[0].isOptional());
  ac.start();
  for (int i=0; i < doubleArray3.length; i++) {
    ac.onRow(new Object[]{doubleArray3[i]});
  }
  ac.finish();
  ac.start();
  for (int i=0; i < doubleArray3.length; i++) {
    ac.onRow(new Object[]{doubleArray3[i]});
    assertEquals(doubleArray3PercentSum[i],ac.getValue().equals("String_Node_Str") ? null : new Integer((int)(new Double(ac.getValue().toString()).doubleValue() * 1000)));
  }
  ac.finish();
  ac.start();
  for (int i=0; i < str2.length; i++) {
    try {
      ac.onRow(new Object[]{str2[i]});
      fail();
    }
 catch (    DataException e) {
    }
  }
  ac.finish();
}

Fixed version (ground truth):
public void testTotalPercentSum() throws Exception {
  IAggrFunction ag=buildInAggrFactory.getAggregation("String_Node_Str");
  Accumulator ac=ag.newAccumulator();
  assertEquals(IBuildInAggregation.TOTAL_PERCENTSUM_FUNC,ag.getName());
  assertEquals(IAggrFunction.RUNNING_AGGR,ag.getType());
  assertEquals(1,ag.getParameterDefn().length);
  assertTrue(!ag.getParameterDefn()[0].isOptional());
  ac.start();
  for (int i=0; i < doubleArray3.length; i++) {
    ac.onRow(new Object[]{doubleArray3[i]});
  }
  ac.finish();
  ac.start();
  for (int i=0; i < doubleArray3.length; i++) {
    ac.onRow(new Object[]{doubleArray3[i]});
    assertEquals(doubleArray3PercentSum[i] == null ? new Integer(0) : doubleArray3PercentSum[i],new Integer((int)(new Double(ac.getValue().toString()).doubleValue() * 1000)));
  }
  ac.finish();
  ac.start();
  for (int i=0; i < str2.length; i++) {
    try {
      ac.onRow(new Object[]{str2[i]});
      fail();
    }
 catch (    DataException e) {
    }
  }
  ac.finish();
}
Program: 73127
Project: 73127
Buggy source:
public void writeText(Data d){
  writer.openTag("String_Node_Str");
  if (d.getDatatype().equals(Data.NUMBER) && ExcelUtil.isNumber(d.getText())) {
    writer.attribute("String_Node_Str","String_Node_Str");
  }
 else   if (d.getDatatype().equals(Data.DATE)) {
    writer.attribute("String_Node_Str","String_Node_Str");
  }
 else {
    writer.attribute("String_Node_Str","String_Node_Str");
  }
  String txt=d.getText();
  if (CSSConstants.CSS_CAPITALIZE_VALUE.equalsIgnoreCase(d.getStyleEntry().getProperty(StyleConstant.TEXT_TRANSFORM))) {
    txt=capitalize(txt);
  }
 else   if (CSSConstants.CSS_UPPERCASE_VALUE.equalsIgnoreCase(d.getStyleEntry().getProperty(StyleConstant.TEXT_TRANSFORM))) {
    txt=txt.toUpperCase();
  }
 else   if (CSSConstants.CSS_LOWERCASE_VALUE.equalsIgnoreCase(d.getStyleEntry().getProperty(StyleConstant.TEXT_TRANSFORM))) {
    txt=txt.toLowerCase();
  }
  writer.text(txt);
  writer.closeTag("String_Node_Str");
}

Fixed version (ground truth):
public void writeText(Data d){
  writer.openTag("String_Node_Str");
  if (d.getDatatype().equals(Data.NUMBER) && ExcelUtil.isNumber(d.getText())) {
    writer.attribute("String_Node_Str","String_Node_Str");
  }
 else   if (d.getDatatype().equals(Data.DATE)) {
    writer.attribute("String_Node_Str","String_Node_Str");
  }
 else {
    writer.attribute("String_Node_Str","String_Node_Str");
  }
  d.formatTxt();
  String txt=d.getText();
  if (CSSConstants.CSS_CAPITALIZE_VALUE.equalsIgnoreCase(d.getStyleEntry().getProperty(StyleConstant.TEXT_TRANSFORM))) {
    txt=capitalize(txt);
  }
 else   if (CSSConstants.CSS_UPPERCASE_VALUE.equalsIgnoreCase(d.getStyleEntry().getProperty(StyleConstant.TEXT_TRANSFORM))) {
    txt=txt.toUpperCase();
  }
 else   if (CSSConstants.CSS_LOWERCASE_VALUE.equalsIgnoreCase(d.getStyleEntry().getProperty(StyleConstant.TEXT_TRANSFORM))) {
    txt=txt.toLowerCase();
  }
  writer.text(txt);
  writer.closeTag("String_Node_Str");
}
Program: 73128
Project: 73128
Buggy source:
private String applyFont(String fontName,int fontStyle,float fontSize,String text){
  if (isIntrinsicFont(fontName)) {
    return applyIntrinsicFont(fontName,fontStyle,fontSize,text);
  }
 else {
    try {
      String fontPath=getFontPath(fontName);
      if (fontPath == null) {
        return applyIntrinsicFont(fontName,fontStyle,fontSize,text);
      }
      ITrueTypeWriter trueTypeWriter=getTrueTypeFontWriter(fontPath);
      String displayName=fontName.replace(' ','_');
      trueTypeWriter.useDisplayName(displayName);
      trueTypeWriter.ensureGlyphsAvailable(text);
      setFont(displayName,fontSize);
      return toHexString(text);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
    return null;
  }
}

Fixed version (ground truth):
private String applyFont(String fontName,int fontStyle,float fontSize,String text){
  if (isIntrinsicFont(fontName)) {
    return applyIntrinsicFont(fontName,fontStyle,fontSize,text);
  }
 else {
    try {
      String fontPath=getFontPath(fontName);
      if (fontPath == null) {
        return applyIntrinsicFont(fontName,fontStyle,fontSize,text);
      }
      ITrueTypeWriter trueTypeWriter=getTrueTypeFontWriter(fontPath);
      String displayName=fontName.replace(' ','_');
      trueTypeWriter.useDisplayName(displayName);
      trueTypeWriter.ensureGlyphsAvailable(text);
      setFont(displayName,fontSize);
      return toHexString(text);
    }
 catch (    Exception e) {
      log.log(Level.WARNING,"String_Node_Str" + fontName);
    }
    return null;
  }
}
Program: 73129
Project: 73129
Buggy source:
private String getFontPath(String fontName){
  try {
    FontFactoryImp fontImpl=FontFactory.getFontImp();
    Properties trueTypeFonts=(Properties)getField(FontFactoryImp.class,"String_Node_Str",fontImpl);
    String fontPath=trueTypeFonts.getProperty(fontName.toLowerCase());
    return fontPath;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
private String getFontPath(String fontName){
  try {
    FontFactoryImp fontImpl=FontFactory.getFontImp();
    Properties trueTypeFonts=(Properties)getField(FontFactoryImp.class,"String_Node_Str",fontImpl);
    String fontPath=trueTypeFonts.getProperty(fontName.toLowerCase());
    return fontPath;
  }
 catch (  Exception e) {
    log.log(Level.WARNING,"String_Node_Str" + fontName);
  }
  return null;
}
Program: 73130
Project: 73130
Buggy source:
private int addTable(PrintStream out,int offset,String name,StringBuffer tableContent){
  int result=0;
  try {
    int[] tableLocation=getTableLocation(name);
    if (tableLocation != null) {
      byte[] tableMetadata=(byte[])metadataTables.get(name);
      Util.putInt32(tableMetadata,8,offset);
      result=offset + getEvenLength(tableLocation[1]);
      out.println(Util.toHexString(tableMetadata));
      byte[] data=readTable(name);
      tableContent.append("String_Node_Str" + toPSDataString(Util.toHexString(data)));
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return result;
}

Fixed version (ground truth):
private int addTable(PrintStream out,int offset,String name,StringBuffer tableContent){
  int result=0;
  try {
    int[] tableLocation=getTableLocation(name);
    if (tableLocation != null) {
      byte[] tableMetadata=(byte[])metadataTables.get(name);
      Util.putInt32(tableMetadata,8,offset);
      result=offset + getEvenLength(tableLocation[1]);
      out.println(Util.toHexString(tableMetadata));
      byte[] data=readTable(name);
      tableContent.append("String_Node_Str" + toPSDataString(Util.toHexString(data)));
    }
  }
 catch (  Exception e) {
    logger.log(Level.WARNING,"String_Node_Str" + name);
  }
  return result;
}
Program: 73131
Project: 73131
Buggy source:
private int addBigTable(PrintStream out,int offset,String name,StringBuffer tableContent){
  int result=0;
  try {
    int[] tableLocation=getTableLocation(name);
    if (tableLocation != null) {
      byte[] tableMetadata=(byte[])metadataTables.get(name);
      if ("String_Node_Str".equals(name) || "String_Node_Str".equals(name)) {
        tableMetadata[3]='x';
        Util.putInt32(tableMetadata,8,0);
        Util.putInt32(tableMetadata,12,0);
        result=offset;
        out.println(Util.toHexString(tableMetadata));
      }
 else {
        Util.putInt32(tableMetadata,8,offset);
        out.println(Util.toHexString(tableMetadata));
        result=offset + getEvenLength(tableLocation[1]);
        List datas=readBigTable(name);
        for (int i=0; i < datas.size(); i++) {
          tableContent.append("String_Node_Str" + toPSDataString(Util.toHexString((byte[])datas.get(i))));
        }
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return result;
}

Fixed version (ground truth):
private int addBigTable(PrintStream out,int offset,String name,StringBuffer tableContent){
  int result=0;
  try {
    int[] tableLocation=getTableLocation(name);
    if (tableLocation != null) {
      byte[] tableMetadata=(byte[])metadataTables.get(name);
      if ("String_Node_Str".equals(name) || "String_Node_Str".equals(name)) {
        tableMetadata[3]='x';
        Util.putInt32(tableMetadata,8,0);
        Util.putInt32(tableMetadata,12,0);
        result=offset;
        out.println(Util.toHexString(tableMetadata));
      }
 else {
        Util.putInt32(tableMetadata,8,offset);
        out.println(Util.toHexString(tableMetadata));
        result=offset + getEvenLength(tableLocation[1]);
        List datas=readBigTable(name);
        for (int i=0; i < datas.size(); i++) {
          tableContent.append("String_Node_Str" + toPSDataString(Util.toHexString((byte[])datas.get(i))));
        }
      }
    }
  }
 catch (  Exception e) {
    logger.log(Level.WARNING,"String_Node_Str" + name);
  }
  return result;
}
Program: 73132
Project: 73132
Buggy source:
public static void load(String file,OutputStream out){
  InputStream input=null;
  try {
    input=FileUtil.class.getClassLoader().getResourceAsStream(file);
    byte[] buffer=new byte[1024];
    int length=-1;
    do {
      length=input.read(buffer);
      if (length < 0) {
        break;
      }
      out.write(buffer,0,length);
    }
 while (true);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
 finally {
    if (input != null) {
      try {
        input.close();
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
      input=null;
    }
  }
}

Fixed version (ground truth):
public static void load(String file,OutputStream out){
  InputStream input=null;
  try {
    input=FileUtil.class.getClassLoader().getResourceAsStream(file);
    byte[] buffer=new byte[1024];
    int length=-1;
    do {
      length=input.read(buffer);
      if (length < 0) {
        break;
      }
      out.write(buffer,0,length);
    }
 while (true);
  }
 catch (  IOException e) {
    log.log(Level.WARNING,"String_Node_Str" + file);
  }
 finally {
    if (input != null) {
      try {
        input.close();
      }
 catch (      IOException e) {
        log.log(Level.WARNING,"String_Node_Str" + file);
      }
      input=null;
    }
  }
}
Program: 73133
Project: 73133
Buggy source:
protected Object clone(){
  Object o=null;
  try {
    o=super.clone();
  }
 catch (  final CloneNotSupportedException e) {
    e.printStackTrace();
  }
  return o;
}

Fixed version (ground truth):
protected Object clone(){
  Object o=null;
  try {
    o=super.clone();
  }
 catch (  final CloneNotSupportedException e) {
    log.log(Level.WARNING,"String_Node_Str");
  }
  return o;
}
Program: 73134
Project: 73134
Buggy source:
public static int convertToPt(String size){
  try {
    int s=Integer.valueOf(size.substring(0,size.length() - 2)).intValue();
    if (size.endsWith("String_Node_Str")) {
      return s * 72;
    }
 else     if (size.endsWith("String_Node_Str")) {
      return (int)(s / 2.54 * 72);
    }
 else     if (size.endsWith("String_Node_Str")) {
      return (int)(s * 10 / 2.54 * 72);
    }
 else     if (size.endsWith("String_Node_Str")) {
      return s;
    }
 else {
      return s;
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    return 0;
  }
}

Fixed version (ground truth):
public static int convertToPt(String size){
  try {
    int s=Integer.valueOf(size.substring(0,size.length() - 2)).intValue();
    if (size.endsWith("String_Node_Str")) {
      return s * 72;
    }
 else     if (size.endsWith("String_Node_Str")) {
      return (int)(s / 2.54 * 72);
    }
 else     if (size.endsWith("String_Node_Str")) {
      return (int)(s * 10 / 2.54 * 72);
    }
 else     if (size.endsWith("String_Node_Str")) {
      return s;
    }
 else {
      return s;
    }
  }
 catch (  Exception e) {
    log.log(Level.WARNING,"String_Node_Str" + size);
    return 0;
  }
}
Program: 73135
Project: 73135
Buggy source:
private void close(IResultIterator resultIterator){
  try {
    resultIterator.close();
  }
 catch (  BirtException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void close(IResultIterator resultIterator){
  try {
    resultIterator.close();
  }
 catch (  BirtException e) {
    log.log(Level.WARNING,"String_Node_Str");
  }
}
Program: 73136
Project: 73136
Buggy source:
/** 
 * set input parameter bindings
 */
private void setInputParameterBinding() throws DataException {
  Iterator inputParamValueslist=getInputParamValues().iterator();
  while (inputParamValueslist.hasNext()) {
    ParameterBinding paramBind=(ParameterBinding)inputParamValueslist.next();
    if (supportNamedParameter(paramBind.getName()))     odaStatement.setParameterValue(paramBind.getName(),paramBind.getValue());
 else     odaStatement.setParameterValue(paramBind.getPosition(),paramBind.getValue());
  }
}

Fixed version (ground truth):
/** 
 * set input parameter bindings
 */
private void setInputParameterBinding() throws DataException {
}
Program: 73137
Project: 73137
Buggy source:
/** 
 * Adds input and output parameter hints to odaStatement
 */
private void addParameterDefns() throws DataException {
  if (this.parameterHints == null)   return;
  Iterator it=this.parameterHints.iterator();
  while (it.hasNext()) {
    ParameterHint parameterHint=(ParameterHint)it.next();
    odaStatement.addParameterHint(parameterHint);
    if (parameterHint.isInputMode()) {
      Class paramHintDataType=parameterHint.getDataType();
      if (paramHintDataType == Date.class)       paramHintDataType=parameterHint.getEffectiveDataType(dataSource.getDriverName(),queryType);
      Object inputValue=parameterHint.getDefaultInputValue();
      if (paramHintDataType != IBlob.class && paramHintDataType != IClob.class)       inputValue=convertToValue(parameterHint.getDefaultInputValue(),paramHintDataType);
      if (supportNamedParameter(parameterHint.getName()))       this.setInputParamValue(parameterHint.getName(),inputValue);
 else       this.setInputParamValue(parameterHint.getPosition(),inputValue);
    }
  }
  this.setInputParameterBinding();
}

Fixed version (ground truth):
/** 
 * Adds input and output parameter hints to odaStatement
 */
private void addParameterDefns() throws DataException {
}
Program: 73138
Project: 73138
Buggy source:
private boolean supportsNamedParameter() throws DataException {
  String methodName="String_Node_Str";
  sm_logger.entering(sm_className,methodName);
  if (m_supportsNamedParameters != UNKNOWN) {
    boolean ret=(m_supportsNamedParameters == TRUE);
    if (sm_logger.isLoggingEnterExitLevel())     sm_logger.exiting(sm_className,methodName,Boolean.valueOf(ret));
    return ret;
  }
  boolean b=m_connection.getMetaData(m_dataSetType).supportsNamedParameters();
  m_supportsNamedParameters=b ? TRUE : FALSE;
  if (sm_logger.isLoggingEnterExitLevel())   sm_logger.exiting(sm_className,methodName,Boolean.valueOf(b));
  return b;
}

Fixed version (ground truth):
public boolean supportsNamedParameter() throws DataException {
  String methodName="String_Node_Str";
  sm_logger.entering(sm_className,methodName);
  if (m_supportsNamedParameters != UNKNOWN) {
    boolean ret=(m_supportsNamedParameters == TRUE);
    if (sm_logger.isLoggingEnterExitLevel())     sm_logger.exiting(sm_className,methodName,Boolean.valueOf(ret));
    return ret;
  }
  boolean b=m_connection.getMetaData(m_dataSetType).supportsNamedParameters();
  m_supportsNamedParameters=b ? TRUE : FALSE;
  if (sm_logger.isLoggingEnterExitLevel())   sm_logger.exiting(sm_className,methodName,Boolean.valueOf(b));
  return b;
}
Program: 73140
Project: 73140
Buggy source:
/** 
 * Collect and empty any objects that are used in multiple tests.  Currently Empty.
 */
protected void tearDown() throws Exception {
}

Fixed version (ground truth):
/** 
 * Collect and empty any objects that are used in multiple tests. Currently Empty.
 */
protected void tearDown() throws Exception {
}
Program: 73141
Project: 73141
Buggy source:
private int getErrorLIine(boolean checkReport){
  errorDetail=null;
  IEditorInput input=getEditorInput();
  if (!(input instanceof IPathEditorInput)) {
    return 0;
  }
  IPath path=((IPathEditorInput)input).getPath();
  try {
    if (path.toOSString().endsWith(IReportEditorContants.LIBRARY_FILE_EXTENTION)) {
      LibraryHandle library=null;
      try {
        library=SessionHandleAdapter.getInstance().getSessionHandle().openLibrary(path.toOSString());
        if (checkReport) {
          return getErrorLineFromModuleHandle(library);
        }
      }
 catch (      DesignFileException e) {
        return getExpetionErrorLine(e);
      }
 finally {
        if (library != null) {
          library.close();
        }
      }
    }
 else {
      ReportDesignHandle report=null;
      try {
        report=SessionHandleAdapter.getInstance().getSessionHandle().openDesign(path.toOSString(),new FileInputStream(path.toFile()));
        if (checkReport) {
          return getErrorLineFromModuleHandle(report);
        }
      }
 catch (      DesignFileException e) {
        return getExpetionErrorLine(e);
      }
 finally {
        if (report != null) {
          report.close();
        }
      }
    }
  }
 catch (  FileNotFoundException e) {
    return 0;
  }
  return -1;
}

Fixed version (ground truth):
private int getErrorLIine(boolean checkReport){
  errorDetail=null;
  IEditorInput input=getEditorInput();
  try {
    IPath path=getProvider().getInputPath(input);
    if (path.toOSString().endsWith(IReportEditorContants.LIBRARY_FILE_EXTENTION)) {
      LibraryHandle library=null;
      try {
        library=SessionHandleAdapter.getInstance().getSessionHandle().openLibrary(path.toOSString());
        if (checkReport) {
          return getErrorLineFromModuleHandle(library);
        }
      }
 catch (      DesignFileException e) {
        return getExpetionErrorLine(e);
      }
 finally {
        if (library != null) {
          library.close();
        }
      }
    }
 else {
      ReportDesignHandle report=null;
      try {
        report=SessionHandleAdapter.getInstance().getSessionHandle().openDesign(path.toOSString(),new FileInputStream(path.toFile()));
        if (checkReport) {
          return getErrorLineFromModuleHandle(report);
        }
      }
 catch (      DesignFileException e) {
        return getExpetionErrorLine(e);
      }
 finally {
        if (report != null) {
          report.close();
        }
      }
    }
  }
 catch (  FileNotFoundException e) {
    return 0;
  }
  return -1;
}