nus-yam/ex-repair huggingface dataset:
Program: 127553
Project: 127553
Buggy source:
@Override public void initNewProjectTasks(Project project){
  List<IProjectMigrationTask> toExecute=GetTasksHelper.getProjectTasks(true);
  toExecute.addAll(GetTasksHelper.getProjectTasks(false));
  List<MigrationTask> done=new ArrayList<MigrationTask>();
  for (  IProjectMigrationTask task : toExecute) {
    done.add(MigrationUtil.convertMigrationTask(task));
  }
  saveProjectMigrationTasksDone(project,done);
}

Fixed version (ground truth):
@Override public void initNewProjectTasks(Project project){
  List<IProjectMigrationTask> toExecute=GetTasksHelper.getProjectTasks(true);
  toExecute.addAll(GetTasksHelper.getProjectTasks(false));
  List<MigrationTask> done=new ArrayList<MigrationTask>();
  for (  IProjectMigrationTask task : toExecute) {
    done.add(MigrationUtil.convertMigrationTask(task));
  }
  project.getEmfProject().setItemsRelationVersion(RelationshipItemBuilder.INDEX_VERSION);
  saveProjectMigrationTasksDone(project,done);
}
Program: 127558
Project: 127558
Buggy source:
public static String addQuotesWithSpaceField(String fieldName,String dbType){
  if (fieldName == null) {
    fieldName="String_Node_Str";
  }
  if (fieldName.startsWith("String_Node_Str") && fieldName.endsWith("String_Node_Str")) {
    return fieldName;
  }
  boolean b=true;
  for (int i=0; i < fieldName.length(); i++) {
    char c=fieldName.charAt(i);
    b=b && c >= '0' && c <= '9';
  }
  EDatabaseTypeName name=EDatabaseTypeName.getTypeFromDbType(dbType);
  if (name.equals(EDatabaseTypeName.MYSQL) && fieldName.contains(JAVA_END_STRING)) {
    String newFieldName=TalendQuoteUtils.addQuotes(fieldName);
    return newFieldName;
  }
  boolean isCheck=!CorePlugin.getDefault().getPreferenceStore().getBoolean(ITalendCorePrefConstants.SQL_ADD_QUOTE);
  if (!b) {
    if (isCheck && isPSQLSimilar(name)) {
      return fieldName;
    }
  }
  String newFieldName=fieldName;
  String quote=getQuoteByDBType(name);
  if (!newFieldName.contains(quote)) {
    newFieldName=addQuotes(newFieldName,quote);
  }
  return newFieldName;
}

Fixed version (ground truth):
public static String addQuotesWithSpaceField(String fieldName,String dbType){
  if (fieldName == null) {
    fieldName="String_Node_Str";
  }
  if (fieldName.startsWith("String_Node_Str") && fieldName.endsWith("String_Node_Str")) {
    return fieldName;
  }
  boolean b=true;
  for (int i=0; i < fieldName.length(); i++) {
    char c=fieldName.charAt(i);
    b=b && c >= '0' && c <= '9';
  }
  boolean check=Pattern.matches("String_Node_Str",fieldName);
  EDatabaseTypeName name=EDatabaseTypeName.getTypeFromDbType(dbType);
  boolean isCheck=!CorePlugin.getDefault().getPreferenceStore().getBoolean(ITalendCorePrefConstants.SQL_ADD_QUOTE);
  if (!b) {
    if (isCheck && isPSQLSimilar(name) && check) {
      return fieldName;
    }
  }
  String newFieldName=fieldName;
  String quote=getQuoteByDBType(name);
  if (!newFieldName.contains(quote)) {
    newFieldName=addQuotes(newFieldName,quote);
  }
  return newFieldName;
}
Program: 127559
Project: 127559
Buggy source:
/** 
 * DOC ocarbone Comment method "initMetadataForm".
 */
private void initMetadataForm(){
  metadataEditor.setMetadataTable(metadataTable);
  IPreferenceStore store=RepositoryManager.getPreferenceStore();
  Boolean flag=store.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS);
  if (!flag.booleanValue()) {
    List<MetadataColumn> list=metadataEditor.getMetadataColumnList();
    for (    MetadataColumn column : list) {
      if (!isCnorEn(column.getLabel())) {
        String label=metadataEditor.getNextGeneratedColumnName("String_Node_Str");
        column.setLabel(label);
      }
    }
  }
  removeDoubleQuotes(metadataEditor.getMetadataColumnList());
  tableEditorView.setMetadataEditor(metadataEditor);
  tableEditorView.getTableViewerCreator().layout();
  metadataEditor.addAfterOperationListListener(new IListenableListListener(){
    @Override public void handleEvent(    ListenableListEvent event){
      changeTableNavigatorStatus(checkFieldsValue());
    }
  }
);
  nameText.setText(metadataTable.getName());
  commentText.setText(metadataTable.getComment());
  if (metadataTable.getTableType() != null) {
    typeText.setText(Messages.getString("String_Node_Str",metadataTable.getTableType()));
  }
 else {
    typeText.setText(Messages.getString("String_Node_Str"));
  }
  String sourceName=metadataTable.getName();
  tableCombo.setText(sourceName);
  updateRetreiveSchemaButton();
  nameText.forceFocus();
}

Fixed version (ground truth):
/** 
 * DOC ocarbone Comment method "initMetadataForm".
 */
private void initMetadataForm(){
  metadataEditor.setMetadataTable(metadataTable);
  IPreferenceStore store=RepositoryManager.getPreferenceStore();
  Boolean flag=store.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS);
  if (!flag.booleanValue()) {
    List<MetadataColumn> list=metadataEditor.getMetadataColumnList();
    for (    MetadataColumn column : list) {
      if (!isCnorEn(column.getLabel())) {
        String label=metadataEditor.getNextGeneratedColumnName("String_Node_Str");
        column.setLabel(label);
      }
    }
  }
  removeDoubleQuotes(metadataEditor.getMetadataColumnList());
  tableEditorView.setMetadataEditor(metadataEditor);
  tableEditorView.getTableViewerCreator().layout();
  metadataEditor.addAfterOperationListListener(new IListenableListListener(){
    @Override public void handleEvent(    ListenableListEvent event){
      changeTableNavigatorStatus(checkFieldsValue());
    }
  }
);
  nameText.setText(MetadataToolHelper.validateValue(metadataTable.getLabel()));
  commentText.setText(metadataTable.getComment());
  if (metadataTable.getTableType() != null) {
    typeText.setText(Messages.getString("String_Node_Str",metadataTable.getTableType()));
  }
 else {
    typeText.setText(Messages.getString("String_Node_Str"));
  }
  String sourceName=metadataTable.getName();
  tableCombo.setText(sourceName);
  updateRetreiveSchemaButton();
  nameText.forceFocus();
}
Program: 127562
Project: 127562
Buggy source:
public static String addQuotesWithSpaceField(String fieldName,String dbType){
  if (fieldName == null) {
    fieldName="String_Node_Str";
  }
  if (fieldName.startsWith("String_Node_Str") && fieldName.endsWith("String_Node_Str")) {
    return fieldName;
  }
  boolean b=true;
  for (int i=0; i < fieldName.length(); i++) {
    char c=fieldName.charAt(i);
    b=b && c >= '0' && c <= '9';
  }
  EDatabaseTypeName name=EDatabaseTypeName.getTypeFromDbType(dbType);
  if (name.equals(EDatabaseTypeName.MYSQL) && fieldName.contains(JAVA_END_STRING)) {
    String newFieldName=TalendQuoteUtils.addQuotes(fieldName);
    return newFieldName;
  }
  boolean isCheck=!CorePlugin.getDefault().getPreferenceStore().getBoolean(ITalendCorePrefConstants.SQL_ADD_QUOTE);
  if (!b) {
    if (isCheck && isPSQLSimilar(name)) {
      return fieldName;
    }
  }
  String newFieldName=fieldName;
  String quote=getQuoteByDBType(name);
  if (!newFieldName.contains(quote)) {
    newFieldName=addQuotes(newFieldName,quote);
  }
  return newFieldName;
}

Fixed version (ground truth):
public static String addQuotesWithSpaceField(String fieldName,String dbType){
  if (fieldName == null) {
    fieldName="String_Node_Str";
  }
  if (fieldName.startsWith("String_Node_Str") && fieldName.endsWith("String_Node_Str")) {
    return fieldName;
  }
  boolean b=true;
  for (int i=0; i < fieldName.length(); i++) {
    char c=fieldName.charAt(i);
    b=b && c >= '0' && c <= '9';
  }
  boolean check=Pattern.matches("String_Node_Str",fieldName);
  EDatabaseTypeName name=EDatabaseTypeName.getTypeFromDbType(dbType);
  boolean isCheck=!CorePlugin.getDefault().getPreferenceStore().getBoolean(ITalendCorePrefConstants.SQL_ADD_QUOTE);
  if (!b) {
    if (isCheck && isPSQLSimilar(name) && check) {
      return fieldName;
    }
  }
  String newFieldName=fieldName;
  String quote=getQuoteByDBType(name);
  if (!newFieldName.contains(quote)) {
    newFieldName=addQuotes(newFieldName,quote);
  }
  return newFieldName;
}
Program: 127563
Project: 127563
Buggy source:
private static DynamicClassLoader createCustomClassLoader(String index,Set<String> libraries){
  DynamicClassLoader classLoader=new DynamicClassLoader();
  loadLibraries(classLoader,libraries.toArray(new String[0]));
  classLoadersMap.put(index,classLoader);
  return classLoader;
}

Fixed version (ground truth):
private static DynamicClassLoader createCustomClassLoader(String index,Set<String> libraries){
  DynamicClassLoader classLoader=new DynamicClassLoader();
  loadLibraries(classLoader,libraries.toArray(new String[0]),false);
  classLoadersMap.put(index,classLoader);
  return classLoader;
}
Program: 127564
Project: 127564
Buggy source:
private static DynamicClassLoader findLoader(String index){
  if (index != null && configurationElements != null) {
    for (    IConfigurationElement current : configurationElements) {
      String key=current.getAttribute(INDEX_ATTR);
      if (index.equals(key)) {
        String libraries=current.getAttribute(LIB_ATTR);
        if (StringUtils.isNotEmpty(index)) {
          DynamicClassLoader classLoader=new DynamicClassLoader();
          boolean putInCache=true;
          if (StringUtils.isNotEmpty(libraries)) {
            String[] librariesArray=libraries.split(SEPARATOR);
            putInCache=loadLibraries(classLoader,librariesArray);
          }
          if (putInCache) {
            classLoadersMap.put(index,classLoader);
          }
          return classLoader;
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private static DynamicClassLoader findLoader(String index,boolean showDownloadIfNotExist){
  if (index != null && configurationElements != null) {
    for (    IConfigurationElement current : configurationElements) {
      String key=current.getAttribute(INDEX_ATTR);
      if (index.equals(key)) {
        String libraries=current.getAttribute(LIB_ATTR);
        if (StringUtils.isNotEmpty(index)) {
          DynamicClassLoader classLoader=new DynamicClassLoader();
          boolean putInCache=true;
          if (StringUtils.isNotEmpty(libraries)) {
            String[] librariesArray=libraries.split(SEPARATOR);
            putInCache=loadLibraries(classLoader,librariesArray,showDownloadIfNotExist);
          }
          if (putInCache) {
            classLoadersMap.put(index,classLoader);
          }
          return classLoader;
        }
      }
    }
  }
  return null;
}
Program: 127565
Project: 127565
Buggy source:
/** 
 * DOC ycbai Comment method "getClassLoader".
 * @param index
 * @return the classLoader by index
 */
public static DynamicClassLoader getClassLoader(String index){
  if (classLoadersMap == null) {
    init();
  }
  DynamicClassLoader classLoader=classLoadersMap.get(index);
  if (classLoader == null) {
    classLoader=findLoader(index);
  }
  return classLoader;
}

Fixed version (ground truth):
public static DynamicClassLoader getClassLoader(String index,boolean showDownloadIfNotExist){
  if (classLoadersMap == null) {
    init();
  }
  DynamicClassLoader classLoader=classLoadersMap.get(index);
  if (classLoader == null) {
    classLoader=findLoader(index,showDownloadIfNotExist);
  }
  return classLoader;
}
Program: 127566
Project: 127566
Buggy source:
private static boolean loadLibraries(DynamicClassLoader classLoader,String[] driversArray){
  List<String> jarPathList=new ArrayList<String>();
  if (driversArray == null || driversArray.length == 0) {
    return true;
  }
  ILibraryManagerService librairesManagerService=(ILibraryManagerService)GlobalServiceRegister.getDefault().getService(ILibraryManagerService.class);
  String libPath=getLibPath();
  List<String> driverNotExist=new ArrayList<String>();
  for (  String driverName : driversArray) {
    String jarPath=libPath + PATH_SEPARATOR + driverName;
    File jarFile=new File(jarPath);
    if (!jarFile.exists()) {
      driverNotExist.add(driverName);
    }
    jarPathList.add(jarFile.getAbsolutePath());
  }
  boolean putInCache=false;
  if (!driverNotExist.isEmpty()) {
    putInCache=librairesManagerService.retrieve(driverNotExist,libPath,new NullProgressMonitor());
  }
  classLoader.setLibStorePath(libPath);
  classLoader.addLibraries(jarPathList);
  return putInCache;
}

Fixed version (ground truth):
private static boolean loadLibraries(DynamicClassLoader classLoader,String[] driversArray,boolean showDownloadIfNotExist){
  List<String> jarPathList=new ArrayList<String>();
  if (driversArray == null || driversArray.length == 0) {
    return true;
  }
  ILibraryManagerService librairesManagerService=(ILibraryManagerService)GlobalServiceRegister.getDefault().getService(ILibraryManagerService.class);
  String libPath=getLibPath();
  List<String> driverNotExist=new ArrayList<String>();
  for (  String driverName : driversArray) {
    String jarPath=libPath + PATH_SEPARATOR + driverName;
    File jarFile=new File(jarPath);
    if (!jarFile.exists()) {
      driverNotExist.add(driverName);
    }
    jarPathList.add(jarFile.getAbsolutePath());
  }
  boolean putInCache=false;
  if (!driverNotExist.isEmpty()) {
    putInCache=librairesManagerService.retrieve(driverNotExist,libPath,showDownloadIfNotExist,new NullProgressMonitor());
  }
  classLoader.setLibStorePath(libPath);
  classLoader.addLibraries(jarPathList);
  return putInCache;
}
Program: 127567
Project: 127567
Buggy source:
/** 
 * DOC ycbai Comment method "getHadoopJars".
 * @param distribution
 * @param version
 * @return jars which this hadoop distribution(and version) needed.
 */
public Set<String> getHadoopLibraries(String distribution,String version);

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "getHadoopJars".
 * @param distribution
 * @param version
 * @return jars which this hadoop distribution(and version) needed.
 */
public Set<String> getHadoopLibraries(String distribution,String version,boolean showDownloadIfNotExist);
Program: 127568
Project: 127568
Buggy source:
public String getLibDescription(String jarName){
  String desc=descMap.get(jarName);
  if (desc != null) {
    return desc;
  }
  String jarPath=tmpFolder + File.separator + jarName;
  try {
    boolean isOk=false;
    File jarFile=new File(jarPath);
    if (!jarFile.exists()) {
      isOk=librairesService.retrieve(jarName,tmpFolder,new NullProgressMonitor());
    }
    if (isOk) {
      desc=getJarDescFromManifest(jarFile);
      if (desc != null) {
        descMap.put(jarName,desc);
        return desc;
      }
      desc=getJarDescFromProperties(jarName);
      if (desc != null) {
        descMap.put(jarName,desc);
        return desc;
      }
      desc=getJarDescFromDefault(jarName);
      if (desc != null) {
        descMap.put(jarName,desc);
        return desc;
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  return EMPTY_STRING;
}

Fixed version (ground truth):
public String getLibDescription(String jarName){
  String desc=descMap.get(jarName);
  if (desc != null) {
    return desc;
  }
  String jarPath=tmpFolder + File.separator + jarName;
  try {
    boolean isOk=false;
    File jarFile=new File(jarPath);
    if (!jarFile.exists()) {
      isOk=librairesService.retrieve(jarName,tmpFolder,false,new NullProgressMonitor());
    }
    if (isOk) {
      desc=getJarDescFromManifest(jarFile);
      if (desc != null) {
        descMap.put(jarName,desc);
        return desc;
      }
      desc=getJarDescFromProperties(jarName);
      if (desc != null) {
        descMap.put(jarName,desc);
        return desc;
      }
      desc=getJarDescFromDefault(jarName);
      if (desc != null) {
        descMap.put(jarName,desc);
        return desc;
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  return EMPTY_STRING;
}
Program: 127570
Project: 127570
Buggy source:
/** 
 * DOC ocarbone Comment method "initMetadataForm".
 */
private void initMetadataForm(){
  metadataEditor.setMetadataTable(metadataTable);
  IPreferenceStore store=RepositoryManager.getPreferenceStore();
  Boolean flag=store.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS);
  if (!flag.booleanValue()) {
    List<MetadataColumn> list=metadataEditor.getMetadataColumnList();
    for (    MetadataColumn column : list) {
      if (!isCnorEn(column.getLabel())) {
        String label=metadataEditor.getNextGeneratedColumnName("String_Node_Str");
        column.setLabel(label);
      }
    }
  }
  removeDoubleQuotes(metadataEditor.getMetadataColumnList());
  tableEditorView.setMetadataEditor(metadataEditor);
  tableEditorView.getTableViewerCreator().layout();
  metadataEditor.addAfterOperationListListener(new IListenableListListener(){
    @Override public void handleEvent(    ListenableListEvent event){
      changeTableNavigatorStatus(checkFieldsValue());
    }
  }
);
  nameText.setText(metadataTable.getName());
  commentText.setText(metadataTable.getComment());
  if (metadataTable.getTableType() != null) {
    typeText.setText(Messages.getString("String_Node_Str",metadataTable.getTableType()));
  }
 else {
    typeText.setText(Messages.getString("String_Node_Str"));
  }
  String sourceName=metadataTable.getName();
  tableCombo.setText(sourceName);
  updateRetreiveSchemaButton();
  nameText.forceFocus();
}

Fixed version (ground truth):
/** 
 * DOC ocarbone Comment method "initMetadataForm".
 */
private void initMetadataForm(){
  metadataEditor.setMetadataTable(metadataTable);
  IPreferenceStore store=RepositoryManager.getPreferenceStore();
  Boolean flag=store.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS);
  if (!flag.booleanValue()) {
    List<MetadataColumn> list=metadataEditor.getMetadataColumnList();
    for (    MetadataColumn column : list) {
      if (!isCnorEn(column.getLabel())) {
        String label=metadataEditor.getNextGeneratedColumnName("String_Node_Str");
        column.setLabel(label);
      }
    }
  }
  removeDoubleQuotes(metadataEditor.getMetadataColumnList());
  tableEditorView.setMetadataEditor(metadataEditor);
  tableEditorView.getTableViewerCreator().layout();
  metadataEditor.addAfterOperationListListener(new IListenableListListener(){
    @Override public void handleEvent(    ListenableListEvent event){
      changeTableNavigatorStatus(checkFieldsValue());
    }
  }
);
  nameText.setText(MetadataToolHelper.validateValue(metadataTable.getLabel()));
  commentText.setText(metadataTable.getComment());
  if (metadataTable.getTableType() != null) {
    typeText.setText(Messages.getString("String_Node_Str",metadataTable.getTableType()));
  }
 else {
    typeText.setText(Messages.getString("String_Node_Str"));
  }
  String sourceName=metadataTable.getName();
  tableCombo.setText(sourceName);
  updateRetreiveSchemaButton();
  nameText.forceFocus();
}
Program: 127577
Project: 127577
Buggy source:
public boolean isReadOnly(){
  MetadataTable table=getTable();
  return table == null ? false : table.isReadOnly();
}

Fixed version (ground truth):
@Override public boolean isReadOnly(){
  MetadataTable table=getTable();
  return table == null ? false : table.isReadOnly();
}
Program: 127578
Project: 127578
Buggy source:
@Override public void dispose(){
  PlatformUI.getWorkbench().getActiveWorkbenchWindow().removePerspectiveListener(getRepoViewPerspectiveListener());
  super.dispose();
}

Fixed version (ground truth):
@Override public void dispose(){
  PlatformUI.getWorkbench().getActiveWorkbenchWindow().removePerspectiveListener(getRepoViewPerspectiveListener());
  IWorkspace workspace=ResourcesPlugin.getWorkspace();
  if (workspace != null) {
    workspace.removeResourceChangeListener(getResourcePostChangerRunnableListener());
  }
  super.dispose();
}
Program: 127580
Project: 127580
Buggy source:
@Override public void dispose(){
  IWorkspace workspace=ResourcesPlugin.getWorkspace();
  if (workspace != null && resouceChangeVisitor != null) {
    workspace.removeResourceChangeListener(resouceChangeVisitor);
  }
  topLevelNodeToPathMap.clear();
  topLevelNodeToPathMap=null;
  super.dispose();
}

Fixed version (ground truth):
@Override public void dispose(){
  if (this.viewer != null && this.visitor != null && this.viewer instanceof RepoViewCommonViewer) {
    final Control control=this.viewer.getControl();
    if (control != null && !control.isDisposed()) {
      CommonNavigator commonNavigator=((RepoViewCommonViewer)this.viewer).getCommonNavigator();
      if (commonNavigator instanceof RepoViewCommonNavigator) {
        ((RepoViewCommonNavigator)commonNavigator).removeVisitor(this.visitor);
      }
    }
  }
  topLevelNodeToPathMap.clear();
  topLevelNodeToPathMap=null;
  super.dispose();
}
Program: 127581
Project: 127581
Buggy source:
@Override protected boolean visit(IResourceDelta delta,Collection<Runnable> runnables){
  VisitResourceHelper visitHelper=new VisitResourceHelper(delta);
  boolean merged=ProjectRepositoryNode.getInstance().getMergeRefProject();
  Set<RepositoryNode> topLevelNodes=getTopLevelNodes();
  boolean visitChildren=false;
  for (  final RepositoryNode repoNode : topLevelNodes) {
    IPath topLevelNodeWorkspaceRelativePath=topLevelNodeToPathMap.get(repoNode);
    if (topLevelNodeWorkspaceRelativePath != null && visitHelper.valid(topLevelNodeWorkspaceRelativePath,merged)) {
      visitChildren=false;
      if (viewer instanceof RepoViewCommonViewer) {
        runnables.add(new Runnable(){
          @Override public void run(){
            refreshTopLevelNode(repoNode);
          }
        }
);
      }
    }
  }
  return visitChildren;
}

Fixed version (ground truth):
@Override protected boolean visit(IResourceDelta delta,Collection<Runnable> runnables){
  VisitResourceHelper visitHelper=new VisitResourceHelper(delta);
  boolean merged=ProjectRepositoryNode.getInstance().getMergeRefProject();
  Set<RepositoryNode> topLevelNodes=getTopLevelNodes();
  boolean visitChildren=false;
  for (  final RepositoryNode repoNode : topLevelNodes) {
    IPath topLevelNodeWorkspaceRelativePath=topLevelNodeToPathMap.get(repoNode);
    if (topLevelNodeWorkspaceRelativePath != null && visitHelper.valid(topLevelNodeWorkspaceRelativePath,merged)) {
      visitChildren=false;
      if (viewer instanceof RepoViewCommonViewer) {
        runnables.add(new TopLevelNodeRunnable(repoNode){
          @Override public void run(){
            refreshTopLevelNode(repoNode);
          }
        }
);
      }
    }
  }
  return visitChildren;
}
Program: 127582
Project: 127582
Buggy source:
@Override public void inputChanged(Viewer arg0,Object arg1,Object arg2){
  if (arg0 instanceof CommonViewer) {
    this.viewer=(CommonViewer)arg0;
  }
  super.inputChanged(arg0,arg1,arg2);
  topLevelNodeToPathMap.clear();
  addResourceChangeListener();
}

Fixed version (ground truth):
@Override public void inputChanged(Viewer arg0,Object arg1,Object arg2){
  if (arg0 instanceof CommonViewer) {
    this.viewer=(CommonViewer)arg0;
  }
  super.inputChanged(arg0,arg1,arg2);
  topLevelNodeToPathMap.clear();
  addResourceVisitor(this.viewer);
}
Program: 127585
Project: 127585
Buggy source:
public static String addQuotesWithSpaceField(String fieldName,String dbType){
  if (fieldName == null) {
    fieldName="String_Node_Str";
  }
  if (fieldName.startsWith("String_Node_Str") && fieldName.endsWith("String_Node_Str")) {
    return fieldName;
  }
  boolean b=true;
  for (int i=0; i < fieldName.length(); i++) {
    char c=fieldName.charAt(i);
    b=b && c >= '0' && c <= '9';
  }
  EDatabaseTypeName name=EDatabaseTypeName.getTypeFromDbType(dbType);
  if (name.equals(EDatabaseTypeName.MYSQL) && fieldName.contains(JAVA_END_STRING)) {
    String newFieldName="String_Node_Str" + fieldName + "String_Node_Str";
    return newFieldName;
  }
  boolean isCheck=!CorePlugin.getDefault().getPreferenceStore().getBoolean(ITalendCorePrefConstants.SQL_ADD_QUOTE);
  if (!b) {
    if (isCheck && isPSQLSimilar(name)) {
      return fieldName;
    }
  }
  String newFieldName=fieldName;
  String quote=getQuoteByDBType(name);
  if (!newFieldName.contains(quote)) {
    newFieldName=addQuotes(newFieldName,quote);
  }
  return newFieldName;
}

Fixed version (ground truth):
public static String addQuotesWithSpaceField(String fieldName,String dbType){
  if (fieldName == null) {
    fieldName="String_Node_Str";
  }
  if (fieldName.startsWith("String_Node_Str") && fieldName.endsWith("String_Node_Str")) {
    return fieldName;
  }
  boolean b=true;
  for (int i=0; i < fieldName.length(); i++) {
    char c=fieldName.charAt(i);
    b=b && c >= '0' && c <= '9';
  }
  EDatabaseTypeName name=EDatabaseTypeName.getTypeFromDbType(dbType);
  if (name.equals(EDatabaseTypeName.MYSQL) && fieldName.contains(JAVA_END_STRING)) {
    String newFieldName=TalendQuoteUtils.addQuotes(fieldName);
    return newFieldName;
  }
  boolean isCheck=!CorePlugin.getDefault().getPreferenceStore().getBoolean(ITalendCorePrefConstants.SQL_ADD_QUOTE);
  if (!b) {
    if (isCheck && isPSQLSimilar(name)) {
      return fieldName;
    }
  }
  String newFieldName=fieldName;
  String quote=getQuoteByDBType(name);
  if (!newFieldName.contains(quote)) {
    newFieldName=addQuotes(newFieldName,quote);
  }
  return newFieldName;
}
Program: 127589
Project: 127589
Buggy source:
@Override public void dispose(){
  PlatformUI.getWorkbench().getActiveWorkbenchWindow().removePerspectiveListener(getRepoViewPerspectiveListener());
  super.dispose();
}

Fixed version (ground truth):
@Override public void dispose(){
  PlatformUI.getWorkbench().getActiveWorkbenchWindow().removePerspectiveListener(getRepoViewPerspectiveListener());
  IWorkspace workspace=ResourcesPlugin.getWorkspace();
  if (workspace != null) {
    workspace.removeResourceChangeListener(getResourcePostChangerRunnableListener());
  }
  super.dispose();
}
Program: 127591
Project: 127591
Buggy source:
@Override public void dispose(){
  IWorkspace workspace=ResourcesPlugin.getWorkspace();
  if (workspace != null && resouceChangeVisitor != null) {
    workspace.removeResourceChangeListener(resouceChangeVisitor);
  }
  topLevelNodeToPathMap.clear();
  topLevelNodeToPathMap=null;
  super.dispose();
}

Fixed version (ground truth):
@Override public void dispose(){
  if (this.viewer != null && this.visitor != null && this.viewer instanceof RepoViewCommonViewer) {
    final Control control=this.viewer.getControl();
    if (control != null && !control.isDisposed()) {
      CommonNavigator commonNavigator=((RepoViewCommonViewer)this.viewer).getCommonNavigator();
      if (commonNavigator instanceof RepoViewCommonNavigator) {
        ((RepoViewCommonNavigator)commonNavigator).removeVisitor(this.visitor);
      }
    }
  }
  topLevelNodeToPathMap.clear();
  topLevelNodeToPathMap=null;
  super.dispose();
}
Program: 127592
Project: 127592
Buggy source:
@Override protected boolean visit(IResourceDelta delta,Collection<Runnable> runnables){
  VisitResourceHelper visitHelper=new VisitResourceHelper(delta);
  boolean merged=ProjectRepositoryNode.getInstance().getMergeRefProject();
  Set<RepositoryNode> topLevelNodes=getTopLevelNodes();
  boolean visitChildren=true;
  for (  final RepositoryNode repoNode : topLevelNodes) {
    IPath topLevelNodeWorkspaceRelativePath=topLevelNodeToPathMap.get(repoNode);
    if (topLevelNodeWorkspaceRelativePath != null && visitHelper.valid(topLevelNodeWorkspaceRelativePath,merged)) {
      visitChildren=false;
      if (viewer instanceof RepoViewCommonViewer) {
        runnables.add(new Runnable(){
          @Override public void run(){
            refreshTopLevelNode(repoNode);
          }
        }
);
      }
    }
  }
  return visitChildren;
}

Fixed version (ground truth):
@Override protected boolean visit(IResourceDelta delta,Collection<Runnable> runnables){
  VisitResourceHelper visitHelper=new VisitResourceHelper(delta);
  boolean merged=ProjectRepositoryNode.getInstance().getMergeRefProject();
  Set<RepositoryNode> topLevelNodes=getTopLevelNodes();
  boolean visitChildren=true;
  for (  final RepositoryNode repoNode : topLevelNodes) {
    IPath topLevelNodeWorkspaceRelativePath=topLevelNodeToPathMap.get(repoNode);
    if (topLevelNodeWorkspaceRelativePath != null && visitHelper.valid(topLevelNodeWorkspaceRelativePath,merged)) {
      visitChildren=false;
      if (viewer instanceof RepoViewCommonViewer) {
        runnables.add(new TopLevelNodeRunnable(repoNode){
          @Override public void run(){
            refreshTopLevelNode(repoNode);
          }
        }
);
      }
    }
  }
  return visitChildren;
}
Program: 127593
Project: 127593
Buggy source:
@Override public void inputChanged(Viewer arg0,Object arg1,Object arg2){
  if (arg0 instanceof CommonViewer) {
    this.viewer=(CommonViewer)arg0;
  }
  super.inputChanged(arg0,arg1,arg2);
  topLevelNodeToPathMap.clear();
  addResourceChangeListener();
}

Fixed version (ground truth):
@Override public void inputChanged(Viewer arg0,Object arg1,Object arg2){
  if (arg0 instanceof CommonViewer) {
    this.viewer=(CommonViewer)arg0;
  }
  super.inputChanged(arg0,arg1,arg2);
  topLevelNodeToPathMap.clear();
  addResourceVisitor(this.viewer);
}
Program: 127594
Project: 127594
Buggy source:
public static String addQuotesWithSpaceField(String fieldName,String dbType){
  if (fieldName == null) {
    fieldName="String_Node_Str";
  }
  if (fieldName.startsWith("String_Node_Str") && fieldName.endsWith("String_Node_Str")) {
    return fieldName;
  }
  boolean b=true;
  for (int i=0; i < fieldName.length(); i++) {
    char c=fieldName.charAt(i);
    b=b && c >= '0' && c <= '9';
  }
  EDatabaseTypeName name=EDatabaseTypeName.getTypeFromDbType(dbType);
  if (name.equals(EDatabaseTypeName.MYSQL) && fieldName.contains(JAVA_END_STRING)) {
    String newFieldName="String_Node_Str" + fieldName + "String_Node_Str";
    return newFieldName;
  }
  boolean isCheck=!CorePlugin.getDefault().getPreferenceStore().getBoolean(ITalendCorePrefConstants.SQL_ADD_QUOTE);
  if (!b) {
    if (isCheck && isPSQLSimilar(name)) {
      return fieldName;
    }
  }
  String newFieldName=fieldName;
  String quote=getQuoteByDBType(name);
  if (!newFieldName.contains(quote)) {
    newFieldName=addQuotes(newFieldName,quote);
  }
  return newFieldName;
}

Fixed version (ground truth):
public static String addQuotesWithSpaceField(String fieldName,String dbType){
  if (fieldName == null) {
    fieldName="String_Node_Str";
  }
  if (fieldName.startsWith("String_Node_Str") && fieldName.endsWith("String_Node_Str")) {
    return fieldName;
  }
  boolean b=true;
  for (int i=0; i < fieldName.length(); i++) {
    char c=fieldName.charAt(i);
    b=b && c >= '0' && c <= '9';
  }
  EDatabaseTypeName name=EDatabaseTypeName.getTypeFromDbType(dbType);
  if (name.equals(EDatabaseTypeName.MYSQL) && fieldName.contains(JAVA_END_STRING)) {
    String newFieldName=TalendQuoteUtils.addQuotes(fieldName);
    return newFieldName;
  }
  boolean isCheck=!CorePlugin.getDefault().getPreferenceStore().getBoolean(ITalendCorePrefConstants.SQL_ADD_QUOTE);
  if (!b) {
    if (isCheck && isPSQLSimilar(name)) {
      return fieldName;
    }
  }
  String newFieldName=fieldName;
  String quote=getQuoteByDBType(name);
  if (!newFieldName.contains(quote)) {
    newFieldName=addQuotes(newFieldName,quote);
  }
  return newFieldName;
}
Program: 127599
Project: 127599
Buggy source:
@Override public void propertyChange(PropertyChangeEvent event){
  if (!event.getPropertyName().equals(ERepositoryActionName.CREATE.getName())) {
    return;
  }
  if (!(event.getNewValue() instanceof ProcessItem) && !(event.getNewValue() instanceof JobletProcessItem)) {
    return;
  }
  final Item item=(Item)event.getNewValue();
  execute(item);
}

Fixed version (ground truth):
@Override public void propertyChange(PropertyChangeEvent event){
  if (!event.getPropertyName().equals(ERepositoryActionName.CREATE.getName()) && !event.getPropertyName().equals(ERepositoryActionName.IMPORT.getName())) {
    return;
  }
  if (!(event.getNewValue() instanceof ProcessItem) && !(event.getNewValue() instanceof JobletProcessItem)) {
    return;
  }
  final Item item=(Item)event.getNewValue();
  execute(item);
}
Program: 127607
Project: 127607
Buggy source:
public static int getJavaTypeBySqlType(String sqlType){
  if (sqlType.trim().equals("String_Node_Str")) {
    return Types.DATE;
  }
 else   if (sqlType.trim().equals("String_Node_Str")) {
    return Types.BIGINT;
  }
 else   if (sqlType.trim().equals("String_Node_Str")) {
    return Types.INTEGER;
  }
 else   if (sqlType.trim().equals("String_Node_Str")) {
    return Types.SMALLINT;
  }
 else   if (sqlType.trim().equals("String_Node_Str")) {
    return Types.FLOAT;
  }
 else   if (sqlType.trim().equals("String_Node_Str")) {
    return Types.CHAR;
  }
 else   if (sqlType.trim().equals("String_Node_Str")) {
    return Types.VARCHAR;
  }
 else   if (sqlType.trim().equals("String_Node_Str")) {
    return Types.DECIMAL;
  }
 else   if (sqlType.trim().equals("String_Node_Str")) {
    return Types.TIME;
  }
 else   if (sqlType.trim().equals("String_Node_Str")) {
    return Types.TIMESTAMP;
  }
 else   if (sqlType.trim().equals("String_Node_Str")) {
    return Types.BLOB;
  }
 else   if (sqlType.trim().equals("String_Node_Str")) {
    return Types.CLOB;
  }
 else   if (sqlType.trim().equals("String_Node_Str")) {
    return Types.DISTINCT;
  }
 else   if (sqlType.trim().equals("String_Node_Str")) {
    return Types.DOUBLE;
  }
 else   if (sqlType.trim().equals("String_Node_Str")) {
    return Types.LONGVARCHAR;
  }
 else   if (sqlType.trim().equals("String_Node_Str")) {
    return Types.REAL;
  }
  return 0;
}

Fixed version (ground truth):
public static int getJavaTypeBySqlType(String sqlType){
  if ("String_Node_Str".equalsIgnoreCase(sqlType.trim())) {
    return Types.DATE;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(sqlType.trim())) {
    return Types.BIGINT;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(sqlType.trim())) {
    return Types.INTEGER;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(sqlType.trim())) {
    return Types.SMALLINT;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(sqlType.trim())) {
    return Types.FLOAT;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(sqlType.trim())) {
    return Types.CHAR;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(sqlType.trim())) {
    return Types.VARCHAR;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(sqlType.trim())) {
    return Types.DECIMAL;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(sqlType.trim())) {
    return Types.TIME;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(sqlType.trim())) {
    return Types.TIMESTAMP;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(sqlType.trim())) {
    return Types.BLOB;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(sqlType.trim())) {
    return Types.CLOB;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(sqlType.trim())) {
    return Types.DISTINCT;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(sqlType.trim())) {
    return Types.DOUBLE;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(sqlType.trim())) {
    return Types.LONGVARCHAR;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(sqlType.trim())) {
    return Types.REAL;
  }
  return 0;
}
Program: 127608
Project: 127608
Buggy source:
protected void editItem(ISelection sel){
  IStructuredSelection selection=(IStructuredSelection)sel;
  String existing=(String)selection.getFirstElement();
  String value=getExistingInputObject(existing);
  if (value != null) {
    int indexOf=list.indexOf(existing);
    list.remove(existing);
    list.add(indexOf,value);
    viewer.refresh();
  }
}

Fixed version (ground truth):
protected void editItem(ISelection sel){
  IStructuredSelection selection=(IStructuredSelection)sel;
  String existing=(String)selection.getFirstElement();
  String value=getExistingInputObject(existing.replace("String_Node_Str","String_Node_Str"));
  if (value != null) {
    int indexOf=list.indexOf(existing);
    list.remove(existing);
    list.add(indexOf,value);
    viewer.refresh();
  }
}
Program: 127611
Project: 127611
Buggy source:
public static String addQuotesWithSpaceField(String fieldName,String dbType){
  if (fieldName == null) {
    fieldName="String_Node_Str";
  }
  if (fieldName.startsWith("String_Node_Str") && fieldName.endsWith("String_Node_Str")) {
    return fieldName;
  }
  boolean b=true;
  for (int i=0; i < fieldName.length(); i++) {
    char c=fieldName.charAt(i);
    b=b && c >= '0' && c <= '9';
  }
  EDatabaseTypeName name=EDatabaseTypeName.getTypeFromDbType(dbType);
  if (name.equals(EDatabaseTypeName.MYSQL) && fieldName.contains(JAVA_END_STRING)) {
    String newFieldName=TalendQuoteUtils.addQuotes(fieldName);
    return newFieldName;
  }
  boolean isCheck=!CorePlugin.getDefault().getPreferenceStore().getBoolean(ITalendCorePrefConstants.SQL_ADD_QUOTE);
  if (!b) {
    if (isCheck && isPSQLSimilar(name)) {
      return fieldName;
    }
  }
  String newFieldName=fieldName;
  String quote=getQuoteByDBType(name);
  if (!newFieldName.contains(quote)) {
    newFieldName=addQuotes(newFieldName,quote);
  }
  return newFieldName;
}

Fixed version (ground truth):
public static String addQuotesWithSpaceField(String fieldName,String dbType){
  if (fieldName == null) {
    fieldName="String_Node_Str";
  }
  if (fieldName.startsWith("String_Node_Str") && fieldName.endsWith("String_Node_Str")) {
    return fieldName;
  }
  boolean b=true;
  for (int i=0; i < fieldName.length(); i++) {
    char c=fieldName.charAt(i);
    b=b && c >= '0' && c <= '9';
  }
  EDatabaseTypeName name=EDatabaseTypeName.getTypeFromDbType(dbType);
  if (name.equals(EDatabaseTypeName.MYSQL) && fieldName.contains(JAVA_END_STRING)) {
    String newFieldName="String_Node_Str" + fieldName + "String_Node_Str";
    return newFieldName;
  }
  boolean isCheck=!CorePlugin.getDefault().getPreferenceStore().getBoolean(ITalendCorePrefConstants.SQL_ADD_QUOTE);
  if (!b) {
    if (isCheck && isPSQLSimilar(name)) {
      return fieldName;
    }
  }
  String newFieldName=fieldName;
  String quote=getQuoteByDBType(name);
  if (!newFieldName.contains(quote)) {
    newFieldName=addQuotes(newFieldName,quote);
  }
  return newFieldName;
}
Program: 127615
Project: 127615
Buggy source:
public static String addQuotesWithSpaceField(String fieldName,String dbType){
  if (fieldName == null) {
    fieldName="String_Node_Str";
  }
  if (fieldName.startsWith("String_Node_Str") && fieldName.endsWith("String_Node_Str")) {
    return fieldName;
  }
  boolean b=true;
  for (int i=0; i < fieldName.length(); i++) {
    char c=fieldName.charAt(i);
    b=b && c >= '0' && c <= '9';
  }
  EDatabaseTypeName name=EDatabaseTypeName.getTypeFromDbType(dbType);
  if (name.equals(EDatabaseTypeName.MYSQL) && fieldName.contains(JAVA_END_STRING)) {
    String newFieldName=TalendQuoteUtils.addQuotes(fieldName);
    return newFieldName;
  }
  boolean isCheck=!CorePlugin.getDefault().getPreferenceStore().getBoolean(ITalendCorePrefConstants.SQL_ADD_QUOTE);
  if (!b) {
    if (isCheck && isPSQLSimilar(name)) {
      return fieldName;
    }
  }
  String newFieldName=fieldName;
  String quote=getQuoteByDBType(name);
  if (!newFieldName.contains(quote)) {
    newFieldName=addQuotes(newFieldName,quote);
  }
  return newFieldName;
}

Fixed version (ground truth):
public static String addQuotesWithSpaceField(String fieldName,String dbType){
  if (fieldName == null) {
    fieldName="String_Node_Str";
  }
  if (fieldName.startsWith("String_Node_Str") && fieldName.endsWith("String_Node_Str")) {
    return fieldName;
  }
  boolean b=true;
  for (int i=0; i < fieldName.length(); i++) {
    char c=fieldName.charAt(i);
    b=b && c >= '0' && c <= '9';
  }
  EDatabaseTypeName name=EDatabaseTypeName.getTypeFromDbType(dbType);
  if (name.equals(EDatabaseTypeName.MYSQL) && fieldName.contains(JAVA_END_STRING)) {
    String newFieldName="String_Node_Str" + fieldName + "String_Node_Str";
    return newFieldName;
  }
  if (name.equals(EDatabaseTypeName.MYSQL) && fieldName.contains(JAVA_END_STRING)) {
    String newFieldName=TalendQuoteUtils.addQuotes(fieldName);
    return newFieldName;
  }
  boolean isCheck=!CorePlugin.getDefault().getPreferenceStore().getBoolean(ITalendCorePrefConstants.SQL_ADD_QUOTE);
  if (!b) {
    if (isCheck && isPSQLSimilar(name)) {
      return fieldName;
    }
  }
  String newFieldName=fieldName;
  String quote=getQuoteByDBType(name);
  if (!newFieldName.contains(quote)) {
    newFieldName=addQuotes(newFieldName,quote);
  }
  return newFieldName;
}
Program: 127619
Project: 127619
Buggy source:
/** 
 * run a ShadowProcess to determined the Metadata.
 */
protected void runShadowProcess(Boolean flag){
  XmlFileConnection connection2=getConnection();
  String tempXmlFilePath=getContextXmlPath(connection2);
  if (tempXmlFilePath == null ? XmlUtil.isXSDFile(connection2.getXmlFilePath()) : XmlUtil.isXSDFile(connection2.getXmlFilePath()) || XmlUtil.isXSDFile(tempXmlFilePath)) {
    refreshMetaDataTable(null,((XmlXPathLoopDescriptor)connection2.getSchema().get(0)).getSchemaTargets(),flag);
    checkFieldsValue();
    return;
  }
  try {
    informationLabel.setText("String_Node_Str" + Messages.getString("String_Node_Str"));
    CsvArray csvArray=ShadowProcessHelper.getCsvArray(getProcessDescription(false),"String_Node_Str");
    if (csvArray == null) {
      informationLabel.setText("String_Node_Str" + Messages.getString("String_Node_Str"));
    }
 else {
      refreshMetaDataTable(csvArray,((XmlXPathLoopDescriptor)connection2.getSchema().get(0)).getSchemaTargets(),flag);
    }
  }
 catch (  CoreException e) {
    if (getParent().getChildren().length == 1) {
      new ErrorDialogWidthDetailArea(getShell(),PID,Messages.getString("String_Node_Str") + "String_Node_Str" + Messages.getString("String_Node_Str"),e.getMessage());
    }
 else {
      new ErrorDialogWidthDetailArea(getShell(),PID,Messages.getString("String_Node_Str"),e.getMessage());
    }
    log.error(Messages.getString("String_Node_Str") + "String_Node_Str" + e.getMessage());
  }
  checkFieldsValue();
}

Fixed version (ground truth):
/** 
 * run a ShadowProcess to determined the Metadata.
 */
protected void runShadowProcess(Boolean flag){
  XmlFileConnection connection2=getConnection();
  String tempXmlFilePath=getContextXmlPath(connection2);
  if (tempXmlFilePath == null ? XmlUtil.isXSDFile(connection2.getXmlFilePath()) : XmlUtil.isXSDFile(connection2.getXmlFilePath()) || XmlUtil.isXSDFile(tempXmlFilePath)) {
    refreshMetaDataTable(null,connection2.getSchema().get(0).getSchemaTargets(),flag);
    checkFieldsValue();
    return;
  }
  try {
    informationLabel.setText("String_Node_Str" + Messages.getString("String_Node_Str"));
    CsvArray csvArray=ShadowProcessHelper.getCsvArray(getProcessDescription(false),"String_Node_Str");
    if (csvArray == null) {
      informationLabel.setText("String_Node_Str" + Messages.getString("String_Node_Str"));
    }
 else {
      refreshMetaDataTable(csvArray,connection2.getSchema().get(0).getSchemaTargets(),flag);
    }
  }
 catch (  CoreException e) {
    if (getParent().getChildren().length == 1) {
      new ErrorDialogWidthDetailArea(getShell(),PID,Messages.getString("String_Node_Str") + "String_Node_Str" + Messages.getString("String_Node_Str"),e.getMessage());
    }
 else {
      new ErrorDialogWidthDetailArea(getShell(),PID,Messages.getString("String_Node_Str"),e.getMessage());
    }
    log.error(Messages.getString("String_Node_Str") + "String_Node_Str" + e.getMessage());
  }
  checkFieldsValue();
}
Program: 127620
Project: 127620
Buggy source:
public void handleEvent(ListenableListEvent event){
  checkFieldsValue();
}

Fixed version (ground truth):
@Override public void handleEvent(ListenableListEvent event){
  checkFieldsValue();
}
Program: 127621
Project: 127621
Buggy source:
/** 
 * Main Fields addControls.
 */
@Override protected void addFieldsListeners(){
  metadataNameText.addModifyListener(new ModifyListener(){
    public void modifyText(    final ModifyEvent e){
      MetadataToolHelper.validateSchema(metadataNameText.getText());
      metadataTable.setLabel(metadataNameText.getText());
      checkFieldsValue();
    }
  }
);
  metadataNameText.addKeyListener(new KeyAdapter(){
    @Override public void keyPressed(    KeyEvent e){
      MetadataToolHelper.checkSchema(getShell(),e);
    }
  }
);
  metadataCommentText.addModifyListener(new ModifyListener(){
    public void modifyText(    final ModifyEvent e){
      metadataTable.setComment(metadataCommentText.getText());
    }
  }
);
  tableEditorView.getMetadataEditor().addAfterOperationListListener(new IListenableListListener(){
    public void handleEvent(    ListenableListEvent event){
      checkFieldsValue();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Main Fields addControls.
 */
@Override protected void addFieldsListeners(){
  metadataNameText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      MetadataToolHelper.validateSchema(metadataNameText.getText());
      metadataTable.setLabel(metadataNameText.getText());
      checkFieldsValue();
    }
  }
);
  metadataNameText.addKeyListener(new KeyAdapter(){
    @Override public void keyPressed(    KeyEvent e){
      MetadataToolHelper.checkSchema(getShell(),e);
    }
  }
);
  metadataCommentText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      metadataTable.setComment(metadataCommentText.getText());
    }
  }
);
  tableEditorView.getMetadataEditor().addAfterOperationListListener(new IListenableListListener(){
    @Override public void handleEvent(    ListenableListEvent event){
      checkFieldsValue();
    }
  }
);
}
Program: 127622
Project: 127622
Buggy source:
public void modifyText(final ModifyEvent e){
  metadataTable.setComment(metadataCommentText.getText());
}

Fixed version (ground truth):
@Override public void modifyText(final ModifyEvent e){
  metadataTable.setComment(metadataCommentText.getText());
}
Program: 127624
Project: 127624
Buggy source:
protected void editItem(ISelection sel){
  IStructuredSelection selection=(IStructuredSelection)sel;
  String existing=(String)selection.getFirstElement();
  String value=getExistingInputObject(existing);
  if (value != null) {
    int indexOf=list.indexOf(existing);
    list.remove(existing);
    list.add(indexOf,value);
    viewer.refresh();
  }
}

Fixed version (ground truth):
protected void editItem(ISelection sel){
  IStructuredSelection selection=(IStructuredSelection)sel;
  String existing=(String)selection.getFirstElement();
  String value=getExistingInputObject(existing.replace("String_Node_Str","String_Node_Str"));
  if (value != null) {
    int indexOf=list.indexOf(existing);
    list.remove(existing);
    list.add(indexOf,value);
    viewer.refresh();
  }
}
Program: 127625
Project: 127625
Buggy source:
protected void doLoadDefault(){
  if (viewer != null) {
    list.clear();
    String s=getPreferenceStore().getDefaultString(getPreferenceName());
    if (s != null && !"String_Node_Str".equals(s)) {
      for (      String tmp : readString(s)) {
        list.add(tmp);
      }
    }
    viewer.setInput(list);
  }
}

Fixed version (ground truth):
@Override protected void doLoadDefault(){
  if (viewer != null) {
    list.clear();
    String s=getPreferenceStore().getDefaultString(getPreferenceName());
    if (s != null && !"String_Node_Str".equals(s)) {
      for (      String tmp : readString(s)) {
        list.add(tmp);
      }
    }
    viewer.setInput(list);
  }
}
Program: 127626
Project: 127626
Buggy source:
protected void doFillIntoGrid(Composite parent,int numColumns){
  Control control=getLabelControl(parent);
  GridData gd=new GridData();
  gd.horizontalSpan=numColumns;
  control.setLayoutData(gd);
  viewer=getTableControl(parent);
  gd=new GridData(GridData.FILL_HORIZONTAL);
  gd.verticalAlignment=GridData.FILL;
  gd.horizontalSpan=numColumns - 1;
  gd.grabExcessHorizontalSpace=true;
  viewer.getTable().setLayoutData(gd);
  buttonBox=getButtonBoxControl(parent);
  gd=new GridData();
  gd.verticalAlignment=GridData.BEGINNING;
  buttonBox.setLayoutData(gd);
}

Fixed version (ground truth):
@Override protected void doFillIntoGrid(Composite parent,int numColumns){
  Control control=getLabelControl(parent);
  GridData gd=new GridData();
  gd.horizontalSpan=numColumns;
  control.setLayoutData(gd);
  viewer=getTableControl(parent);
  gd=new GridData(GridData.FILL_HORIZONTAL);
  gd.verticalAlignment=GridData.FILL;
  gd.horizontalSpan=numColumns - 1;
  gd.grabExcessHorizontalSpace=true;
  viewer.getTable().setLayoutData(gd);
  buttonBox=getButtonBoxControl(parent);
  gd=new GridData();
  gd.verticalAlignment=GridData.BEGINNING;
  buttonBox.setLayoutData(gd);
}
Program: 127627
Project: 127627
Buggy source:
public int getNumberOfControls(){
  return 2;
}

Fixed version (ground truth):
@Override public int getNumberOfControls(){
  return 2;
}