nus-yam/ex-repair huggingface dataset:
Program: 126727
Project: 126727
Buggy source:
private void addGroupRowsToSkip(final Composite mainComposite,final int width,final int height){
  Group group=Form.createGroup(mainComposite,1,Messages.getString("String_Node_Str"),height);
  Composite compositeRowsToSkip=Form.startNewDimensionnedGridLayout(group,3,width - 100,height);
  Label info=new Label(compositeRowsToSkip,SWT.NONE);
  GridData gridData=new GridData();
  gridData.horizontalSpan=3;
  info.setLayoutData(gridData);
  info.setText(Messages.getString("String_Node_Str"));
  rowsToSkipHeaderCheckboxCombo=new LabelledCheckboxCombo(compositeRowsToSkip,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),STRING_NUMBERS_DATA,1,true,SWT.NONE);
  rowsToSkipFooterCheckboxCombo=new LabelledCheckboxCombo(compositeRowsToSkip,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),STRING_NUMBERS_DATA,1,true,SWT.NONE);
}

Fixed version (ground truth):
private void addGroupRowsToSkip(final Composite mainComposite,final int width,final int height){
  Group group=Form.createGroup(mainComposite,1,Messages.getString("String_Node_Str"),height);
  group.setLayout(new FillLayout());
  GridData groupLayoutData=(GridData)group.getLayoutData();
  groupLayoutData.heightHint=-1;
  groupLayoutData.minimumHeight=-1;
  groupLayoutData.minimumWidth=-1;
  groupLayoutData.widthHint=-1;
  groupLayoutData.grabExcessVerticalSpace=false;
  Composite compositeRowsToSkip=Form.startNewDimensionnedGridLayout(group,3,width - 100,height);
  compositeRowsToSkip.setLayoutData(null);
  Label info=new Label(compositeRowsToSkip,SWT.NONE);
  GridData gridData=new GridData();
  gridData.horizontalSpan=3;
  info.setLayoutData(gridData);
  info.setText(Messages.getString("String_Node_Str"));
  rowsToSkipHeaderCheckboxCombo=new LabelledCheckboxCombo(compositeRowsToSkip,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),STRING_NUMBERS_DATA,1,true,SWT.NONE);
  rowsToSkipFooterCheckboxCombo=new LabelledCheckboxCombo(compositeRowsToSkip,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),STRING_NUMBERS_DATA,1,true,SWT.NONE);
  group.pack();
}
Program: 126728
Project: 126728
Buggy source:
/** 
 * add Field to Group File Settings.
 * @param mainComposite
 * @param form
 * @param width
 * @param height
 */
private void addGroupFileSettings(final Composite mainComposite,final int width,final int height){
  Group group=Form.createGroup(mainComposite,2,Messages.getString("String_Node_Str"),height);
  Composite compositeFileDelimitor=Form.startNewDimensionnedGridLayout(group,4,width,height);
  fieldSeparatorText=new LabelledText(compositeFileDelimitor,Messages.getString("String_Node_Str"),3,true,SWT.RIGHT);
  fieldSeparatorText.setToolTipText(Messages.getString("String_Node_Str"));
  String[] rowSeparatorData={RowSeparator.STANDART_EOL_LITERAL.getLiteral(),RowSeparator.CUSTOM_STRING_LITERAL.getLiteral()};
  rowSeparatorCombo=new LabelledCombo(compositeFileDelimitor,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),rowSeparatorData,1,true,SWT.READ_ONLY);
  rowSeparatorText=new LabelledText(compositeFileDelimitor,"String_Node_Str",1,true,SWT.RIGHT);
}

Fixed version (ground truth):
/** 
 * add Field to Group File Settings.
 * @param mainComposite
 * @param form
 * @param width
 * @param height
 */
private void addGroupFileSettings(final Composite mainComposite,final int width,final int height){
  Group group=Form.createGroup(mainComposite,2,Messages.getString("String_Node_Str"),height);
  group.setLayout(new FillLayout());
  GridData groupLayoutData=(GridData)group.getLayoutData();
  groupLayoutData.heightHint=-1;
  groupLayoutData.minimumHeight=-1;
  groupLayoutData.minimumWidth=-1;
  groupLayoutData.widthHint=-1;
  groupLayoutData.grabExcessVerticalSpace=false;
  Composite compositeFileDelimitor=Form.startNewDimensionnedGridLayout(group,4,width,height);
  compositeFileDelimitor.setLayoutData(null);
  fieldSeparatorText=new LabelledText(compositeFileDelimitor,Messages.getString("String_Node_Str"),3,true,SWT.RIGHT);
  fieldSeparatorText.setToolTipText(Messages.getString("String_Node_Str"));
  String[] rowSeparatorData={RowSeparator.STANDART_EOL_LITERAL.getLiteral(),RowSeparator.CUSTOM_STRING_LITERAL.getLiteral()};
  rowSeparatorCombo=new LabelledCombo(compositeFileDelimitor,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),rowSeparatorData,1,true,SWT.READ_ONLY);
  rowSeparatorText=new LabelledText(compositeFileDelimitor,"String_Node_Str",1,true,SWT.RIGHT);
  group.pack();
}
Program: 126729
Project: 126729
Buggy source:
@Override protected void addFields(){
  Composite mainComposite=Form.startNewGridLayout(this,2);
  addGroupFileSettings(mainComposite,400,110);
  addGroupRowsToSkip(mainComposite,300,110);
  addGroupLimit(mainComposite,300,85);
  addGroupFileViewer(this,700,200);
  Composite compositeBottomButton=Form.startNewGridLayout(this,2,false,SWT.CENTER,SWT.CENTER);
  if (!isInWizard()) {
    cancelButton=new UtilsButton(compositeBottomButton,Messages.getString("String_Node_Str"),WIDTH_BUTTON_PIXEL,HEIGHT_BUTTON_PIXEL);
  }
}

Fixed version (ground truth):
@Override protected void addFields(){
  Composite mainComposite=Form.startNewGridLayout(this,2);
  addGroupFileSettings(mainComposite,400,110);
  addGroupRowsToSkip(mainComposite,300,110);
  addGroupLimit(mainComposite,300,85);
  addGroupFileViewer(this,700,200);
  GridLayout mainCompositeLayout=(GridLayout)mainComposite.getLayout();
  mainCompositeLayout.marginBottom=5;
  Composite compositeBottomButton=Form.startNewGridLayout(this,2,false,SWT.CENTER,SWT.CENTER);
  if (!isInWizard()) {
    cancelButton=new UtilsButton(compositeBottomButton,Messages.getString("String_Node_Str"),WIDTH_BUTTON_PIXEL,HEIGHT_BUTTON_PIXEL);
  }
}
Program: 126730
Project: 126730
Buggy source:
/** 
 * add field to Group Limit.
 * @param mainComposite
 * @param form
 * @param width
 * @param height
 */
private void addGroupLimit(final Composite mainComposite,final int width,final int height){
  Group group=Form.createGroup(mainComposite,2,Messages.getString("String_Node_Str"),height);
  Composite compositeLimit=Form.startNewDimensionnedGridLayout(group,3,width,height);
  Label info=new Label(compositeLimit,SWT.NONE);
  GridData gridData=new GridData();
  gridData.horizontalSpan=3;
  info.setLayoutData(gridData);
  info.setText(Messages.getString("String_Node_Str"));
  rowsToSkipLimitCheckboxCombo=new LabelledCheckboxCombo(compositeLimit,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),STRING_NUMBERS_DATA,1,true,SWT.NONE);
}

Fixed version (ground truth):
/** 
 * add field to Group Limit.
 * @param mainComposite
 * @param form
 * @param width
 * @param height
 */
private void addGroupLimit(final Composite mainComposite,final int width,final int height){
  Group group=Form.createGroup(mainComposite,2,Messages.getString("String_Node_Str"),height);
  group.setLayout(new FillLayout());
  GridData groupLayoutData=(GridData)group.getLayoutData();
  groupLayoutData.heightHint=-1;
  groupLayoutData.minimumHeight=-1;
  groupLayoutData.minimumWidth=-1;
  groupLayoutData.widthHint=-1;
  groupLayoutData.grabExcessVerticalSpace=false;
  Composite compositeLimit=Form.startNewDimensionnedGridLayout(group,3,width,height);
  compositeLimit.setLayoutData(null);
  Label info=new Label(compositeLimit,SWT.NONE);
  GridData gridData=new GridData();
  gridData.horizontalSpan=3;
  info.setLayoutData(gridData);
  info.setText(Messages.getString("String_Node_Str"));
  rowsToSkipLimitCheckboxCombo=new LabelledCheckboxCombo(compositeLimit,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),STRING_NUMBERS_DATA,1,true,SWT.NONE);
  group.pack();
}
Program: 126731
Project: 126731
Buggy source:
private void addGroupRowsToSkip(final Composite mainComposite,final int width,final int height){
  Group group=Form.createGroup(mainComposite,1,Messages.getString("String_Node_Str"),height);
  Composite compositeRowsToSkip=Form.startNewDimensionnedGridLayout(group,3,width - 20,height);
  Label info=new Label(compositeRowsToSkip,SWT.NONE);
  GridData gridData=new GridData();
  gridData.horizontalSpan=3;
  info.setLayoutData(gridData);
  info.setText(Messages.getString("String_Node_Str"));
  rowsToSkipHeaderCheckboxCombo=new LabelledCheckboxCombo(compositeRowsToSkip,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),STRING_NUMBERS_DATA,1,true,SWT.NONE);
  rowsToSkipFooterCheckboxCombo=new LabelledCheckboxCombo(compositeRowsToSkip,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),STRING_NUMBERS_DATA,1,true,SWT.NONE);
  emptyRowsToSkipCheckbox=new Button(compositeRowsToSkip,SWT.CHECK);
  emptyRowsToSkipCheckbox.setText(Messages.getString("String_Node_Str"));
  emptyRowsToSkipCheckbox.setAlignment(SWT.LEFT);
  gridData=new GridData(SWT.FILL,SWT.BOTTOM,true,false);
  gridData.horizontalSpan=3;
  emptyRowsToSkipCheckbox.setLayoutData(gridData);
}

Fixed version (ground truth):
private void addGroupRowsToSkip(final Composite mainComposite,final int width,final int height){
  Group group=Form.createGroup(mainComposite,1,Messages.getString("String_Node_Str"),height);
  group.setLayout(new FillLayout());
  GridData groupLayoutData=(GridData)group.getLayoutData();
  groupLayoutData.heightHint=-1;
  groupLayoutData.minimumHeight=-1;
  groupLayoutData.minimumWidth=-1;
  groupLayoutData.widthHint=-1;
  groupLayoutData.grabExcessVerticalSpace=false;
  Composite compositeRowsToSkip=Form.startNewDimensionnedGridLayout(group,3,width - 20,height);
  compositeRowsToSkip.setLayoutData(null);
  Label info=new Label(compositeRowsToSkip,SWT.NONE);
  GridData gridData=new GridData();
  gridData.horizontalSpan=3;
  info.setLayoutData(gridData);
  info.setText(Messages.getString("String_Node_Str"));
  rowsToSkipHeaderCheckboxCombo=new LabelledCheckboxCombo(compositeRowsToSkip,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),STRING_NUMBERS_DATA,1,true,SWT.NONE);
  rowsToSkipFooterCheckboxCombo=new LabelledCheckboxCombo(compositeRowsToSkip,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),STRING_NUMBERS_DATA,1,true,SWT.NONE);
  emptyRowsToSkipCheckbox=new Button(compositeRowsToSkip,SWT.CHECK);
  emptyRowsToSkipCheckbox.setText(Messages.getString("String_Node_Str"));
  emptyRowsToSkipCheckbox.setAlignment(SWT.LEFT);
  gridData=new GridData(SWT.FILL,SWT.BOTTOM,true,false);
  gridData.horizontalSpan=3;
  emptyRowsToSkipCheckbox.setLayoutData(gridData);
  group.pack();
}
Program: 126735
Project: 126735
Buggy source:
@Override public void setVisible(boolean visible){
  super.setVisible(visible);
  if (isReadOnly() != readOnly) {
    adaptFormToReadOnly();
  }
  if (visible) {
    initialize();
    adaptFormToEditable();
  }
  if (!isContextMode()) {
    checkFieldsValue();
    setCheckEnable();
  }
}

Fixed version (ground truth):
@Override public void setVisible(boolean visible){
  super.setVisible(visible);
  if (isReadOnly() != readOnly) {
    adaptFormToReadOnly();
  }
  if (visible) {
    initialize();
    adaptFormToEditable();
    collectContextParams(visible);
  }
  if (!isContextMode()) {
    checkFieldsValue();
    setCheckEnable();
  }
}
Program: 126737
Project: 126737
Buggy source:
/** 
 * Test filling catalogs for odbc teredata .
 * @throws SQLException
 */
@Test public void testFillCatalogs_OdbcTeradata() throws SQLException {
  DatabaseMetaData dbJDBCMetadata=mock(DatabaseMetaData.class);
  when(dbJDBCMetadata.getDatabaseProductName()).thenReturn("String_Node_Str");
  stub(method(ConnectionUtils.class,"String_Node_Str",DatabaseMetaData.class)).toReturn(true);
  List<String> catalogFilter=new ArrayList<String>();
  Connection connection=mock(Connection.class);
  when(connection.isContextMode()).thenReturn(false);
  List<Catalog> fillCatalogs=this.dBConnectionFillerImpl.fillCatalogs(connection,dbJDBCMetadata,catalogFilter);
  assertTrue(fillCatalogs.isEmpty());
}

Fixed version (ground truth):
/** 
 * Test filling catalogs for odbc teredata .
 * @throws SQLException
 */
@Test public void testFillCatalogs_OdbcTeradata() throws SQLException {
  DatabaseMetaData dbJDBCMetadata=mock(DatabaseMetaData.class);
  when(dbJDBCMetadata.getDatabaseProductName()).thenReturn("String_Node_Str");
  stub(method(ConnectionUtils.class,"String_Node_Str",DatabaseMetaData.class)).toReturn(true);
  List<String> catalogFilter=new ArrayList<String>();
  DatabaseConnection dbConnection=mock(DatabaseConnection.class);
  when(dbConnection.isContextMode()).thenReturn(false);
  List<Catalog> fillCatalogs=this.dBConnectionFillerImpl.fillCatalogs(dbConnection,dbJDBCMetadata,catalogFilter);
  assertTrue(fillCatalogs.isEmpty());
}
Program: 126739
Project: 126739
Buggy source:
/** 
 * fill the catalog and schemas into Postgresql database connection.
 * @param dbConn
 * @param dbJDBCMetadata
 * @param catalogList
 * @return
 */
private List<Catalog> fillPostgresqlCatalogs(IMetadataConnection metaConnection,Connection dbConn,DatabaseMetaData dbJDBCMetadata,List<Catalog> catalogList){
  DatabaseConnection databaseConnection=(DatabaseConnection)dbConn;
  String catalogName=databaseConnection.getSID();
  if (StringUtils.isEmpty(catalogName)) {
    catalogName=databaseConnection.getUsername();
  }
  if (StringUtils.isNotEmpty(catalogName)) {
    List<String> filterList=new ArrayList<String>();
    filterList.addAll(postFillCatalog(metaConnection,catalogList,filterList,TalendCWMService.getReadableName(dbConn,catalogName),dbConn));
    for (    Catalog catalog : catalogList) {
      List<Schema> schemaList=new ArrayList<Schema>();
      try {
        schemaList=fillSchemaToCatalog(dbConn,dbJDBCMetadata,catalog,filterList);
        if (!schemaList.isEmpty() && schemaList.size() > 0) {
          CatalogHelper.addSchemas(schemaList,catalog);
        }
      }
 catch (      Throwable e) {
        log.info(e);
      }
      ConnectionHelper.addCatalog(catalog,dbConn);
    }
  }
  return catalogList;
}

Fixed version (ground truth):
/** 
 * fill the catalog and schemas into Postgresql database connection.
 * @param dbConn
 * @param dbJDBCMetadata
 * @param catalogList
 * @return
 */
private List<Catalog> fillPostgresqlCatalogs(IMetadataConnection metaConnection,DatabaseConnection dbConn,DatabaseMetaData dbJDBCMetadata,List<Catalog> catalogList){
  String catalogName=dbConn.getSID();
  if (StringUtils.isEmpty(catalogName)) {
    catalogName=dbConn.getUsername();
  }
  if (StringUtils.isNotEmpty(catalogName)) {
    List<String> filterList=new ArrayList<String>();
    filterList.addAll(postFillCatalog(metaConnection,catalogList,filterList,TalendCWMService.getReadableName(dbConn,catalogName),dbConn));
    for (    Catalog catalog : catalogList) {
      List<Schema> schemaList=new ArrayList<Schema>();
      try {
        schemaList=fillSchemaToCatalog(dbConn,dbJDBCMetadata,catalog,filterList);
        if (!schemaList.isEmpty() && schemaList.size() > 0) {
          CatalogHelper.addSchemas(schemaList,catalog);
        }
      }
 catch (      Throwable e) {
        log.info(e);
      }
      ConnectionHelper.addCatalog(catalog,dbConn);
    }
  }
  return catalogList;
}
Program: 126743
Project: 126743
Buggy source:
/** 
 * zshen Comment method "fillUIConnParams".
 * @param metadataBean sotre information of the connection which you will get.
 * @param connection which you want to be fill Connection.
 * @return connection which have be fill by the information store on the metadataBean.null when the information isnot right or the parameter of connection is null;
 */
public Connection fillUIConnParams(IMetadataConnection metadataBean,Connection connection);

Fixed version (ground truth):
/** 
 * zshen Comment method "fillUIConnParams".
 * @param metadataBean sotre information of the connection which you will get.
 * @param connection which you want to be fill Connection.
 * @return connection which have be fill by the information store on the metadataBean.null when the information isnot right or the parameter of connection is null;
 */
public T fillUIConnParams(IMetadataConnection metadataBean,T connection);
Program: 126744
Project: 126744
Buggy source:
public List<Catalog> fillCatalogs(Connection dbConn,DatabaseMetaData dbJDBCMetadata,IMetadataConnection metaConnection,List<String> catalogFilter);

Fixed version (ground truth):
public List<Catalog> fillCatalogs(T dbConn,DatabaseMetaData dbJDBCMetadata,IMetadataConnection metaConnection,List<String> catalogFilter);
Program: 126745
Project: 126745
Buggy source:
/** 
 * DOC mzhao Fill catalog with schema children.
 * @param dbConn
 * @param dbJDBCMetadata
 * @param catalog
 * @param schemaFilter
 * @return
 * @throws Throwable
 */
public List<Schema> fillSchemaToCatalog(Connection dbConn,DatabaseMetaData dbJDBCMetadata,Catalog catalog,List<String> schemaFilter) throws Throwable ;

Fixed version (ground truth):
/** 
 * DOC mzhao Fill catalog with schema children.
 * @param dbConn
 * @param dbJDBCMetadata
 * @param catalog
 * @param schemaFilter
 * @return
 * @throws Throwable
 */
public List<Schema> fillSchemaToCatalog(T dbConn,DatabaseMetaData dbJDBCMetadata,Catalog catalog,List<String> schemaFilter) throws Throwable ;
Program: 126746
Project: 126746
Buggy source:
public List<Package> fillSchemas(Connection dbConn,DatabaseMetaData dbJDBCMetadata,IMetadataConnection metaConnection,List<String> Filter);

Fixed version (ground truth):
public List<Package> fillSchemas(T dbConn,DatabaseMetaData dbJDBCMetadata,IMetadataConnection metaConnection,List<String> Filter);
Program: 126750
Project: 126750
Buggy source:
@Override public boolean canModify(Object element,String property){
  if (element instanceof IMetadataColumn) {
    IMetadataColumn column=(IMetadataColumn)element;
    if (column.isReadOnly() || (column.isCustom() && property.equals(AbstractMetadataTableEditorView.ID_COLUMN_NAME))) {
      return false;
    }
  }
  return super.canModify(element,property);
}

Fixed version (ground truth):
@Override public boolean canModify(Object element,String property){
  if (element instanceof IMetadataColumn) {
    IMetadataColumn column=(IMetadataColumn)element;
    if (column.isReadOnly()) {
      return false;
    }
    if (column.isCustom()) {
      if (property.equals(AbstractMetadataTableEditorView.ID_COLUMN_NAME)) {
        return false;
      }
 else {
        return true;
      }
    }
  }
  return super.canModify(element,property);
}
Program: 126751
Project: 126751
Buggy source:
@Override public Color getBackground(Object element,int columnIndex){
  if (!(element instanceof IMetadataColumn)) {
    return null;
  }
  IMetadataColumn column=(IMetadataColumn)element;
  TableViewerCreatorColumnNotModifiable tableColumn=(TableViewerCreatorColumnNotModifiable)tableViewerCreator.getColumns().get(columnIndex);
  if (column.isCustom()) {
    if (column.isReadOnly() || readOnly || tableColumn.getId().equals(AbstractMetadataTableEditorView.ID_COLUMN_NAME)) {
      return CELL_READ_ONLY_COLOR;
    }
 else {
      return CUSTOM_CELL_BG_COLOR;
    }
  }
  if (column.isReadOnly()) {
    return TABLE_READ_ONLY_COLOR;
  }
  if (tableEditorView.isShowTalendTypeColumn() && tableEditorView.getCurrentDbms() != null) {
    if (tableColumn.getId().equals(AbstractMetadataTableEditorView.ID_COLUMN_DBTYPE) && !"String_Node_Str".equals(column.getType()) && !TypesManager.checkDBType(tableEditorView.getCurrentDbms(),column.getTalendType(),column.getType())) {
      return CELL_WRONG_DB_TYPE_COLOR;
    }
  }
  return super.getBackground(element,columnIndex);
}

Fixed version (ground truth):
@Override public Color getBackground(Object element,int columnIndex){
  if (!(element instanceof IMetadataColumn)) {
    return null;
  }
  IMetadataColumn column=(IMetadataColumn)element;
  TableViewerCreatorColumnNotModifiable tableColumn=(TableViewerCreatorColumnNotModifiable)tableViewerCreator.getColumns().get(columnIndex);
  if (column.isCustom()) {
    if (column.isReadOnly() || tableColumn.getId().equals(AbstractMetadataTableEditorView.ID_COLUMN_NAME)) {
      return CELL_READ_ONLY_COLOR;
    }
 else {
      return CUSTOM_CELL_BG_COLOR;
    }
  }
  if (column.isReadOnly()) {
    return TABLE_READ_ONLY_COLOR;
  }
  if (tableEditorView.isShowTalendTypeColumn() && tableEditorView.getCurrentDbms() != null) {
    if (tableColumn.getId().equals(AbstractMetadataTableEditorView.ID_COLUMN_DBTYPE) && !"String_Node_Str".equals(column.getType()) && !TypesManager.checkDBType(tableEditorView.getCurrentDbms(),column.getTalendType(),column.getType())) {
      return CELL_WRONG_DB_TYPE_COLOR;
    }
  }
  return super.getBackground(element,columnIndex);
}
Program: 126753
Project: 126753
Buggy source:
public void widgetDefaultSelected(SelectionEvent e){
}

Fixed version (ground truth):
@Override public void widgetDefaultSelected(SelectionEvent e){
}
Program: 126755
Project: 126755
Buggy source:
public void widgetSelected(SelectionEvent e){
  MetadataToolHelper.copyTable(table,linkedTable);
  linkedTableEditorView.getTableViewerCreator().refresh();
  if (linkedTableEditorView != null) {
    linkedTableEditorView.getTableViewerCreator().getTableViewer().refresh();
  }
}

Fixed version (ground truth):
@Override public void widgetSelected(SelectionEvent e){
  MetadataToolHelper.copyTable(table,linkedTable);
  linkedTableEditorView.getTableViewerCreator().refresh();
  if (linkedTableEditorView != null) {
    linkedTableEditorView.getTableViewerCreator().getTableViewer().refresh();
  }
}
Program: 126756
Project: 126756
Buggy source:
public void selectionChanged(SelectionChangedEvent event){
  updateToolBarButtonsOnSelection(event.getSelection(),tableEditorView,table,linkedTableEditorView,linkedTable,readOnly);
}

Fixed version (ground truth):
@Override public void selectionChanged(SelectionChangedEvent event){
  updateToolBarButtonsOnSelection(event.getSelection(),tableEditorView,table,linkedTableEditorView,linkedTable,readOnly);
}
Program: 126757
Project: 126757
Buggy source:
@Override public boolean canModify(Object element,String property){
  if (element instanceof IMetadataColumn) {
    IMetadataColumn column=(IMetadataColumn)element;
    if (column.isReadOnly() || (column.isCustom() && property.equals(AbstractMetadataTableEditorView.ID_COLUMN_NAME))) {
      return false;
    }
  }
  return super.canModify(element,property);
}

Fixed version (ground truth):
@Override public boolean canModify(Object element,String property){
  if (element instanceof IMetadataColumn) {
    IMetadataColumn column=(IMetadataColumn)element;
    if (column.isReadOnly()) {
      return false;
    }
    if (column.isCustom()) {
      if (property.equals(AbstractMetadataTableEditorView.ID_COLUMN_NAME)) {
        return false;
      }
 else {
        return true;
      }
    }
  }
  return super.canModify(element,property);
}
Program: 126758
Project: 126758
Buggy source:
@Override public Color getBackground(Object element,int columnIndex){
  if (!(element instanceof IMetadataColumn)) {
    return null;
  }
  IMetadataColumn column=(IMetadataColumn)element;
  TableViewerCreatorColumnNotModifiable tableColumn=(TableViewerCreatorColumnNotModifiable)tableViewerCreator.getColumns().get(columnIndex);
  if (column.isCustom()) {
    if (column.isReadOnly() || readOnly || tableColumn.getId().equals(AbstractMetadataTableEditorView.ID_COLUMN_NAME)) {
      return CELL_READ_ONLY_COLOR;
    }
 else {
      return CUSTOM_CELL_BG_COLOR;
    }
  }
  if (column.isReadOnly()) {
    return TABLE_READ_ONLY_COLOR;
  }
  if (tableEditorView.isShowTalendTypeColumn() && tableEditorView.getCurrentDbms() != null) {
    if (tableColumn.getId().equals(AbstractMetadataTableEditorView.ID_COLUMN_DBTYPE) && !"String_Node_Str".equals(column.getType()) && !TypesManager.checkDBType(tableEditorView.getCurrentDbms(),column.getTalendType(),column.getType())) {
      return CELL_WRONG_DB_TYPE_COLOR;
    }
  }
  return super.getBackground(element,columnIndex);
}

Fixed version (ground truth):
@Override public Color getBackground(Object element,int columnIndex){
  if (!(element instanceof IMetadataColumn)) {
    return null;
  }
  IMetadataColumn column=(IMetadataColumn)element;
  TableViewerCreatorColumnNotModifiable tableColumn=(TableViewerCreatorColumnNotModifiable)tableViewerCreator.getColumns().get(columnIndex);
  if (column.isCustom()) {
    if (column.isReadOnly() || tableColumn.getId().equals(AbstractMetadataTableEditorView.ID_COLUMN_NAME)) {
      return CELL_READ_ONLY_COLOR;
    }
 else {
      return CUSTOM_CELL_BG_COLOR;
    }
  }
  if (column.isReadOnly()) {
    return TABLE_READ_ONLY_COLOR;
  }
  if (tableEditorView.isShowTalendTypeColumn() && tableEditorView.getCurrentDbms() != null) {
    if (tableColumn.getId().equals(AbstractMetadataTableEditorView.ID_COLUMN_DBTYPE) && !"String_Node_Str".equals(column.getType()) && !TypesManager.checkDBType(tableEditorView.getCurrentDbms(),column.getTalendType(),column.getType())) {
      return CELL_WRONG_DB_TYPE_COLOR;
    }
  }
  return super.getBackground(element,columnIndex);
}
Program: 126763
Project: 126763
Buggy source:
public java.util.List<LogCatcherMessage> getMessages(){
  java.util.List<LogCatcherMessage> messagesToSend=new java.util.ArrayList<LogCatcherMessage>();
synchronized (messages) {
    for (    LogCatcherMessage lcm : messages) {
      messagesToSend.add(lcm);
    }
    messages.clear();
  }
  return messagesToSend;
}

Fixed version (ground truth):
public java.util.List<LogCatcherMessage> getMessages(){
  java.util.List<LogCatcherMessage> messagesToSend=new java.util.ArrayList<LogCatcherMessage>();
synchronized (messages) {
    for (int index=0; index < messages.size(); index++) {
      LogCatcherMessage lcm=messages.get(index);
      if (Thread.currentThread().getId() == lcm.getThreadId()) {
        messagesToSend.add(lcm);
        messages.remove(index);
      }
    }
  }
  return messagesToSend;
}
Program: 126764
Project: 126764
Buggy source:
public LogCatcherMessage(String type,String origin,int priority,String message,int code){
  this.type=type;
  this.origin=origin;
  this.priority=priority;
  this.message=message;
  this.code=code;
}

Fixed version (ground truth):
public LogCatcherMessage(String type,String origin,int priority,String message,int code){
  this.type=type;
  this.origin=origin;
  this.priority=priority;
  this.message=message;
  this.code=code;
  this.threadId=Thread.currentThread().getId();
}
Program: 126766
Project: 126766
Buggy source:
public java.util.List<LogCatcherMessage> getMessages(){
  java.util.List<LogCatcherMessage> messagesToSend=new java.util.ArrayList<LogCatcherMessage>();
synchronized (messages) {
    for (int index=0; index < messages.size(); index++) {
      LogCatcherMessage lcm=messages.get(index);
      if (Thread.currentThread().getId() == lcm.getThreadId()) {
        messagesToSend.add(lcm);
        messages.remove(index);
      }
    }
    if (messages.size() == 0) {
      messages.clear();
    }
  }
  return messagesToSend;
}

Fixed version (ground truth):
public java.util.List<LogCatcherMessage> getMessages(){
  java.util.List<LogCatcherMessage> messagesToSend=new java.util.ArrayList<LogCatcherMessage>();
synchronized (messages) {
    for (int index=0; index < messages.size(); index++) {
      LogCatcherMessage lcm=messages.get(index);
      if (Thread.currentThread().getId() == lcm.getThreadId()) {
        messagesToSend.add(lcm);
        messages.remove(index);
      }
    }
  }
  return messagesToSend;
}
Program: 126769
Project: 126769
Buggy source:
public java.util.List<LogCatcherMessage> getMessages(){
  java.util.List<LogCatcherMessage> messagesToSend=new java.util.ArrayList<LogCatcherMessage>();
synchronized (messages) {
    for (    LogCatcherMessage lcm : messages) {
      messagesToSend.add(lcm);
    }
    messages.clear();
  }
  return messagesToSend;
}

Fixed version (ground truth):
public java.util.List<LogCatcherMessage> getMessages(){
  java.util.List<LogCatcherMessage> messagesToSend=new java.util.ArrayList<LogCatcherMessage>();
synchronized (messages) {
    for (int index=0; index < messages.size(); index++) {
      LogCatcherMessage lcm=messages.get(index);
      if (Thread.currentThread().getId() == lcm.getThreadId()) {
        messagesToSend.add(lcm);
        messages.remove(index);
      }
    }
  }
  return messagesToSend;
}
Program: 126770
Project: 126770
Buggy source:
public LogCatcherMessage(String type,String origin,int priority,String message,int code){
  this.type=type;
  this.origin=origin;
  this.priority=priority;
  this.message=message;
  this.code=code;
}

Fixed version (ground truth):
public LogCatcherMessage(String type,String origin,int priority,String message,int code){
  this.type=type;
  this.origin=origin;
  this.priority=priority;
  this.message=message;
  this.code=code;
  this.threadId=Thread.currentThread().getId();
}
Program: 126771
Project: 126771
Buggy source:
public void closeConnection(boolean force){
  try {
    if (conn != null && !conn.isClosed()) {
      if (isReconnect || force) {
        if (conn.getMetaData() != null) {
          String url=conn.getMetaData().getURL();
          boolean isHsql=ConnectionUtils.isHsql(url);
          if (isHsql && !ConnectionUtils.isServerModeHsql(url)) {
            ConnectionUtils.executeShutDownForHSQL(conn);
          }
        }
        conn.close();
      }
    }
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
catch (  Exception e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public void closeConnection(boolean force){
  try {
    if (conn != null && !conn.isClosed()) {
      if (isReconnect || force) {
        if (conn.getMetaData() != null) {
          String url=conn.getMetaData().getURL();
          boolean isInProcessModeHsql=ConnectionUtils.isInProcessModeHsql(url);
          if (isInProcessModeHsql) {
            ConnectionUtils.executeShutDownForHSQL(conn);
          }
        }
        conn.close();
      }
    }
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
catch (  Exception e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
}
Program: 126773
Project: 126773
Buggy source:
public java.util.List<LogCatcherMessage> getMessages(){
  java.util.List<LogCatcherMessage> messagesToSend=new java.util.ArrayList<LogCatcherMessage>();
synchronized (messages) {
    for (    LogCatcherMessage lcm : messages) {
      messagesToSend.add(lcm);
    }
    messages.clear();
  }
  return messagesToSend;
}

Fixed version (ground truth):
public java.util.List<LogCatcherMessage> getMessages(){
  java.util.List<LogCatcherMessage> messagesToSend=new java.util.ArrayList<LogCatcherMessage>();
synchronized (messages) {
    for (int index=0; index < messages.size(); index++) {
      LogCatcherMessage lcm=messages.get(index);
      if (Thread.currentThread().getId() == lcm.getThreadId()) {
        messagesToSend.add(lcm);
        messages.remove(index);
      }
    }
    if (messages.size() == 0) {
      messages.clear();
    }
  }
  return messagesToSend;
}
Program: 126774
Project: 126774
Buggy source:
public LogCatcherMessage(String type,String origin,int priority,String message,int code){
  this.type=type;
  this.origin=origin;
  this.priority=priority;
  this.message=message;
  this.code=code;
}

Fixed version (ground truth):
public LogCatcherMessage(String type,String origin,int priority,String message,int code){
  this.type=type;
  this.origin=origin;
  this.priority=priority;
  this.message=message;
  this.code=code;
  this.threadId=Thread.currentThread().getId();
}
Program: 126776
Project: 126776
Buggy source:
public void closeConnection(boolean force){
  try {
    if (conn != null && !conn.isClosed()) {
      if (isReconnect || force) {
        if (conn.getMetaData() != null) {
          String url=conn.getMetaData().getURL();
          boolean isHsql=ConnectionUtils.isHsql(url);
          if (isHsql && !ConnectionUtils.isServerModeHsql(url)) {
            ConnectionUtils.executeShutDownForHSQL(conn);
          }
        }
        conn.close();
      }
    }
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
catch (  Exception e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public void closeConnection(boolean force){
  try {
    if (conn != null && !conn.isClosed()) {
      if (isReconnect || force) {
        if (conn.getMetaData() != null) {
          String url=conn.getMetaData().getURL();
          boolean isInProcessModeHsql=ConnectionUtils.isInProcessModeHsql(url);
          if (isInProcessModeHsql) {
            ConnectionUtils.executeShutDownForHSQL(conn);
          }
        }
        conn.close();
      }
    }
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
catch (  Exception e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
}
Program: 126782
Project: 126782
Buggy source:
/** 
 * Create an instance of this class.
 * @param filename java.lang.String
 * @param compress boolean
 * @exception java.io.IOException
 */
public ZipFileExporterFullPath(String filename,boolean compress) throws IOException {
  outputStream=new ZipOutputStream(new FileOutputStream(filename));
  outputStream.setEncoding("String_Node_Str");
  useCompression=compress;
}

Fixed version (ground truth):
/** 
 * Create an instance of this class.
 * @param filename java.lang.String
 * @param compress boolean
 * @exception java.io.IOException
 */
public ZipFileExporterFullPath(String filename,boolean compress) throws IOException {
  outputStream=new ZipOutputStream(new FileOutputStream(filename));
  useCompression=compress;
}
Program: 126784
Project: 126784
Buggy source:
/** 
 * Create an instance of this class.
 * @param filename java.lang.String
 * @param compress boolean
 * @exception java.io.IOException
 */
public ZipFileExporterFullPath(String filename,boolean compress) throws IOException {
  outputStream=new ZipOutputStream(new FileOutputStream(filename));
  outputStream.setEncoding("String_Node_Str");
  useCompression=compress;
}

Fixed version (ground truth):
/** 
 * Create an instance of this class.
 * @param filename java.lang.String
 * @param compress boolean
 * @exception java.io.IOException
 */
public ZipFileExporterFullPath(String filename,boolean compress) throws IOException {
  outputStream=new ZipOutputStream(new FileOutputStream(filename));
  useCompression=compress;
}
Program: 126787
Project: 126787
Buggy source:
@Override public void undo(){
  List<IContext> removeList=new ArrayList<IContext>();
  for (  IContext con : manager.getListContext()) {
    if (nameSet.contains(con.getName())) {
      removeList.add(con);
    }
  }
  manager.getListContext().removeAll(removeList);
  for (  ContextParameterType defaultContextParamType : newAddParameter) {
    ContextItem contextItem=(ContextItem)helper.getParentContextItem(defaultContextParamType);
    if (contextItem == null) {
      continue;
    }
    IContextParameter paramExisted=helper.getExistedContextParameter(defaultContextParamType.getName());
    if (paramExisted != null) {
      new ContextRemoveParameterCommand(manager,defaultContextParamType.getName(),paramExisted.getSource()).execute();
    }
  }
  helper.refreshContextView();
}

Fixed version (ground truth):
@Override public void undo(){
  List<IContext> removeList=new ArrayList<IContext>();
  for (  IContext con : manager.getListContext()) {
    if (nameSet.contains(con.getName())) {
      removeList.add(con);
    }
  }
  manager.getListContext().removeAll(removeList);
  cmds.clear();
  for (  ContextParameterType defaultContextParamType : newAddParameter) {
    ContextItem contextItem=(ContextItem)helper.getParentContextItem(defaultContextParamType);
    if (contextItem == null) {
      continue;
    }
    IContextParameter paramExisted=helper.getExistedContextParameter(defaultContextParamType.getName());
    if (paramExisted != null) {
      ContextRemoveParameterCommand contextRemoveParameterCommand=new ContextRemoveParameterCommand(manager,defaultContextParamType.getName(),paramExisted.getSource());
      contextRemoveParameterCommand.execute();
      cmds.add(contextRemoveParameterCommand);
    }
  }
  helper.refreshContextView();
}
Program: 126788
Project: 126788
Buggy source:
@Override public void redo(){
  execute();
  helper.refreshContextView();
}

Fixed version (ground truth):
@Override public void redo(){
  for (  ContextRemoveParameterCommand cmd : cmds) {
    if (cmd.canUndo()) {
      cmd.undo();
    }
  }
  List<IContext> removeList=new ArrayList<IContext>();
  for (  IContext con : manager.getListContext()) {
    if (nameSet.contains(con.getName())) {
      removeList.add(con);
    }
  }
  manager.getListContext().addAll(removeList);
  helper.refreshContextView();
}
Program: 126789
Project: 126789
Buggy source:
@Override public void initializeDefaultPreferences(){
}

Fixed version (ground truth):
@Override public void initializeDefaultPreferences(){
  CoreUIPlugin.getDefault().getPreferenceStore().setDefault(ITalendCorePrefConstants.AS400_SQL_SEG,true);
}
Program: 126791
Project: 126791
Buggy source:
public void refreshContextView(){
  IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  IViewPart view=page.findView(AbstractContextView.CTX_ID_DESIGNER);
  if (view instanceof AbstractContextView) {
    ((AbstractContextView)view).updateContextView(true);
  }
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ITdqUiService.class)) {
    ITdqUiService tdqUiService=(ITdqUiService)GlobalServiceRegister.getDefault().getService(ITdqUiService.class);
    if (tdqUiService != null) {
      tdqUiService.updateContextView(true);
    }
  }
}

Fixed version (ground truth):
public void refreshContextView(){
  IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  IViewPart view=page.findView(AbstractContextView.CTX_ID_DESIGNER);
  if (view instanceof AbstractContextView) {
    ((AbstractContextView)view).updateContextView(true,false,false);
  }
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ITdqUiService.class)) {
    ITdqUiService tdqUiService=(ITdqUiService)GlobalServiceRegister.getDefault().getService(ITdqUiService.class);
    if (tdqUiService != null) {
      tdqUiService.updateContextView(true,false,false);
    }
  }
}
Program: 126794
Project: 126794
Buggy source:
public void refreshContextView(){
  IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  IViewPart view=page.findView(AbstractContextView.CTX_ID_DESIGNER);
  if (view instanceof AbstractContextView) {
    ((AbstractContextView)view).updateContextView(true,false,false);
  }
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ITdqUiService.class)) {
    ITdqUiService tdqUiService=(ITdqUiService)GlobalServiceRegister.getDefault().getService(ITdqUiService.class);
    if (tdqUiService != null) {
      tdqUiService.updateContextView(true,false,false);
    }
  }
}

Fixed version (ground truth):
public void refreshContextView(){
  IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  IViewPart view=page.findView(AbstractContextView.CTX_ID_DESIGNER);
  if (view instanceof AbstractContextView) {
    ((AbstractContextView)view).updateContextView(true);
  }
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ITdqUiService.class)) {
    ITdqUiService tdqUiService=(ITdqUiService)GlobalServiceRegister.getDefault().getService(ITdqUiService.class);
    if (tdqUiService != null) {
      tdqUiService.updateContextView(true);
    }
  }
}
Program: 126795
Project: 126795
Buggy source:
@Override public void undo(){
  boolean found;
  List<IContextParameter> listParams;
  for (int i=0; i < contextManager.getListContext().size(); i++) {
    listParams=contextManager.getListContext().get(i).getContextParameterList();
    found=false;
    for (int j=0; j < listParams.size() && !found; j++) {
      IContextParameter contextParameter=listParams.get(j);
      String name=contextParameter.getName();
      String tempSourceId=contextParameter.getSource();
      if (name.equals(newName) && tempSourceId.equals(sourceId)) {
        contextParameter.setName(oldName);
        String scriptCode=contextParameter.getScriptCode().replaceAll(newName,oldName);
        contextParameter.setScriptCode(scriptCode);
        if (contextParameter.getPrompt().equals(newName + "String_Node_Str")) {
          contextParameter.setPrompt(oldName + "String_Node_Str");
        }
        found=true;
      }
    }
  }
  this.helper.refreshContextView();
}

Fixed version (ground truth):
@Override public void undo(){
  boolean found;
  List<IContextParameter> listParams;
  for (int i=0; i < contextManager.getListContext().size(); i++) {
    listParams=contextManager.getListContext().get(i).getContextParameterList();
    found=false;
    for (int j=0; j < listParams.size() && !found; j++) {
      IContextParameter contextParameter=listParams.get(j);
      String name=contextParameter.getName();
      String tempSourceId=contextParameter.getSource();
      if (name.equals(newName) && tempSourceId.equals(sourceId)) {
        contextParameter.setName(oldName);
        String scriptCode=contextParameter.getScriptCode().replaceAll(newName,oldName);
        contextParameter.setScriptCode(scriptCode);
        if (contextParameter.getPrompt().equals(newName + "String_Node_Str")) {
          contextParameter.setPrompt(oldName + "String_Node_Str");
        }
        found=true;
      }
    }
  }
  this.helper.refreshContextViewForRename();
}
Program: 126796
Project: 126796
Buggy source:
/** 
 * qzhang Comment method "refreshContextView".
 */
@Override public void execute(){
  boolean found;
  List<IContextParameter> listParams;
  for (int i=0; i < contextManager.getListContext().size(); i++) {
    listParams=contextManager.getListContext().get(i).getContextParameterList();
    found=false;
    for (int j=0; j < listParams.size() && !found; j++) {
      IContextParameter contextParameter=listParams.get(j);
      String tempName=contextParameter.getName();
      String tempSourceId=contextParameter.getSource();
      if (tempName.equals(oldName) && tempSourceId.equals(sourceId)) {
        contextParameter.setName(newName);
        String scriptCode=contextParameter.getScriptCode().replaceAll(oldName,newName);
        contextParameter.setScriptCode(scriptCode);
        if (contextParameter.getPrompt().equals(oldName + "String_Node_Str")) {
          contextParameter.setPrompt(newName + "String_Node_Str");
        }
        found=true;
      }
    }
  }
  contextManager.fireContextsChangedEvent();
  this.helper.refreshContextView();
}

Fixed version (ground truth):
/** 
 * qzhang Comment method "refreshContextView".
 */
@Override public void execute(){
  boolean found;
  List<IContextParameter> listParams;
  for (int i=0; i < contextManager.getListContext().size(); i++) {
    listParams=contextManager.getListContext().get(i).getContextParameterList();
    found=false;
    for (int j=0; j < listParams.size() && !found; j++) {
      IContextParameter contextParameter=listParams.get(j);
      String tempName=contextParameter.getName();
      String tempSourceId=contextParameter.getSource();
      if (tempName.equals(oldName) && tempSourceId.equals(sourceId)) {
        contextParameter.setName(newName);
        String scriptCode=contextParameter.getScriptCode().replaceAll(oldName,newName);
        contextParameter.setScriptCode(scriptCode);
        if (contextParameter.getPrompt().equals(oldName + "String_Node_Str")) {
          contextParameter.setPrompt(newName + "String_Node_Str");
        }
        found=true;
      }
    }
  }
  contextManager.fireContextsChangedEvent();
  this.helper.refreshContextViewForRename();
}
Program: 126800
Project: 126800
Buggy source:
public void refreshContextView(){
  IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  IViewPart view=page.findView(AbstractContextView.CTX_ID_DESIGNER);
  if (view instanceof AbstractContextView) {
    ((AbstractContextView)view).updateContextView(true,false,false);
  }
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ITdqUiService.class)) {
    ITdqUiService tdqUiService=(ITdqUiService)GlobalServiceRegister.getDefault().getService(ITdqUiService.class);
    if (tdqUiService != null) {
      tdqUiService.updateContextView(true,false,false);
    }
  }
}

Fixed version (ground truth):
public void refreshContextView(){
  IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  IViewPart view=page.findView(AbstractContextView.CTX_ID_DESIGNER);
  if (view instanceof AbstractContextView) {
    ((AbstractContextView)view).updateContextView(true);
  }
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ITdqUiService.class)) {
    ITdqUiService tdqUiService=(ITdqUiService)GlobalServiceRegister.getDefault().getService(ITdqUiService.class);
    if (tdqUiService != null) {
      tdqUiService.updateContextView(true);
    }
  }
}
Program: 126801
Project: 126801
Buggy source:
@Override public void undo(){
  boolean found;
  List<IContextParameter> listParams;
  for (int i=0; i < contextManager.getListContext().size(); i++) {
    listParams=contextManager.getListContext().get(i).getContextParameterList();
    found=false;
    for (int j=0; j < listParams.size() && !found; j++) {
      IContextParameter contextParameter=listParams.get(j);
      String name=contextParameter.getName();
      String tempSourceId=contextParameter.getSource();
      if (name.equals(newName) && tempSourceId.equals(sourceId)) {
        contextParameter.setName(oldName);
        String scriptCode=contextParameter.getScriptCode().replaceAll(newName,oldName);
        contextParameter.setScriptCode(scriptCode);
        if (contextParameter.getPrompt().equals(newName + "String_Node_Str")) {
          contextParameter.setPrompt(oldName + "String_Node_Str");
        }
        found=true;
      }
    }
  }
  this.helper.refreshContextView();
}

Fixed version (ground truth):
@Override public void undo(){
  boolean found;
  List<IContextParameter> listParams;
  for (int i=0; i < contextManager.getListContext().size(); i++) {
    listParams=contextManager.getListContext().get(i).getContextParameterList();
    found=false;
    for (int j=0; j < listParams.size() && !found; j++) {
      IContextParameter contextParameter=listParams.get(j);
      String name=contextParameter.getName();
      String tempSourceId=contextParameter.getSource();
      if (name.equals(newName) && tempSourceId.equals(sourceId)) {
        contextParameter.setName(oldName);
        String scriptCode=contextParameter.getScriptCode().replaceAll(newName,oldName);
        contextParameter.setScriptCode(scriptCode);
        if (contextParameter.getPrompt().equals(newName + "String_Node_Str")) {
          contextParameter.setPrompt(oldName + "String_Node_Str");
        }
        found=true;
      }
    }
  }
  this.helper.refreshContextViewForRename();
}