nus-yam/ex-repair huggingface dataset:
Program: 125366
Project: 125366
Buggy source:
/** 
 * Get Object by special column index
 * @param set
 * @param columnIndex
 * @return
 * @throws SQLException
 * @throws IOException
 */
public static Object getBigObject(ResultSet set,int columnIndex) throws SQLException {
  Object object=null;
  try {
    object=set.getObject(columnIndex);
    if (object != null && object instanceof Clob) {
      Reader is=((Clob)object).getCharacterStream();
      BufferedReader br=new BufferedReader(is);
      String str=br.readLine();
      StringBuffer sb=new StringBuffer();
      while (str != null) {
        sb.append(str);
        str=br.readLine();
      }
      return sb.toString();
    }
  }
 catch (  SQLException e) {
    if (NULLDATE.equals(set.getString(columnIndex))) {
      object=null;
    }
 else {
      throw e;
    }
  }
catch (  IOException e) {
    object=null;
  }
  return object;
}

Fixed version (ground truth):
/** 
 * Get Object by special column index
 * @param set
 * @param columnIndex
 * @return
 * @throws SQLException
 * @throws IOException
 */
public static Object getBigObject(ResultSet set,String columnName) throws SQLException {
  Object object=null;
  try {
    object=set.getObject(columnName);
    if (object != null && object instanceof Clob) {
      Reader is=((Clob)object).getCharacterStream();
      BufferedReader br=new BufferedReader(is);
      String str=br.readLine();
      StringBuffer sb=new StringBuffer();
      while (str != null) {
        sb.append(str);
        str=br.readLine();
      }
      return sb.toString();
    }
  }
 catch (  SQLException e) {
    if (NULLDATE.equals(set.getString(columnName))) {
      object=null;
    }
 else {
      throw e;
    }
  }
catch (  IOException e) {
    object=null;
  }
  return object;
}
Program: 125369
Project: 125369
Buggy source:
@SuppressWarnings("String_Node_Str") public Object getValue(Object bean,String idColumn){
  TableViewerCreatorColumn column=tableViewerCreator.getColumn(idColumn);
  ModifiedObjectInfo modifiedObjectInfo=this.tableViewerCreator.getModifiedObjectInfo();
  modifiedObjectInfo.setCurrentModifiedBean(bean);
  modifiedObjectInfo.setCurrentModifiedColumn(column);
  modifiedObjectInfo.setCurrentModifiedIndex(this.tableViewerCreator.getInputList().indexOf(bean));
  Object returnValue=null;
  if (column.getColumnCellModifier() != null) {
    returnValue=column.getColumnCellModifier().getValue(bean);
  }
  if (returnValue == null) {
    Object value=AccessorUtils.get(bean,column);
    if (column.getCellEditorValueAdapter() != null) {
      returnValue=column.getCellEditorValueAdapter().getCellEditorTypedValue(column.getCellEditor(),value);
    }
 else {
      returnValue=value;
    }
    if (returnValue == null && column.getDefaultInternalValue() != null) {
      returnValue=column.getDefaultInternalValue();
    }
    modifiedObjectInfo.setOriginalPropertyBeanValue(returnValue);
    modifiedObjectInfo.setPreviousPropertyBeanValue(returnValue);
  }
  return returnValue;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public Object getValue(Object bean,String idColumn){
  TableViewerCreatorColumnNotModifiable column=tableViewerCreator.getColumn(idColumn);
  ModifiedObjectInfo modifiedObjectInfo=this.tableViewerCreator.getModifiedObjectInfo();
  modifiedObjectInfo.setCurrentModifiedBean(bean);
  modifiedObjectInfo.setCurrentModifiedColumn(column);
  modifiedObjectInfo.setCurrentModifiedIndex(this.tableViewerCreator.getInputList().indexOf(bean));
  Object returnValue=null;
  if (column.getColumnCellModifier() != null) {
    returnValue=column.getColumnCellModifier().getValue(bean);
  }
  if (returnValue == null) {
    Object value=AccessorUtils.get(bean,column);
    if (column.getCellEditorValueAdapter() != null) {
      returnValue=column.getCellEditorValueAdapter().getCellEditorTypedValue(column.getCellEditor(),value);
    }
 else {
      returnValue=value;
    }
    if (returnValue == null && column.getDefaultInternalValue() != null) {
      returnValue=column.getDefaultInternalValue();
    }
    modifiedObjectInfo.setOriginalPropertyBeanValue(returnValue);
    modifiedObjectInfo.setPreviousPropertyBeanValue(returnValue);
  }
  return returnValue;
}
Program: 125371
Project: 125371
Buggy source:
/** 
 * DOC amaumont Comment method "fireCellEditorApplied".
 * @param tableItem
 * @param bean
 * @param idColumn
 * @param cellEditorAppliedValue
 * @param newValue
 */
private void fireCellEditorApplied(TableItem tableItem,Object bean,TableViewerCreatorColumn column,Object cellEditorAppliedValue,Object previousValue,Object newValue){
  TableCellValueModifiedEvent event=new TableCellValueModifiedEvent(tableItem,bean,column,cellEditorAppliedValue,newValue);
  final Object[] listenerArray=cellEditorAppliedListeners.getListeners();
  for (  Object element : listenerArray) {
    ((ITableCellValueModifiedListener)element).cellValueModified(event);
  }
  if (column.getCellEditorAppliedListener() != null) {
    column.getCellEditorAppliedListener().cellValueModified(event);
  }
}

Fixed version (ground truth):
/** 
 * DOC amaumont Comment method "fireCellEditorApplied".
 * @param tableItem
 * @param bean
 * @param idColumn
 * @param cellEditorAppliedValue
 * @param newValue
 */
private void fireCellEditorApplied(TableItem tableItem,Object bean,TableViewerCreatorColumnNotModifiable column,Object cellEditorAppliedValue,Object previousValue,Object newValue){
  TableCellValueModifiedEvent event=new TableCellValueModifiedEvent(tableItem,bean,column,cellEditorAppliedValue,newValue);
  final Object[] listenerArray=cellEditorAppliedListeners.getListeners();
  for (  Object element : listenerArray) {
    ((ITableCellValueModifiedListener)element).cellValueModified(event);
  }
  if (column.getCellEditorAppliedListener() != null) {
    column.getCellEditorAppliedListener().cellValueModified(event);
  }
}
Program: 125372
Project: 125372
Buggy source:
public boolean canModify(Object bean,String idColumn){
  TableViewerCreatorColumn column=tableViewerCreator.getColumn(idColumn);
  if (column.getColumnCellModifier() != null) {
    return column.getColumnCellModifier().canModify(bean);
  }
  return tableViewerCreator.getColumn(idColumn).isModifiable();
}

Fixed version (ground truth):
public boolean canModify(Object bean,String idColumn){
  TableViewerCreatorColumn column=tableViewerCreator.getModifiableColumn(idColumn);
  if (column != null && column.getColumnCellModifier() != null) {
    return column.getColumnCellModifier().canModify(bean);
  }
  return tableViewerCreator.getColumn(idColumn).isModifiable();
}
Program: 125373
Project: 125373
Buggy source:
public Item getParentJobItem(Item item) throws PersistenceException ;

Fixed version (ground truth):
Item getParentJobItem(Item item) throws PersistenceException ;
Program: 125376
Project: 125376
Buggy source:
@Override public void afterLogon(){
}

Fixed version (ground truth):
@Override public void afterLogon(IProgressMonitor monitor){
  if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
    IRunProcessService runProcessService=(IRunProcessService)GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
    try {
      runProcessService.getTalendProcessJavaProject().cleanMavenFiles(monitor);
      TimeMeasure.step("String_Node_Str","String_Node_Str");
    }
 catch (    Exception e) {
      ExceptionHandler.process(e);
    }
  }
}
Program: 125377
Project: 125377
Buggy source:
public void afterLogon();

Fixed version (ground truth):
public void afterLogon(IProgressMonitor monitor);
Program: 125380
Project: 125380
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  ATreeNode other=(ATreeNode)obj;
  if (this.dataType == null) {
    if (other.dataType != null) {
      return false;
    }
  }
 else   if (!this.dataType.equals(other.dataType)) {
    return false;
  }
  if (this.originalDataType == null) {
    if (other.originalDataType != null) {
      return false;
    }
  }
 else   if (!this.originalDataType.equals(other.originalDataType)) {
    return false;
  }
  if (this.type != other.type) {
    return false;
  }
  if (this.value == null) {
    if (other.value != null) {
      return false;
    }
  }
 else   if (!this.value.equals(other.value)) {
    return false;
  }
  if (this.parent == null) {
    if (other.parent != null) {
      return false;
    }
  }
 else   if (!this.parent.equals(other.parent)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean equals(Object obj,int depth){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  ATreeNode other=(ATreeNode)obj;
  if (this.dataType == null) {
    if (other.dataType != null) {
      return false;
    }
  }
 else   if (!this.dataType.equals(other.dataType)) {
    return false;
  }
  if (this.originalDataType == null) {
    if (other.originalDataType != null) {
      return false;
    }
  }
 else   if (!this.originalDataType.equals(other.originalDataType)) {
    return false;
  }
  if (this.type != other.type) {
    return false;
  }
  if (this.value == null) {
    if (other.value != null) {
      return false;
    }
  }
 else   if (!this.value.equals(other.value)) {
    return false;
  }
  if (this.parent == null) {
    if (other.parent != null) {
      return false;
    }
  }
 else {
    if (depth > 50) {
      return true;
    }
    if (!this.parent.equals(other.parent,depth + 1)) {
      return false;
    }
  }
  return true;
}
Program: 125381
Project: 125381
Buggy source:
public static void copyFolder(File source,File target,boolean emptyTargetBeforeCopy,final FileFilter sourceFolderFilter,final FileFilter sourceFileFilter,boolean copyFolder) throws IOException {
  if (!target.exists()) {
    target.mkdirs();
  }
  if (emptyTargetBeforeCopy) {
    emptyFolder(target);
  }
  FileFilter folderFilter=new FileFilter(){
    @Override public boolean accept(    File pathname){
      return pathname.isDirectory() && (sourceFolderFilter == null || sourceFolderFilter.accept(pathname));
    }
  }
;
  FileFilter fileFilter=new FileFilter(){
    @Override public boolean accept(    File pathname){
      return !pathname.isDirectory() && (sourceFileFilter == null || sourceFileFilter.accept(pathname));
    }
  }
;
  for (  File current : source.listFiles(folderFilter)) {
    if (copyFolder) {
      File newFolder=new File(target,current.getName());
      newFolder.mkdir();
      copyFolder(current,newFolder,emptyTargetBeforeCopy,sourceFolderFilter,sourceFileFilter,copyFolder);
    }
 else {
      copyFolder(current,target,emptyTargetBeforeCopy,sourceFolderFilter,sourceFileFilter,copyFolder);
    }
  }
  for (  File current : source.listFiles(fileFilter)) {
    File out=new File(target,current.getName());
    copyFile(current,out);
  }
}

Fixed version (ground truth):
public static void copyFolder(File source,File target,boolean emptyTargetBeforeCopy,final FileFilter sourceFolderFilter,final FileFilter sourceFileFilter,boolean copyFolder) throws IOException {
  if (!target.exists()) {
    target.mkdirs();
  }
  if (emptyTargetBeforeCopy) {
    emptyFolder(target);
  }
  FileFilter folderFilter=new FileFilter(){
    @Override public boolean accept(    File pathname){
      return pathname.isDirectory() && (sourceFolderFilter == null || sourceFolderFilter.accept(pathname));
    }
  }
;
  FileFilter fileFilter=new FileFilter(){
    @Override public boolean accept(    File pathname){
      return !pathname.isDirectory() && (sourceFileFilter == null || sourceFileFilter.accept(pathname));
    }
  }
;
  File[] folders=source.listFiles(folderFilter);
  if (folders != null) {
    for (    File current : folders) {
      if (copyFolder) {
        File newFolder=new File(target,current.getName());
        newFolder.mkdir();
        copyFolder(current,newFolder,emptyTargetBeforeCopy,sourceFolderFilter,sourceFileFilter,copyFolder);
      }
 else {
        copyFolder(current,target,emptyTargetBeforeCopy,sourceFolderFilter,sourceFileFilter,copyFolder);
      }
    }
  }
  File[] files=source.listFiles(fileFilter);
  if (files != null) {
    for (    File current : files) {
      File out=new File(target,current.getName());
      copyFile(current,out);
    }
  }
}
Program: 125382
Project: 125382
Buggy source:
@Override public boolean isNameAvailable(Project project,Item item,String name,List<IRepositoryViewObject>... givenList) throws PersistenceException {
  if (name == null) {
    name=item.getProperty().getLabel();
  }
  if (item instanceof FolderItem) {
    FolderHelper folderHelper=getFolderHelper(project.getEmfProject());
    return !folderHelper.pathExists((FolderItem)item,name);
  }
  ERepositoryObjectType type=ERepositoryObjectType.getItemType(item);
  if (type == ERepositoryObjectType.METADATA_CON_TABLE) {
    return false;
  }
  boolean isAllowMultipleName=(type == ERepositoryObjectType.SQLPATTERNS || type == ERepositoryObjectType.METADATA_FILE_XML);
  String path="String_Node_Str";
  if (item.getState() != null) {
    path=item.getState().getPath();
  }
  List<IRepositoryViewObject> list;
  if (givenList.length == 0) {
    list=getAll(project,type,true,false);
  }
 else {
    list=givenList[0];
  }
  for (  IRepositoryViewObject current : list) {
    if (name.equalsIgnoreCase(current.getProperty().getLabel()) && item.getProperty().getId() != current.getProperty().getId()) {
      if (!isAllowMultipleName || current.getProperty().getItem().getState().getPath().equals(path)) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean isNameAvailable(Project project,Item item,String name,List<IRepositoryViewObject>... givenList) throws PersistenceException {
  if (name == null) {
    name=item.getProperty().getLabel();
  }
  if (item instanceof FolderItem) {
    FolderHelper folderHelper=getFolderHelper(project.getEmfProject());
    return !folderHelper.pathExists((FolderItem)item,name);
  }
  ERepositoryObjectType type=ERepositoryObjectType.getItemType(item);
  if (type == ERepositoryObjectType.METADATA_CON_TABLE) {
    return false;
  }
  boolean isAllowMultipleName=(type == ERepositoryObjectType.SQLPATTERNS || type == ERepositoryObjectType.METADATA_FILE_XML);
  String path="String_Node_Str";
  if (item.getState() != null) {
    path=item.getState().getPath();
  }
  List<IRepositoryViewObject> list;
  if (givenList.length == 0) {
    list=getAll(project,type,true,false);
  }
 else {
    list=givenList[0];
  }
  for (  IRepositoryViewObject current : list) {
    if ((name.equalsIgnoreCase(current.getProperty().getLabel()) || name.equalsIgnoreCase(current.getProperty().getDisplayName())) && item.getProperty().getId() != current.getProperty().getId()) {
      if (!isAllowMultipleName || current.getProperty().getItem().getState().getPath().equals(path)) {
        return false;
      }
    }
  }
  return true;
}
Program: 125383
Project: 125383
Buggy source:
protected void evaluateName(String name){
  if (name == null || name.length() == 0) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (name.startsWith("String_Node_Str") || !Pattern.matches(RepositoryConstants.getPattern(getRepositoryObjectType()),name) || name.trim().contains("String_Node_Str")) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (isKeywords(name) || "String_Node_Str".equalsIgnoreCase(name)) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (name.equalsIgnoreCase(ProjectManager.getInstance().getCurrentProject().getLabel())) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (nameModifiedByUser) {
    if (retrieveNameFinished) {
      if (!isValid(name)) {
        nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
      }
 else {
        nameStatus=createOkStatus();
      }
    }
 else {
      nameStatus=createStatus(IStatus.ERROR,"String_Node_Str");
    }
  }
 else {
    nameStatus=createOkStatus();
  }
  if (getProperty() != null && nameStatus.getSeverity() == IStatus.OK) {
    getProperty().setLabel(getPropertyLabel(StringUtils.trimToNull(name)));
    getProperty().setDisplayName(StringUtils.trimToNull(name));
    getProperty().setModificationDate(new Date());
  }
  updatePageStatus();
}

Fixed version (ground truth):
protected void evaluateName(String name){
  if (name == null || name.length() == 0 || StringUtils.trimToNull(name) == null) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (name.startsWith("String_Node_Str") || name.startsWith("String_Node_Str") || !Pattern.matches(RepositoryConstants.getPattern(getRepositoryObjectType()),name)|| name.trim().contains("String_Node_Str")|| name.trim().contains("String_Node_Str")) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (isKeywords(name) || "String_Node_Str".equalsIgnoreCase(name)) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (name.equalsIgnoreCase(ProjectManager.getInstance().getCurrentProject().getLabel())) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (nameModifiedByUser) {
    if (retrieveNameFinished) {
      if (!isValid(name)) {
        nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
      }
 else {
        nameStatus=createOkStatus();
      }
    }
 else {
      nameStatus=createStatus(IStatus.ERROR,"String_Node_Str");
    }
  }
 else {
    nameStatus=createOkStatus();
  }
  if (getProperty() != null && nameStatus.getSeverity() == IStatus.OK) {
    getProperty().setLabel(getPropertyLabel(StringUtils.trimToNull(name)));
    getProperty().setDisplayName(StringUtils.trimToNull(name));
    getProperty().setModificationDate(new Date());
  }
  updatePageStatus();
}
Program: 125386
Project: 125386
Buggy source:
/** 
 * DOC YeXiaowei Comment method "hidePassword".
 * @param password
 * @return
 */
public static String hidePassword(final String password){
  if (password == null) {
    return PASS_COVER + PASS_COVER;
  }
  if (ContextParameterUtils.containContextVariables(password)) {
    return password;
  }
  int length=password.length() + 2;
  StringBuilder builder=new StringBuilder();
  for (int i=0; i < length; i++) {
    builder.append(PASS_COVER);
  }
  return builder.toString();
}

Fixed version (ground truth):
/** 
 * DOC YeXiaowei Comment method "hidePassword".
 * @param password
 * @return
 */
public static String hidePassword(final String password){
  if (password == null) {
    return PASS_COVER + PASS_COVER;
  }
  if (ContextParameterUtils.containContextVariables(password)) {
    return password;
  }
  if (!TalendQuoteUtils.isCommonString(password)) {
    return password;
  }
  int length=password.length() + 2;
  StringBuilder builder=new StringBuilder();
  for (int i=0; i < length; i++) {
    builder.append(PASS_COVER);
  }
  return builder.toString();
}
Program: 125387
Project: 125387
Buggy source:
public void checkInit(Boolean lastVersion,Boolean readonly,boolean load) throws PersistenceException {
  if (loadedProcess instanceof ILastVersionChecker) {
    ((ILastVersionChecker)loadedProcess).setLastVersion(lastVersion);
  }
  if (load) {
    loadProcess();
  }
 else {
    saveProcessBefore();
    saveProcess(null,null,true);
  }
  if (readonly == null) {
    checkReadOnly();
  }
 else {
    setReadOnly(readonly);
  }
}

Fixed version (ground truth):
public void checkInit(Boolean lastVersion,Boolean readonly,boolean load) throws PersistenceException {
  if (loadedProcess instanceof ILastVersionChecker) {
    ((ILastVersionChecker)loadedProcess).setLastVersion(lastVersion);
  }
  if (load) {
    loadProcess();
  }
 else {
    saveProcessBefore();
    saveProcess(null,null,true);
  }
  if (readonly == null) {
    readonly=checkReadOnly();
    setReadOnly(readonly);
  }
 else {
    setReadOnly(readonly);
  }
}
Program: 125388
Project: 125388
Buggy source:
public void setLazyLoad(boolean lazyLoad){
  this.lazyLoad=lazyLoad;
}

Fixed version (ground truth):
public void setLazyLoad(boolean lazyLoad){
  if (!Boolean.getBoolean("String_Node_Str")) {
    this.lazyLoad=lazyLoad;
  }
}
Program: 125390
Project: 125390
Buggy source:
/** 
 * This method is used to generate query for a DQ rule + component params.
 * @param dbType (value = SupportDBUrlType.dbkey)
 * @param catalog
 * @param schema
 * @param table
 * @param metadataTable
 * @param ruleParam
 * @param isInvalidRowsComponent
 * @param whereClause
 */
public String getQueryByRule(IElementParameter ruleParam,IElementParameter dbType,IElementParameter catalog,IElementParameter schema,IElementParameter table,IMetadataTable metadataTable,boolean isInvalidRowsComponent,IElementParameter whereClause);

Fixed version (ground truth):
/** 
 * This method is used to generate query for a DQ rule + component params.
 * @param dbType (value = SupportDBUrlType.dbkey)
 * @param dbName
 * @param schema
 * @param table
 * @param metadataTable
 * @param ruleParam
 * @param isInvalidRowsComponent
 * @param whereClause
 * @Deprecated please use{@link ITDQRuleService#getQueryByRule(IElementParameter,IElementParameter,String,String,String,IMetadataTable,boolean,String)}instead of it else maybe exist a context issue
 */
@Deprecated public String getQueryByRule(IElementParameter ruleParam,IElementParameter dbType,IElementParameter dbName,IElementParameter schema,IElementParameter table,IMetadataTable metadataTable,boolean isInvalidRowsComponent,IElementParameter whereClause);
Program: 125393
Project: 125393
Buggy source:
public void deleteObjectPhysical(Project project,IRepositoryViewObject objToDelete,String version,boolean fromEmptyRecycleBin) throws PersistenceException ;

Fixed version (ground truth):
public void deleteObjectPhysical(Project project,IRepositoryViewObject objToDelete,String version,boolean fromEmptyRecycleBin,boolean isDeleteOnRemote) throws PersistenceException ;
Program: 125394
Project: 125394
Buggy source:
@Override public void forceDeleteObjectPhysical(IRepositoryViewObject objToDelete,String version) throws PersistenceException {
  this.repositoryFactoryFromProvider.deleteObjectPhysical(projectManager.getCurrentProject(),objToDelete,version);
  String str[]=new String[]{objToDelete.toString(),getRepositoryContext().getUser().toString()};
  log.info(Messages.getString("String_Node_Str",str));
}

Fixed version (ground truth):
@Override public void forceDeleteObjectPhysical(IRepositoryViewObject objToDelete,String version,boolean isDeleteOnRemote) throws PersistenceException {
  this.repositoryFactoryFromProvider.deleteObjectPhysical(projectManager.getCurrentProject(),objToDelete,version,isDeleteOnRemote);
  String str[]=new String[]{objToDelete.toString(),getRepositoryContext().getUser().toString()};
  log.info(Messages.getString("String_Node_Str",str));
}
Program: 125395
Project: 125395
Buggy source:
public void forceDeleteObjectPhysical(IRepositoryViewObject objToDelete,String version) throws PersistenceException ;

Fixed version (ground truth):
public void forceDeleteObjectPhysical(IRepositoryViewObject objToDelete,String version,boolean isDeleteOnRemote) throws PersistenceException ;
Program: 125397
Project: 125397
Buggy source:
@Override public void run() throws PersistenceException {
  for (  IRepositoryViewObject currentVersion : allVersionToDelete) {
    repFactory.forceDeleteObjectPhysical(lastVersionBackup,currentVersion.getVersion());
  }
}

Fixed version (ground truth):
@Override public void run() throws PersistenceException {
  for (  IRepositoryViewObject currentVersion : allVersionToDelete) {
    repFactory.forceDeleteObjectPhysical(lastVersionBackup,currentVersion.getVersion(),isDeleteOnRemote);
  }
}
Program: 125398
Project: 125398
Buggy source:
/** 
 * Used only for emf related files since this one will update the resourceset.
 * @param resource
 * @throws PersistenceException
 */
protected void deleteResource(Resource resource) throws PersistenceException {
  xmiResourceManager.deleteResource(resource);
}

Fixed version (ground truth):
/** 
 * Used only for emf related files since this one will update the resourceset.
 * @param resource
 * @throws PersistenceException
 */
protected void deleteResource(Resource resource,boolean isDeleteOnRemote) throws PersistenceException {
  xmiResourceManager.deleteResource(resource);
}
Program: 125403
Project: 125403
Buggy source:
/** 
 * Test method for  {@link org.talend.repository.localprovider.model.LocalRepositoryFactory#moveObject(org.talend.core.model.general.Project)}.
 * @throws CoreException
 * @throws PersistenceException
 * @throws LoginException
 */
@Test public void testMoveObject() throws PersistenceException, CoreException, LoginException {
  repositoryFactory.logOnProject(sampleProject);
  ProcessItem processItem=createTempProcessItem(repositoryFactory,"String_Node_Str");
  String processId=processItem.getProperty().getId();
  List<IRepositoryViewObject> objects=repositoryFactory.getAllVersion(sampleProject,processId,true);
  final Folder createFolder=repositoryFactory.createFolder(sampleProject,ERepositoryObjectType.PROCESS,new Path("String_Node_Str"),"String_Node_Str");
  assertNotNull(createFolder);
  IPath ip=new Path(createFolder.getLabel());
  assertNotNull(objects.get(0));
  repositoryFactory.moveObject(objects.get(0),ip);
  IProject project=ResourceUtils.getProject(sampleProject);
  checkMoveObjectFileExists(project,ERepositoryObjectType.PROCESS,createFolder.getLabel(),processItem.getProperty().getLabel(),processItem.getProperty().getVersion());
  Property property=repositoryFactory.getUptodateProperty(sampleProject,processItem.getProperty());
  repositoryFactory.deleteObjectPhysical(sampleProject,new RepositoryObject(property));
}

Fixed version (ground truth):
/** 
 * Test method for  {@link org.talend.repository.localprovider.model.LocalRepositoryFactory#moveObject(org.talend.core.model.general.Project)}.
 * @throws CoreException
 * @throws PersistenceException
 * @throws LoginException
 */
@Test public void testMoveObject() throws PersistenceException, CoreException, LoginException {
  repositoryFactory.logOnProject(sampleProject);
  ProcessItem processItem=createTempProcessItem(repositoryFactory,"String_Node_Str");
  String processId=processItem.getProperty().getId();
  List<IRepositoryViewObject> objects=repositoryFactory.getAllVersion(sampleProject,processId,true);
  final Folder createFolder=repositoryFactory.createFolder(sampleProject,ERepositoryObjectType.PROCESS,new Path("String_Node_Str"),"String_Node_Str");
  assertNotNull(createFolder);
  IPath ip=new Path(createFolder.getLabel());
  assertNotNull(objects.get(0));
  repositoryFactory.moveObject(objects.get(0),ip);
  IProject project=ResourceUtils.getProject(sampleProject);
  checkMoveObjectFileExists(project,ERepositoryObjectType.PROCESS,createFolder.getLabel(),processItem.getProperty().getLabel(),processItem.getProperty().getVersion());
  Property property=repositoryFactory.getUptodateProperty(sampleProject,processItem.getProperty());
  repositoryFactory.deleteObjectPhysical(sampleProject,new RepositoryObject(property),false);
}
Program: 125411
Project: 125411
Buggy source:
/** 
 * Test method for  {@link org.talend.repository.localprovider.model.LocalRepositoryFactory#getAll(org.talend.core.model.general.Project,org.talend.core.model.repository.ERepositoryObjectType,boolean,boolean)}.
 * @throws CoreException
 * @throws PersistenceException
 * @throws LoginException
 */
@Test public void testGetAll() throws PersistenceException, CoreException, LoginException {
  repositoryFactory.logOnProject(sampleProject);
  Property property=PropertiesFactory.eINSTANCE.createProperty();
  property.setAuthor(sampleProject.getAuthor());
  property.setVersion(VersionUtils.DEFAULT_VERSION);
  property.setStatusCode("String_Node_Str");
  property.setLabel("String_Node_Str");
  property.setDisplayName("String_Node_Str");
  final String nextId=repositoryFactory.getNextId();
  property.setId(nextId);
  ProcessItem processItem=PropertiesFactory.eINSTANCE.createProcessItem();
  processItem.setProperty(property);
  ProcessType process=TalendFileFactory.eINSTANCE.createProcessType();
  processItem.setProcess(process);
  repositoryFactory.create(sampleProject,processItem,new Path("String_Node_Str"),false);
  final List<IRepositoryViewObject> all=repositoryFactory.getAll(sampleProject,ERepositoryObjectType.PROCESS,true,true);
  assertNotNull(all);
  assertTrue(!all.isEmpty());
  repositoryFactory.deleteObjectPhysical(sampleProject,new RepositoryObject(property));
}

Fixed version (ground truth):
/** 
 * Test method for  {@link org.talend.repository.localprovider.model.LocalRepositoryFactory#getAll(org.talend.core.model.general.Project,org.talend.core.model.repository.ERepositoryObjectType,boolean,boolean)}.
 * @throws CoreException
 * @throws PersistenceException
 * @throws LoginException
 */
@Test public void testGetAll() throws PersistenceException, CoreException, LoginException {
  repositoryFactory.logOnProject(sampleProject);
  Property property=PropertiesFactory.eINSTANCE.createProperty();
  property.setAuthor(sampleProject.getAuthor());
  property.setVersion(VersionUtils.DEFAULT_VERSION);
  property.setStatusCode("String_Node_Str");
  property.setLabel("String_Node_Str");
  property.setDisplayName("String_Node_Str");
  final String nextId=repositoryFactory.getNextId();
  property.setId(nextId);
  ProcessItem processItem=PropertiesFactory.eINSTANCE.createProcessItem();
  processItem.setProperty(property);
  ProcessType process=TalendFileFactory.eINSTANCE.createProcessType();
  processItem.setProcess(process);
  repositoryFactory.create(sampleProject,processItem,new Path("String_Node_Str"),false);
  final List<IRepositoryViewObject> all=repositoryFactory.getAll(sampleProject,ERepositoryObjectType.PROCESS,true,true);
  assertNotNull(all);
  assertTrue(!all.isEmpty());
  repositoryFactory.deleteObjectPhysical(sampleProject,new RepositoryObject(property),false);
}
Program: 125415
Project: 125415
Buggy source:
public void paintControl(PaintEvent event){
  if (tableEditorManager != null) {
    tableEditorManager.paintVisibleAreaEditor(event);
  }
}

Fixed version (ground truth):
@Override public void paintControl(PaintEvent event){
  if (tableEditorManager != null) {
    tableEditorManager.paintVisibleAreaEditor(event);
  }
}
Program: 125417
Project: 125417
Buggy source:
@Override protected void handleDispose(DisposeEvent event){
  if (this.isCellEditorActive()) {
    CellEditor[] cellEditors=this.getCellEditors();
    for (int i=0; i < cellEditors.length; i++) {
      CellEditor cellEditor=cellEditors[i];
      if (cellEditor != null && cellEditor.isActivated() && cellEditor instanceof IShowInvisibleCellEditorMethods) {
        ((IShowInvisibleCellEditorMethods)cellEditor).fireApplyEditorValue();
      }
    }
  }
  super.handleDispose(event);
}

Fixed version (ground truth):
@Override protected void handleDispose(DisposeEvent event){
  if (this.isCellEditorActive()) {
    CellEditor[] cellEditors=this.getCellEditors();
    for (    CellEditor cellEditor : cellEditors) {
      if (cellEditor != null && cellEditor.isActivated() && cellEditor instanceof IShowInvisibleCellEditorMethods) {
        ((IShowInvisibleCellEditorMethods)cellEditor).fireApplyEditorValue();
      }
    }
  }
  super.handleDispose(event);
}
Program: 125418
Project: 125418
Buggy source:
/** 
 * DOC zshen Comment method "isComeFromRefrenceProject".
 * @return
 */
public static boolean isComeFromRefrenceProject(Connection dataProvider){
  RepositoryContext repositoryContext=(RepositoryContext)org.talend.core.runtime.CoreRuntimePlugin.getInstance().getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
  if (repositoryContext == null) {
    return false;
  }
  Project project=repositoryContext.getProject();
  if (project == null) {
    return false;
  }
  boolean isLocal=project.getEmfProject().isLocal();
  boolean isReference=project.getEmfProject().isReference();
  if (isLocal || isReference) {
    return false;
  }
  EList<ProjectReferenceImpl> referencedProjects=project.getEmfProject().getReferencedProjects();
  if (referencedProjects.size() > 0) {
    String currentResourceProjectName=dataProvider.eResource().getURI().segment(1);
    for (    ProjectReferenceImpl projectRef : referencedProjects) {
      String label=projectRef.getReferencedProject().getLabel();
      if (StringUtils.equalsIgnoreCase(currentResourceProjectName,label)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * DOC zshen Comment method "isComeFromRefrenceProject".
 * @return
 */
public static boolean isComeFromRefrenceProject(Connection dataProvider){
  RepositoryContext repositoryContext=(RepositoryContext)org.talend.core.runtime.CoreRuntimePlugin.getInstance().getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
  if (repositoryContext == null) {
    return false;
  }
  Project project=repositoryContext.getProject();
  if (project == null) {
    return false;
  }
  boolean isLocal=project.getEmfProject().isLocal();
  boolean isReference=project.getEmfProject().isReference();
  if (isLocal || isReference) {
    return false;
  }
  EList<ProjectReferenceImpl> referencedProjects=project.getEmfProject().getReferencedProjects();
  if (referencedProjects.size() > 0) {
    String currentResourceProjectName=dataProvider.eResource().getURI().segment(1);
    boolean isFromReferenceProject=iteration2FindReferenceProject(referencedProjects,currentResourceProjectName);
    if (isFromReferenceProject) {
      return true;
    }
  }
  return false;
}
Program: 125419
Project: 125419
Buggy source:
public void unloadResources(Property property){
  for (  Resource resource : getAffectedResources(property)) {
    if (resource != null) {
      resource.unload();
      getResourceSet().getResources().remove(resource);
    }
  }
}

Fixed version (ground truth):
public void unloadResources(ResourceSet resourceSet,Property property){
  for (  Resource resource : getAffectedResources(resourceSet,property)) {
    if (resource != null) {
      resource.unload();
      resourceSet.getResources().remove(resource);
    }
  }
}
Program: 125420
Project: 125420
Buggy source:
public Resource getItemResource(Item item,boolean forceLoad){
  if (item == null)   return null;
  URI itemResourceURI=null;
  if (item.getFileExtension() != null) {
    itemResourceURI=getItemResourceURI(getItemURI(item),item.getFileExtension());
  }
 else   if (item instanceof TDQItem) {
    IPath fileName=new Path(((TDQItem)item).getFilename());
    itemResourceURI=getItemResourceURI(getItemURI(item),fileName.getFileExtension());
  }
 else {
    itemResourceURI=getItemResourceURI(getItemURI(item));
  }
  Resource itemResource=getResourceSet().getResource(itemResourceURI,false);
  if (forceLoad && itemResource == null) {
    if (item instanceof FileItem) {
      itemResource=new ByteArrayResource(itemResourceURI);
      getResourceSet().getResources().add(itemResource);
    }
    itemResource=getResourceSet().getResource(itemResourceURI,true);
  }
  return itemResource;
}

Fixed version (ground truth):
public Resource getItemResource(ResourceSet resourceSet,Item item,boolean forceLoad){
  if (item == null) {
    return null;
  }
  URI itemResourceURI=null;
  if (item.getFileExtension() != null) {
    itemResourceURI=getItemResourceURI(getItemURI(item),item.getFileExtension());
  }
 else   if (item instanceof TDQItem) {
    IPath fileName=new Path(((TDQItem)item).getFilename());
    itemResourceURI=getItemResourceURI(getItemURI(item),fileName.getFileExtension());
  }
 else {
    itemResourceURI=getItemResourceURI(getItemURI(item));
  }
  Resource itemResource=resourceSet.getResource(itemResourceURI,false);
  if (forceLoad && itemResource == null) {
    if (item instanceof FileItem) {
      itemResource=new ByteArrayResource(itemResourceURI);
      resourceSet.getResources().add(itemResource);
    }
    itemResource=resourceSet.getResource(itemResourceURI,true);
  }
  return itemResource;
}
Program: 125422
Project: 125422
Buggy source:
public Resource getScreenshotResource(Item item,boolean createIfNotExist,boolean forceReload){
  URI itemResourceURI=null;
  itemResourceURI=getScreenshotResourceURI(getItemURI(item));
  boolean fileExist=false;
  if (itemResourceURI.isFile()) {
    fileExist=new File(itemResourceURI.toFileString()).exists();
  }
 else {
    IPath path=URIHelper.convert(itemResourceURI);
    if (path != null) {
      IFile file=ResourcesPlugin.getWorkspace().getRoot().getFile(path);
      if (file.exists()) {
        fileExist=true;
      }
    }
 else {
      fileExist=false;
    }
  }
  Resource itemResource=null;
  if (fileExist) {
    List<Resource> resources=new ArrayList<Resource>(getResourceSet().getResources());
    if (forceReload) {
      for (      Resource res : resources) {
        if (res != null) {
          if (itemResourceURI.toString().equals(res.getURI().toString())) {
            res.unload();
            getResourceSet().getResources().remove(res);
            break;
          }
        }
      }
    }
    try {
      itemResource=getResourceSet().getResource(itemResourceURI,true);
    }
 catch (    Exception e) {
      itemResource=null;
    }
  }
  if (itemResource == null && createIfNotExist) {
    itemResource=getResourceSet().createResource(itemResourceURI);
  }
  return itemResource;
}

Fixed version (ground truth):
public Resource getScreenshotResource(ResourceSet resourceSet,Item item,boolean createIfNotExist,boolean forceReload){
  URI itemResourceURI=null;
  itemResourceURI=getScreenshotResourceURI(getItemURI(item));
  boolean fileExist=false;
  if (itemResourceURI.isFile()) {
    fileExist=new File(itemResourceURI.toFileString()).exists();
  }
 else {
    IPath path=URIHelper.convert(itemResourceURI);
    if (path != null) {
      IFile file=ResourcesPlugin.getWorkspace().getRoot().getFile(path);
      if (file.exists()) {
        fileExist=true;
      }
    }
 else {
      fileExist=false;
    }
  }
  Resource itemResource=null;
  if (fileExist) {
    List<Resource> resources=new ArrayList<Resource>(getResourceSet().getResources());
    if (forceReload) {
      for (      Resource res : resources) {
        if (res != null) {
          if (itemResourceURI.toString().equals(res.getURI().toString())) {
            res.unload();
            getResourceSet().getResources().remove(res);
            break;
          }
        }
      }
    }
    try {
      itemResource=getResourceSet().getResource(itemResourceURI,true);
    }
 catch (    Exception e) {
      itemResource=null;
    }
  }
  if (itemResource == null && createIfNotExist) {
    itemResource=getResourceSet().createResource(itemResourceURI);
  }
  return itemResource;
}
Program: 125424
Project: 125424
Buggy source:
private Set<Relation> getItemsHaveRelationWith(Map<Relation,Set<Relation>> itemsRelations,String itemId){
  Set<Relation> relations=new HashSet<Relation>();
  for (  Relation baseItem : itemsRelations.keySet()) {
    for (    Relation relatedItem : itemsRelations.get(baseItem)) {
      String id=relatedItem.getId();
      if (id != null) {
        Relation tmpRelatedItem=null;
        if (id.indexOf("String_Node_Str") != -1) {
          try {
            tmpRelatedItem=(Relation)relatedItem.clone();
            tmpRelatedItem.setId(id.split("String_Node_Str")[0]);
          }
 catch (          CloneNotSupportedException e) {
            log.error(e);
          }
        }
 else {
          tmpRelatedItem=relatedItem;
        }
        if (tmpRelatedItem != null && itemId.equals(id)) {
          relations.add(baseItem);
          break;
        }
      }
    }
  }
  return relations;
}

Fixed version (ground truth):
/** 
 * DOC cmeng Comment method "getItemsHaveRelationWith".
 * @param itemsRelations
 * @param itemId
 * @param version if null, then won't check
 * @return
 */
private Set<Relation> getItemsHaveRelationWith(Map<Relation,Set<Relation>> itemsRelations,String itemId,String version){
  Set<Relation> relations=new HashSet<Relation>();
  for (  Relation baseItem : itemsRelations.keySet()) {
    for (    Relation relatedItem : itemsRelations.get(baseItem)) {
      String id=relatedItem.getId();
      if (id != null) {
        Relation tmpRelatedItem=null;
        if (id.indexOf("String_Node_Str") != -1) {
          try {
            tmpRelatedItem=(Relation)relatedItem.clone();
            tmpRelatedItem.setId(id.split("String_Node_Str")[0]);
          }
 catch (          CloneNotSupportedException e) {
            log.error(e);
          }
        }
 else {
          tmpRelatedItem=relatedItem;
        }
        if (tmpRelatedItem != null && itemId.equals(id)) {
          boolean isEqual=true;
          if (version != null) {
            String curVersion=tmpRelatedItem.getVersion();
            if (!LATEST_VERSION.equals(version) && LATEST_VERSION.equals(curVersion)) {
              try {
                IRepositoryViewObject latest=getProxyRepositoryFactory().getLastVersion(getAimProject(),id);
                if (latest != null) {
                  curVersion=latest.getVersion();
                }
              }
 catch (              PersistenceException e) {
                ExceptionHandler.process(e);
              }
            }
            if (version.equals(curVersion)) {
              isEqual=true;
            }
 else {
              isEqual=false;
            }
          }
          if (isEqual) {
            relations.add(baseItem);
            break;
          }
        }
      }
    }
  }
  return relations;
}
Program: 125425
Project: 125425
Buggy source:
private Set<Relation> getItemsHaveRelationWithJob(Map<Relation,Set<Relation>> itemsRelations,String itemId,String version){
  Set<Relation> relations=new HashSet<Relation>();
  for (  Relation baseItem : itemsRelations.keySet()) {
    for (    Relation relatedItem : itemsRelations.get(baseItem)) {
      String id=relatedItem.getId();
      if (relatedItem.getType().equals(JOB_RELATION) && itemId.equals(id)) {
        if ("String_Node_Str".equals(relatedItem.getVersion())) {
          try {
            IRepositoryViewObject latest=getProxyRepositoryFactory().getLastVersion(id);
            if (!latest.getVersion().equals(version)) {
              continue;
            }
          }
 catch (          PersistenceException e) {
            continue;
          }
        }
 else         if (!relatedItem.getVersion().equals(version)) {
          continue;
        }
        relations.add(baseItem);
        break;
      }
    }
  }
  return relations;
}

Fixed version (ground truth):
private Set<Relation> getItemsHaveRelationWithJob(Map<Relation,Set<Relation>> itemsRelations,String itemId,String version){
  Set<Relation> relations=new HashSet<Relation>();
  for (  Relation baseItem : itemsRelations.keySet()) {
    for (    Relation relatedItem : itemsRelations.get(baseItem)) {
      String id=relatedItem.getId();
      if (relatedItem.getType().equals(JOB_RELATION) && itemId.equals(id)) {
        if ("String_Node_Str".equals(relatedItem.getVersion())) {
          try {
            IRepositoryViewObject latest=getProxyRepositoryFactory().getLastVersion(getAimProject(),id);
            if (!latest.getVersion().equals(version)) {
              continue;
            }
          }
 catch (          PersistenceException e) {
            continue;
          }
        }
 else         if (!relatedItem.getVersion().equals(version)) {
          continue;
        }
        relations.add(baseItem);
        break;
      }
    }
  }
  return relations;
}
Program: 125426
Project: 125426
Buggy source:
private static RelationshipItemBuilder createInstance(IProxyRepositoryFactory repositoryFactory,Project project){
  RelationshipItemBuilder instance=new RelationshipItemBuilder();
  instance.setAimProject(project);
  instance.setProxyRepositoryFactory(repositoryFactory);
  return instance;
}

Fixed version (ground truth):
public static RelationshipItemBuilder createInstance(IProxyRepositoryFactory repositoryFactory,Project project){
  RelationshipItemBuilder instance=new RelationshipItemBuilder();
  instance.setAimProject(project);
  instance.setProxyRepositoryFactory(repositoryFactory);
  return instance;
}
Program: 125427
Project: 125427
Buggy source:
private void buildIndex(Map<Relation,Set<Relation>> itemRelations,Project project,IProgressMonitor monitor){
  modified=true;
  if (!project.getEmfProject().getItemsRelations().isEmpty()) {
    loadRelations(itemRelations,project);
    if (loaded) {
      return;
    }
  }
  IProxyRepositoryFactory factory=getProxyRepositoryFactory();
  List<IRepositoryViewObject> list=new ArrayList<IRepositoryViewObject>();
  try {
    for (    ERepositoryObjectType curTyp : getTypes()) {
      if (curTyp != null) {
        list.addAll(factory.getAll(curTyp,true,true));
      }
    }
    monitor.beginTask(Messages.getString("String_Node_Str"),list.size());
    if (list.isEmpty()) {
      return;
    }
    for (    IRepositoryViewObject object : list) {
      Item item=object.getProperty().getItem();
      monitor.subTask(Messages.getString("String_Node_Str") + item.getProperty().getLabel());
      addOrUpdateItem(item,true);
      monitor.worked(1);
      if (monitor.isCanceled()) {
        return;
      }
    }
    saveRelations();
    monitor.done();
    loaded=true;
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
private void buildIndex(Map<Relation,Set<Relation>> itemRelations,Project project,IProgressMonitor monitor){
  modified=true;
  if (!project.getEmfProject().getItemsRelations().isEmpty()) {
    loadRelations(itemRelations,project);
    if (loaded) {
      return;
    }
  }
  IProxyRepositoryFactory factory=getProxyRepositoryFactory();
  List<IRepositoryViewObject> list=new ArrayList<IRepositoryViewObject>();
  try {
    for (    ERepositoryObjectType curTyp : getTypes()) {
      if (curTyp != null) {
        list.addAll(factory.getAll(project,curTyp,true,true));
      }
    }
    monitor.beginTask(Messages.getString("String_Node_Str"),list.size());
    if (list.isEmpty()) {
      return;
    }
    for (    IRepositoryViewObject object : list) {
      Item item=object.getProperty().getItem();
      monitor.subTask(Messages.getString("String_Node_Str") + item.getProperty().getLabel());
      addOrUpdateItem(item,true);
      monitor.worked(1);
      if (monitor.isCanceled()) {
        return;
      }
    }
    saveRelations();
    monitor.done();
    loaded=true;
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
  }
}
Program: 125432
Project: 125432
Buggy source:
public boolean getMergeRefProject(){
  IPreferenceStore preferenceStore=RepositoryManager.getRepositoryPreferenceStore();
  return preferenceStore.getBoolean(IRepositoryPrefConstants.MERGE_REFERENCE_PROJECT);
}

Fixed version (ground truth):
public boolean getMergeRefProject(){
  IPreferenceStore preferenceStore=RepositoryManager.getRepositoryPreferenceStore();
  if (!preferenceStore.contains(IRepositoryPrefConstants.MERGE_REFERENCE_PROJECT)) {
    return false;
  }
  return preferenceStore.getBoolean(IRepositoryPrefConstants.MERGE_REFERENCE_PROJECT);
}