nus-yam/ex-repair huggingface dataset:
Program: 138441
Project: 138441
Buggy source:
protected Collection<Analysis> searchAllAnalysis(IFolder folder) throws ClassNotFoundException {
  Collection<Analysis> analyses=new ArrayList<Analysis>();
  try {
    for (    IResource resource : folder.members()) {
      if (resource.getType() == IResource.FOLDER) {
        if (!resource.getName().startsWith("String_Node_Str")) {
          analyses.addAll(searchAllAnalysis(folder.getFolder(resource.getName())));
        }
        continue;
      }
      IFile file=(IFile)resource;
      if (null != file.getFileExtension() && file.getFileExtension().equals(FactoriesUtil.ANA)) {
        URI uri=URI.createPlatformResourceURI(file.getFullPath().toString(),false);
        Resource eResource=null;
        try {
          eResource=EMFSharedResources.getInstance().getResource(uri,true);
        }
 catch (        Exception e) {
        }
        if (eResource.getContents().size() > 0) {
          analyses.add((Analysis)eResource.getContents().get(0));
        }
 else {
          log.error("String_Node_Str" + eResource);
        }
      }
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
  return analyses;
}

Fixed version (ground truth):
protected Collection<Analysis> searchAllAnalysis(IFolder folder) throws ClassNotFoundException {
  Collection<Analysis> analyses=new ArrayList<Analysis>();
  try {
    for (    IResource resource : folder.members()) {
      if (resource.getType() == IResource.FOLDER) {
        if (!resource.getName().startsWith("String_Node_Str")) {
          analyses.addAll(searchAllAnalysis(folder.getFolder(resource.getName())));
        }
        continue;
      }
      IFile file=(IFile)resource;
      if (null != file.getFileExtension() && file.getFileExtension().equals(FactoriesUtil.ANA)) {
        URI uri=URI.createPlatformResourceURI(file.getFullPath().toString(),false);
        Resource eResource=null;
        try {
          eResource=EMFSharedResources.getInstance().getResource(uri,true);
        }
 catch (        Exception e) {
          eResource=EMFSharedResources.getInstance().getResource(uri,true);
        }
        if (eResource.getContents().size() > 0) {
          analyses.add((Analysis)eResource.getContents().get(0));
        }
 else {
          log.error("String_Node_Str" + eResource);
        }
      }
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
  return analyses;
}
Program: 138442
Project: 138442
Buggy source:
/** 
 * Method "createKey" creates a key with the concatenation of the values of the first n columns of the given list.
 * @param nominalColumns
 * @param n
 * @return a key
 */
private static String createKey(EList<MetadataColumn> nominalColumns,int n){
  StringBuilder builder=new StringBuilder();
  for (int i=0; i < n; i++) {
    builder.append(nominalColumns.get(i).getName()).append("String_Node_Str");
  }
  return builder.toString();
}

Fixed version (ground truth):
/** 
 * Method "createKey" creates a key with the concatenation of the values of the first n columns of the given list.
 * @param nominalColumns
 * @param n
 * @return a key
 */
private static String createKey(EList<ModelElement> nominalColumns,int n){
  StringBuilder builder=new StringBuilder();
  for (int i=0; i < n; i++) {
    builder.append(nominalColumns.get(i).getName()).append("String_Node_Str");
  }
  return builder.toString();
}
Program: 138443
Project: 138443
Buggy source:
/** 
 * Method "fillDataset" fills in the data sets.
 * @param nominalColumns the nominal columns
 * @param listRows the rows (=result set)
 * @param firstNumericColumnIdx the index of the first numeric column
 * @return a map [key -> aggregated values] where identifies a level of aggregation
 */
private static Map<String,ValueAggregator> fillDataset(final EList<MetadataColumn> nominalColumns,final List<Object[]> listRows,final int firstNumericColumnIdx){
  Map<String,ValueAggregator> valueAggregators=new HashMap<String,ValueAggregator>();
  int xPos=firstNumericColumnIdx;
  int yPos=firstNumericColumnIdx + 1;
  int zPos=firstNumericColumnIdx + 2;
  for (int i=nominalColumns.size(); i > 0; i--) {
    String key=createKey(nominalColumns,i);
    for (    Object[] row : listRows) {
      final Object xobj=row[xPos];
      final Double xValue=xobj != null ? Double.valueOf(String.valueOf(xobj)) : null;
      final Object yobj=row[yPos];
      final Double yValue=yobj != null ? Double.valueOf(String.valueOf(yobj)) : null;
      final Object zobj=row[zPos];
      final Double zValue=zobj != null ? Double.valueOf(String.valueOf(zobj)) : null;
      ValueAggregator valueAggregator=valueAggregators.get(key);
      if (valueAggregator == null) {
        valueAggregator=new ValueAggregator();
        valueAggregators.put(key,valueAggregator);
      }
      MultipleKey multipleKey=new MultipleKey(row,i);
      valueAggregator.addValue(multipleKey,new Double[]{xValue,yValue,zValue});
    }
  }
  return valueAggregators;
}

Fixed version (ground truth):
/** 
 * Method "fillDataset" fills in the data sets.
 * @param nominalColumns the nominal columns
 * @param listRows the rows (=result set)
 * @param firstNumericColumnIdx the index of the first numeric column
 * @return a map [key -> aggregated values] where identifies a level of aggregation
 */
private static Map<String,ValueAggregator> fillDataset(final EList<ModelElement> nominalColumns,final List<Object[]> listRows,final int firstNumericColumnIdx){
  Map<String,ValueAggregator> valueAggregators=new HashMap<String,ValueAggregator>();
  int xPos=firstNumericColumnIdx;
  int yPos=firstNumericColumnIdx + 1;
  int zPos=firstNumericColumnIdx + 2;
  for (int i=nominalColumns.size(); i > 0; i--) {
    String key=createKey(nominalColumns,i);
    for (    Object[] row : listRows) {
      final Object xobj=row[xPos];
      final Double xValue=xobj != null ? Double.valueOf(String.valueOf(xobj)) : null;
      final Object yobj=row[yPos];
      final Double yValue=yobj != null ? Double.valueOf(String.valueOf(yobj)) : null;
      final Object zobj=row[zPos];
      final Double zValue=zobj != null ? Double.valueOf(String.valueOf(zobj)) : null;
      ValueAggregator valueAggregator=valueAggregators.get(key);
      if (valueAggregator == null) {
        valueAggregator=new ValueAggregator();
        valueAggregators.put(key,valueAggregator);
      }
      MultipleKey multipleKey=new MultipleKey(row,i);
      valueAggregator.addValue(multipleKey,new Double[]{xValue,yValue,zValue});
    }
  }
  return valueAggregators;
}
Program: 138444
Project: 138444
Buggy source:
/** 
 */
private static Map<String,DateValueAggregate> fillGanttDataset(final EList<MetadataColumn> nominalColumns,final List<Object[]> listRows,final int firstDateColumnIdx){
  Map<String,DateValueAggregate> valueAggregators=new TreeMap<String,DateValueAggregate>();
  int minPos=firstDateColumnIdx;
  int maxPos=firstDateColumnIdx + 1;
  for (int i=nominalColumns.size(); i > 0; i--) {
    String key=createKey(nominalColumns,i);
    for (    Object[] row : listRows) {
      final Object minObj=row[minPos];
      final Date minDate=minObj != null ? (Date)minObj : null;
      final Object maxobj=row[maxPos];
      final Date maxDate=maxobj != null ? (Date)maxobj : null;
      DateValueAggregate valueAggregator=valueAggregators.get(key);
      if (valueAggregator == null) {
        valueAggregator=new DateValueAggregate();
        valueAggregators.put(key,valueAggregator);
      }
      MultipleKey multipleKey=new MultipleKey(row,i);
      valueAggregator.addValue(multipleKey,new Date[]{minDate,maxDate});
    }
  }
  return valueAggregators;
}

Fixed version (ground truth):
/** 
 */
private static Map<String,DateValueAggregate> fillGanttDataset(final EList<ModelElement> nominalColumns,final List<Object[]> listRows,final int firstDateColumnIdx){
  Map<String,DateValueAggregate> valueAggregators=new TreeMap<String,DateValueAggregate>();
  int minPos=firstDateColumnIdx;
  int maxPos=firstDateColumnIdx + 1;
  for (int i=nominalColumns.size(); i > 0; i--) {
    String key=createKey(nominalColumns,i);
    for (    Object[] row : listRows) {
      final Object minObj=row[minPos];
      final Date minDate=minObj != null ? (Date)minObj : null;
      final Object maxobj=row[maxPos];
      final Date maxDate=maxobj != null ? (Date)maxobj : null;
      DateValueAggregate valueAggregator=valueAggregators.get(key);
      if (valueAggregator == null) {
        valueAggregator=new DateValueAggregate();
        valueAggregators.put(key,valueAggregator);
      }
      MultipleKey multipleKey=new MultipleKey(row,i);
      valueAggregator.addValue(multipleKey,new Date[]{minDate,maxDate});
    }
  }
  return valueAggregators;
}
Program: 138449
Project: 138449
Buggy source:
public HideSeriesChartComposite(Composite comp,Analysis ana,ColumnSetMultiValueIndicator indicator,MetadataColumn column,boolean isNeedUtility){
  super(comp,SWT.NONE);
  this.analysis=ana;
  this.indicator=indicator;
  this.column=column;
  this.isNeedUtility=isNeedUtility;
  this.setCursor(new Cursor(Display.getDefault(),SWT.CURSOR_HAND));
  this.setToolTipText("String_Node_Str");
  createHideSeriesArea();
  addSpecifiedListeners();
  GridData gd=new GridData();
  gd.heightHint=indicator.getAnalyzedColumns().size() * 30 < 230 ? 230 : indicator.getAnalyzedColumns().size() * 30;
  gd.widthHint=460;
  this.setLayoutData(gd);
}

Fixed version (ground truth):
public HideSeriesChartComposite(Composite comp,Analysis ana,ColumnSetMultiValueIndicator indicator,ModelElement column,boolean isNeedUtility){
  super(comp,SWT.NONE);
  this.analysis=ana;
  this.indicator=indicator;
  this.column=column;
  this.isNeedUtility=isNeedUtility;
  this.setCursor(new Cursor(Display.getDefault(),SWT.CURSOR_HAND));
  this.setToolTipText("String_Node_Str");
  createHideSeriesArea();
  addSpecifiedListeners();
  GridData gd=new GridData();
  gd.heightHint=indicator.getAnalyzedColumns().size() * 30 < 230 ? 230 : indicator.getAnalyzedColumns().size() * 30;
  gd.widthHint=460;
  this.setLayoutData(gd);
}
Program: 138451
Project: 138451
Buggy source:
private void addMenuOnGantChart(ChartEntity chartEntity,Menu menu){
  if (chartEntity instanceof CategoryItemEntity) {
    CategoryItemEntity itemEntity=(CategoryItemEntity)chartEntity;
    String seriesK=itemEntity.getRowKey().toString();
    String seriesLabel=itemEntity.getColumnKey().toString();
    EList<MetadataColumn> nominalList=indicator.getNominalColumns();
    final String sql=MultiColumnSetValueExplorer.getInstance().getQueryStirng(column,analysis,nominalList,seriesK,seriesLabel);
    MenuItem item=new MenuItem(menu,SWT.PUSH);
    item.setText(DefaultMessagesImpl.getString("String_Node_Str"));
    item.addSelectionListener(new SelectionAdapter(){
      @Override public void widgetSelected(      SelectionEvent e){
        Display.getDefault().asyncExec(new Runnable(){
          public void run(){
            Connection tdDataProvider=SwitchHelpers.CONNECTION_SWITCH.doSwitch(analysis.getContext().getConnection());
            String query=sql;
            String editorName=ColumnHelper.getColumnSetOwner(column).getName();
            CorePlugin.getDefault().runInDQViewer(tdDataProvider,query,editorName);
          }
        }
);
      }
    }
);
  }
}

Fixed version (ground truth):
private void addMenuOnGantChart(ChartEntity chartEntity,Menu menu){
  if (chartEntity instanceof CategoryItemEntity) {
    CategoryItemEntity itemEntity=(CategoryItemEntity)chartEntity;
    String seriesK=itemEntity.getRowKey().toString();
    String seriesLabel=itemEntity.getColumnKey().toString();
    EList<ModelElement> nominalList=indicator.getNominalColumns();
    final String sql=MultiColumnSetValueExplorer.getInstance().getQueryStirng(column,analysis,nominalList,seriesK,seriesLabel);
    MenuItem item=new MenuItem(menu,SWT.PUSH);
    item.setText(DefaultMessagesImpl.getString("String_Node_Str"));
    item.addSelectionListener(new SelectionAdapter(){
      @Override public void widgetSelected(      SelectionEvent e){
        Display.getDefault().asyncExec(new Runnable(){
          public void run(){
            Connection tdDataProvider=SwitchHelpers.CONNECTION_SWITCH.doSwitch(analysis.getContext().getConnection());
            String query=sql;
            String editorName=ColumnHelper.getColumnSetOwner(column).getName();
            CorePlugin.getDefault().runInDQViewer(tdDataProvider,query,editorName);
          }
        }
);
      }
    }
);
  }
}
Program: 138452
Project: 138452
Buggy source:
/** 
 * zshen.
 * @return the input of table.
 */
private List<Map<Integer,RegexpMatchingIndicator>> organizeTableInput(){
  List<Map<Integer,RegexpMatchingIndicator>> returnList=new ArrayList<Map<Integer,RegexpMatchingIndicator>>();
  AllMatchIndicatorImpl allMatchIndicator=this.selectPatternsWizard.getAllMatchIndicator();
  if (allMatchIndicator == null) {
    return returnList;
  }
  List<MetadataColumn> analysisColumns=this.selectPatternsWizard.getAllMatchIndicator().getAnalyzedColumns();
  List<RegexpMatchingIndicator> regexpMatchingIndicatorList=this.selectPatternsWizard.getAllMatchIndicator().getCompositeRegexMatchingIndicators();
  for (  RegexpMatchingIndicator regexIndicator : regexpMatchingIndicatorList) {
    int index=analysisColumns.indexOf(regexIndicator.getAnalyzedElement());
    Map<Integer,RegexpMatchingIndicator> returnMap=getMapLocation(returnList,index);
    returnMap.put(index,regexIndicator);
    if (returnMap.size() == 1) {
      returnList.add(returnMap);
    }
  }
  return returnList;
}

Fixed version (ground truth):
/** 
 * zshen.
 * @return the input of table.
 */
private List<Map<Integer,RegexpMatchingIndicator>> organizeTableInput(){
  List<Map<Integer,RegexpMatchingIndicator>> returnList=new ArrayList<Map<Integer,RegexpMatchingIndicator>>();
  AllMatchIndicatorImpl allMatchIndicator=this.selectPatternsWizard.getAllMatchIndicator();
  if (allMatchIndicator == null) {
    return returnList;
  }
  List<ModelElement> analysisColumns=this.selectPatternsWizard.getAllMatchIndicator().getAnalyzedColumns();
  List<RegexpMatchingIndicator> regexpMatchingIndicatorList=this.selectPatternsWizard.getAllMatchIndicator().getCompositeRegexMatchingIndicators();
  for (  RegexpMatchingIndicator regexIndicator : regexpMatchingIndicatorList) {
    int index=analysisColumns.indexOf(regexIndicator.getAnalyzedElement());
    Map<Integer,RegexpMatchingIndicator> returnMap=getMapLocation(returnList,index);
    returnMap.put(index,regexIndicator);
    if (returnMap.size() == 1) {
      returnList.add(returnMap);
    }
  }
  return returnList;
}
Program: 138453
Project: 138453
Buggy source:
public void createControl(Composite parent){
  GridLayout parentGridLayout=new GridLayout();
  GridData data=new GridData();
  data.horizontalAlignment=GridData.FILL;
  data.verticalAlignment=GridData.FILL;
  data.grabExcessHorizontalSpace=true;
  data.grabExcessVerticalSpace=true;
  parent.setLayout(parentGridLayout);
  List<MetadataColumn> analysisColumns=this.selectPatternsWizard.getSsIndicator().getAnalyzedColumns();
  GridTableViewer tableView=new GridTableViewer(parent,SWT.NONE);
  this.table=tableView.getGrid();
  this.table.setLayoutData(data);
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  for (  ModelElement element : analysisColumns) {
    GridColumn tableCum=new GridColumn(table,SWT.CHECK);
    MetadataColumn mdColumn=SwitchHelpers.METADATA_COLUMN_SWITCH.doSwitch(element);
    TdColumn tdColumn=SwitchHelpers.COLUMN_SWITCH.doSwitch(element);
    if (tdColumn != null) {
      tableCum.setText(tdColumn.getName());
    }
 else     if (mdColumn != null) {
      tableCum.setText(mdColumn.getId());
    }
  }
  tableView.setContentProvider(new PatternSelectContentProvider());
  tableView.setLabelProvider(new PatternSelectLabelProvider());
  this.tableInputList=organizeTableInput();
  tableView.setInput(tableInputList);
  for (  GridColumn tableCum : table.getColumns()) {
    tableCum.pack();
  }
  initDataFilterSection(parent);
  inItitemCheck();
  this.setControl(parent);
  this.setPageComplete(true);
}

Fixed version (ground truth):
public void createControl(Composite parent){
  GridLayout parentGridLayout=new GridLayout();
  GridData data=new GridData();
  data.horizontalAlignment=GridData.FILL;
  data.verticalAlignment=GridData.FILL;
  data.grabExcessHorizontalSpace=true;
  data.grabExcessVerticalSpace=true;
  parent.setLayout(parentGridLayout);
  List<ModelElement> analysisColumns=this.selectPatternsWizard.getSsIndicator().getAnalyzedColumns();
  GridTableViewer tableView=new GridTableViewer(parent,SWT.NONE);
  this.table=tableView.getGrid();
  this.table.setLayoutData(data);
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  for (  ModelElement element : analysisColumns) {
    GridColumn tableCum=new GridColumn(table,SWT.CHECK);
    MetadataColumn mdColumn=SwitchHelpers.METADATA_COLUMN_SWITCH.doSwitch(element);
    TdColumn tdColumn=SwitchHelpers.COLUMN_SWITCH.doSwitch(element);
    if (tdColumn != null) {
      tableCum.setText(tdColumn.getName());
    }
 else     if (mdColumn != null) {
      tableCum.setText(mdColumn.getId());
    }
  }
  tableView.setContentProvider(new PatternSelectContentProvider());
  tableView.setLabelProvider(new PatternSelectLabelProvider());
  this.tableInputList=organizeTableInput();
  tableView.setInput(tableInputList);
  for (  GridColumn tableCum : table.getColumns()) {
    tableCum.pack();
  }
  initDataFilterSection(parent);
  inItitemCheck();
  this.setControl(parent);
  this.setPageComplete(true);
}
Program: 138455
Project: 138455
Buggy source:
/** 
 * DOC bZhou Comment method "getIntactElemenetName".
 * @return
 */
public String getIntactElemenetName(){
  if (currentModelElement == null) {
    currentModelElement=getCurrentModelElement(getEditor());
  }
  return DqRepositoryViewService.buildElementName(currentModelElement);
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "getIntactElemenetName".
 * @return
 */
public String getIntactElemenetName(){
  if (currentModelElement == null) {
    currentModelElement=getCurrentModelElement(getEditor());
  }
  return DqRepositoryViewService.buildElementName(getProperty());
}
Program: 138456
Project: 138456
Buggy source:
protected void initMetaTextFied(){
  String name=currentModelElement.getName();
  String purpose=MetadataHelper.getPurpose(currentModelElement);
  String description=MetadataHelper.getDescription(currentModelElement);
  String author=MetadataHelper.getAuthor(currentModelElement);
  String version=MetadataHelper.getVersion(currentModelElement);
  String devStatus=MetadataHelper.getDevStatus(currentModelElement);
  String locker=RepositoryNodeHelper.getLocker(this.repositoryViewObject);
  if (currentModelElement instanceof Connection) {
    Property property=PropertyHelper.getProperty(currentModelElement);
    if (property != null) {
      name=property.getLabel();
      purpose=property.getPurpose();
      description=property.getDescription();
      author=property.getAuthor().getLogin();
      version=property.getVersion();
      devStatus=property.getStatusCode();
    }
  }
  nameText.setText(name == null ? PluginConstant.EMPTY_STRING : name);
  purposeText.setText(purpose == null ? PluginConstant.EMPTY_STRING : purpose);
  descriptionText.setText(description == null ? PluginConstant.EMPTY_STRING : description);
  authorText.setText(author == null ? PluginConstant.EMPTY_STRING : author);
  authorText.setEnabled(false);
  lockerText.setText(locker == null ? PluginConstant.EMPTY_STRING : locker);
  lockerText.setEnabled(false);
  versionText.setText(version == null ? VersionUtils.DEFAULT_VERSION : version);
  statusCombo.setText(devStatus == null ? PluginConstant.EMPTY_STRING : devStatus);
}

Fixed version (ground truth):
protected void initMetaTextFied(){
  Property property=getProperty();
  if (property != null) {
    String name=property.getLabel();
    String purpose=property.getPurpose();
    String description=property.getDescription();
    String author=property.getAuthor().getLogin();
    String version=property.getVersion();
    String devStatus=property.getStatusCode();
    String lockerStr=null;
    ItemState state=property.getItem().getState();
    if (state != null) {
      User locker=state.getLocker();
      if (locker != null) {
        lockerStr=locker.getLogin();
      }
    }
    nameText.setText(name == null ? PluginConstant.EMPTY_STRING : name);
    purposeText.setText(purpose == null ? PluginConstant.EMPTY_STRING : purpose);
    descriptionText.setText(description == null ? PluginConstant.EMPTY_STRING : description);
    authorText.setText(author == null ? PluginConstant.EMPTY_STRING : author);
    authorText.setEnabled(false);
    lockerText.setText(lockerStr == null ? PluginConstant.EMPTY_STRING : lockerStr);
    lockerText.setEnabled(false);
    statusCombo.setText(devStatus == null ? PluginConstant.EMPTY_STRING : devStatus);
  }
}
Program: 138457
Project: 138457
Buggy source:
protected String decorateText(String input,Object element){
  if (element instanceof IFile) {
    IFile file=(IFile)element;
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + file.getLocation());
    }
    ModelElement mElement=null;
    try {
      mElement=ModelElementFileFactory.getModelElement(file);
    }
 catch (    Exception exc) {
      log.error(exc,exc);
    }
    if (mElement != null) {
      return DqRepositoryViewService.buildElementName(mElement);
    }
  }
  input=DQStructureMessage.getString(super.decorateText(input,element));
  if (element instanceof IFolder) {
    if (input.startsWith(DQStructureManager.PREFIX_TDQ)) {
      input=input.replaceFirst(DQStructureManager.PREFIX_TDQ,"String_Node_Str");
    }
    IFolder folder=(IFolder)element;
    if (ResourceManager.isAnalysisFolder(folder)) {
      input+="String_Node_Str" + getFileCount(folder,new String[]{"String_Node_Str"}) + "String_Node_Str";
    }
 else     if (ResourceManager.isReportsFolder(folder)) {
      input+="String_Node_Str" + getFileCount(folder,new String[]{"String_Node_Str"}) + "String_Node_Str";
    }
  }
  return super.decorateText(input,element);
}

Fixed version (ground truth):
protected String decorateText(String input,Object element){
  if (element instanceof IFile) {
    IFile file=(IFile)element;
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + file.getLocation());
    }
    ModelElement mElement=null;
    try {
      mElement=ModelElementFileFactory.getModelElement(file);
    }
 catch (    Exception exc) {
      log.error(exc,exc);
    }
    if (mElement != null) {
      Property property=ProxyRepositoryFactory.getInstance().getProperty(mElement);
      return DqRepositoryViewService.buildElementName(property);
    }
  }
  input=DQStructureMessage.getString(super.decorateText(input,element));
  if (element instanceof IFolder) {
    if (input.startsWith(DQStructureManager.PREFIX_TDQ)) {
      input=input.replaceFirst(DQStructureManager.PREFIX_TDQ,"String_Node_Str");
    }
    IFolder folder=(IFolder)element;
    if (ResourceManager.isAnalysisFolder(folder)) {
      input+="String_Node_Str" + getFileCount(folder,new String[]{"String_Node_Str"}) + "String_Node_Str";
    }
 else     if (ResourceManager.isReportsFolder(folder)) {
      input+="String_Node_Str" + getFileCount(folder,new String[]{"String_Node_Str"}) + "String_Node_Str";
    }
  }
  return super.decorateText(input,element);
}
Program: 138458
Project: 138458
Buggy source:
public void createControl(Composite parent){
  List<MetadataColumn> analysisColumns=this.selectPatternsWizard.getSsIndicator().getAnalyzedColumns();
  GridTableViewer tableView=new GridTableViewer(parent,SWT.NONE);
  this.table=tableView.getGrid();
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  for (  ModelElement analysisColumn : analysisColumns) {
    GridColumn tableCum=new GridColumn(table,SWT.CHECK);
    tableCum.setText(analysisColumn.getName());
  }
  tableView.setContentProvider(new PatternSelectContentProvider());
  tableView.setLabelProvider(new PatternSelectLabelProvider());
  this.tableInputList=organizeTableInput();
  tableView.setInput(tableInputList);
  for (  GridColumn tableCum : table.getColumns()) {
    tableCum.pack();
  }
  inItitemCheck();
  this.setControl(parent);
  this.setPageComplete(true);
}

Fixed version (ground truth):
public void createControl(Composite parent){
  List<MetadataColumn> analysisColumns=this.selectPatternsWizard.getSsIndicator().getAnalyzedColumns();
  GridTableViewer tableView=new GridTableViewer(parent,SWT.NONE);
  this.table=tableView.getGrid();
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  for (  ModelElement element : analysisColumns) {
    GridColumn tableCum=new GridColumn(table,SWT.CHECK);
    MetadataColumn mdColumn=SwitchHelpers.METADATA_COLUMN_SWITCH.doSwitch(element);
    TdColumn tdColumn=SwitchHelpers.COLUMN_SWITCH.doSwitch(element);
    if (tdColumn != null) {
      tableCum.setText(tdColumn.getName());
    }
 else     if (mdColumn != null) {
      tableCum.setText(mdColumn.getId());
    }
  }
  tableView.setContentProvider(new PatternSelectContentProvider());
  tableView.setLabelProvider(new PatternSelectLabelProvider());
  this.tableInputList=organizeTableInput();
  tableView.setInput(tableInputList);
  for (  GridColumn tableCum : table.getColumns()) {
    tableCum.pack();
  }
  inItitemCheck();
  this.setControl(parent);
  this.setPageComplete(true);
}
Program: 138459
Project: 138459
Buggy source:
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated NOT
 */
public EList<MetadataColumn> getNominalColumns(){
  EList<MetadataColumn> nominalColumns=new BasicElistExtend<MetadataColumn>();
  if (analyzedColumns != null) {
    for (    MetadataColumn column : analyzedColumns) {
      final MetadataColumn mdColumn=SwitchHelpers.METADATA_COLUMN_SWITCH.doSwitch(column);
      final TdColumn tdColumn=SwitchHelpers.COLUMN_SWITCH.doSwitch(column);
      if (tdColumn == null && mdColumn == null) {
        if (column == null) {
          log.error("String_Node_Str");
        }
 else {
          log.error("String_Node_Str" + column.getName());
        }
        continue;
      }
      DataminingType dataminingType=MetadataHelper.getDataminingType(column);
      if (DataminingType.NOMINAL.equals(dataminingType)) {
        nominalColumns.add(column);
      }
    }
  }
  return nominalColumns;
}

Fixed version (ground truth):
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated NOT
 */
public EList<MetadataColumn> getNominalColumns(){
  EList<MetadataColumn> nominalColumns=new BasicElistExtend<MetadataColumn>();
  if (analyzedColumns != null) {
    for (    MetadataColumn column : analyzedColumns) {
      final MetadataColumn mdColumn=SwitchHelpers.METADATA_COLUMN_SWITCH.doSwitch(column);
      final TdColumn tdColumn=SwitchHelpers.COLUMN_SWITCH.doSwitch(column);
      if (tdColumn == null && mdColumn == null) {
        if (column == null) {
          log.error("String_Node_Str");
        }
 else {
          log.error("String_Node_Str" + column.getName());
        }
        continue;
      }
      DataminingType dataminingType=MetadataHelper.getDataminingType(column);
      if (DataminingType.NOMINAL.equals(dataminingType)) {
        nominalColumns.add(column);
      }
 else       if (null != mdColumn) {
        nominalColumns.add(column);
      }
    }
  }
  return nominalColumns;
}
Program: 138460
Project: 138460
Buggy source:
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated NOT
 */
public EList<String> getColumnHeaders(){
  EList<String> headers=new BasicEList<String>();
  for (  ModelElement column : this.getNominalColumns()) {
    headers.add(column.getName());
  }
  for (  ModelElement column : this.getNumericColumns()) {
    for (    String f : this.getNumericFunctions()) {
      headers.add(MessageFormat.format(f,column.getName()));
    }
  }
  for (  ModelElement column : this.getDateColumns()) {
    for (    String f : this.getDateFunctions()) {
      headers.add(MessageFormat.format(f,column.getName()));
    }
  }
  headers.add(this.getCountAll());
  return headers;
}

Fixed version (ground truth):
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated NOT
 */
public EList<String> getColumnHeaders(){
  EList<String> headers=new BasicEList<String>();
  for (  ModelElement column : this.getNominalColumns()) {
    headers.add(getColumnName(column));
  }
  for (  ModelElement column : this.getNumericColumns()) {
    for (    String f : this.getNumericFunctions()) {
      headers.add(MessageFormat.format(f,getColumnName(column)));
    }
  }
  for (  ModelElement column : this.getDateColumns()) {
    for (    String f : this.getDateFunctions()) {
      headers.add(MessageFormat.format(f,getColumnName(column)));
    }
  }
  headers.add(this.getCountAll());
  return headers;
}
Program: 138461
Project: 138461
Buggy source:
public Item getItem(){
  return item;
}

Fixed version (ground truth):
public Item getItem(){
  if (item.eIsProxy()) {
    item=(Item)EObjectHelper.resolveObject(item);
  }
  return item;
}
Program: 138462
Project: 138462
Buggy source:
public void activateEditor(IWorkbenchPage aPage,IStructuredSelection aSelection){
  RepositoryNode repNode=(RepositoryNode)aSelection.getFirstElement();
  OpenItemEditorAction openEditorAction=new OpenItemEditorAction(repNode.getObject());
  AbstractItemEditorInput absEditorInput=openEditorAction.computeEditorInput();
  aPage.bringToTop(aPage.findEditor(absEditorInput));
}

Fixed version (ground truth):
public void activateEditor(IWorkbenchPage aPage,IStructuredSelection aSelection){
  RepositoryNode repNode=(RepositoryNode)aSelection.getFirstElement();
  OpenItemEditorAction openEditorAction=new OpenItemEditorAction(repNode.getObject());
  AbstractItemEditorInput absEditorInput=openEditorAction.computeEditorInput();
  if (absEditorInput != null) {
    aPage.bringToTop(aPage.findEditor(absEditorInput));
  }
}
Program: 138463
Project: 138463
Buggy source:
/** 
 * Change connection informations with server, port etc., and update related analyses. MOD yyi 9082 2010-02-25
 */
protected void changeConnectionInformations(){
  if (connectionItem != null) {
    if (connectionItem.eIsProxy()) {
      connectionItem=(ConnectionItem)EObjectHelper.resolveObject(connectionItem);
    }
    RepositoryNode node=RepositoryNodeHelper.recursiveFind(connectionItem.getConnection());
    IWizard wizard=null;
    if (node != null) {
      if (node instanceof DBConnectionRepNode) {
        wizard=new DatabaseWizard(PlatformUI.getWorkbench(),false,node,null);
      }
 else       if (node instanceof MDMConnectionRepNode) {
        if (PluginChecker.isMDMPluginLoaded() && GlobalServiceRegister.getDefault().isServiceRegistered(IMDMProviderService.class)) {
          IMDMProviderService service=(IMDMProviderService)GlobalServiceRegister.getDefault().getService(IMDMProviderService.class);
          if (service != null) {
            wizard=service.newMDMWizard(PlatformUI.getWorkbench(),false,node,null);
          }
        }
      }
    }
    if (wizard != null) {
      WizardDialog dialog=new WizardDialog(null,wizard);
      dialog.setPageSize(550,550);
      wizard.setContainer(dialog);
      dialog.open();
    }
  }
}

Fixed version (ground truth):
/** 
 * Change connection informations with server, port etc., and update related analyses. MOD yyi 9082 2010-02-25
 */
protected void changeConnectionInformations(){
  if (connectionItem != null) {
    if (connectionItem.eIsProxy()) {
      connectionItem=(ConnectionItem)EObjectHelper.resolveObject(connectionItem);
    }
    RepositoryNode node=RepositoryNodeHelper.recursiveFind(((ConnectionItem)connectionItem).getConnection());
    IWizard wizard=null;
    if (node != null) {
      if (node instanceof DBConnectionRepNode) {
        wizard=new DatabaseWizard(PlatformUI.getWorkbench(),false,node,null);
      }
 else       if (node instanceof MDMConnectionRepNode) {
        if (PluginChecker.isMDMPluginLoaded() && GlobalServiceRegister.getDefault().isServiceRegistered(IMDMProviderService.class)) {
          IMDMProviderService service=(IMDMProviderService)GlobalServiceRegister.getDefault().getService(IMDMProviderService.class);
          if (service != null) {
            wizard=service.newMDMWizard(PlatformUI.getWorkbench(),false,node,null);
          }
        }
      }
    }
    if (wizard != null) {
      WizardDialog dialog=new WizardDialog(null,wizard);
      dialog.setPageSize(550,550);
      wizard.setContainer(dialog);
      dialog.open();
    }
  }
}
Program: 138464
Project: 138464
Buggy source:
@Override protected ModelElement getCurrentModelElement(FormEditor editor){
  IEditorInput editorInput=editor.getEditorInput();
  if (editorInput instanceof ConnectionItemEditorInput) {
    ConnectionItemEditorInput input=(ConnectionItemEditorInput)editorInput;
    connectionItem=input.getConnectionItem();
    connection=input.getConnectionItem().getConnection();
  }
 else   if (editorInput instanceof FileEditorInput) {
    Property proty=PropertyHelper.getProperty(((FileEditorInput)editorInput).getFile());
    Item item=proty.getItem();
    if (item instanceof ConnectionItem) {
      connectionItem=(ConnectionItem)item;
      connection=((ConnectionItem)item).getConnection();
    }
  }
  initConnectionRepNode(connection);
  return ConnectionUtils.fillConnectionInformation(connection);
}

Fixed version (ground truth):
@Override protected ModelElement getCurrentModelElement(FormEditor editor){
  IEditorInput editorInput=editor.getEditorInput();
  if (editorInput instanceof ConnectionItemEditorInput) {
    ConnectionItemEditorInput input=(ConnectionItemEditorInput)editorInput;
    connectionItem=input.getItem();
    connection=((ConnectionItem)input.getItem()).getConnection();
  }
 else   if (editorInput instanceof FileEditorInput) {
    Property proty=PropertyHelper.getProperty(((FileEditorInput)editorInput).getFile());
    Item item=proty.getItem();
    if (item instanceof ConnectionItem) {
      connectionItem=(ConnectionItem)item;
      connection=((ConnectionItem)item).getConnection();
    }
  }
  initConnectionRepNode(connection);
  return ConnectionUtils.fillConnectionInformation(connection);
}
Program: 138465
Project: 138465
Buggy source:
public ConnectionItemEditorInput(Item connItem){
  super(connItem);
  connectionItem=(ConnectionItem)connItem;
}

Fixed version (ground truth):
public ConnectionItemEditorInput(Item connItem){
  super(connItem);
}
Program: 138466
Project: 138466
Buggy source:
@Override public String getName(){
  return getPath() + connectionItem.getConnection().getName();
}

Fixed version (ground truth):
@Override public String getName(){
  return getPath() + ((ConnectionItem)item).getConnection().getName();
}
Program: 138467
Project: 138467
Buggy source:
@Override public String getToolTipText(){
  return getPath() + connectionItem.getConnection().getName();
}

Fixed version (ground truth):
@Override public String getToolTipText(){
  return getPath() + ((ConnectionItem)item).getConnection().getName();
}
Program: 138468
Project: 138468
Buggy source:
public void clear(){
  super.clear();
  this.allAnalysisMap.clear();
}

Fixed version (ground truth):
public void clear(){
  for (  Analysis analysis : allAnalysisMap.values()) {
    if (analysis.eIsProxy()) {
      ResourceSet resourceSet=ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider().getResourceManager().resourceSet;
      analysis=(Analysis)EcoreUtil.resolve(analysis,resourceSet);
    }
    URI uri=analysis.eResource().getURI();
    EMFSharedResources.getInstance().unloadResource(uri.toString());
  }
  super.clear();
  this.allAnalysisMap.clear();
}
Program: 138469
Project: 138469
Buggy source:
/** 
 * clear the cache of ModelElement.
 * @return
 */
private boolean reloadModelElementCache(){
  try {
    AnaResourceFileHelper.getInstance().clear();
    RepResourceFileHelper.getInstance().clear();
    IndicatorResourceFileHelper.getInstance().clear();
    PatternResourceFileHelper.getInstance().clear();
    DQRuleResourceFileHelper.getInstance().clear();
    ResourceFileMap.getAll();
  }
 catch (  Exception e) {
    log.error(e,e);
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * clear the cache of ModelElement.
 * @return
 */
private boolean reloadModelElementCache(){
  try {
    AnaResourceFileHelper.getInstance().clear();
    RepResourceFileHelper.getInstance().clear();
    IndicatorResourceFileHelper.getInstance().clear();
    PatternResourceFileHelper.getInstance().clear();
    DQRuleResourceFileHelper.getInstance().clear();
    PrvResourceFileHelper.getInstance().clear();
    ResourceFileMap.getAll();
  }
 catch (  Exception e) {
    log.error(e,e);
    return false;
  }
  return true;
}
Program: 138470
Project: 138470
Buggy source:
private void tansferFile(File parentFolder,Map<File,File> folderMap) throws Exception {
  resourceSet=new ResourceSetImpl();
  if (!parentFolder.exists()) {
    return;
  }
  List<File> fileList=new ArrayList<File>();
  FilesUtils.getAllFilesFromFolder(parentFolder,fileList,nonPropertyFileFilter);
  for (  File propFile : fileList) {
    try {
      handlePropertiesFile(propFile,folderMap,parentFolder);
    }
 catch (    Exception e) {
      log.warn(e,e);
    }
  }
}

Fixed version (ground truth):
private void tansferFile(File parentFolder,Map<File,File> folderMap) throws Exception {
  resourceSet=new ResourceSetImpl();
  if (!parentFolder.exists()) {
    return;
  }
  List<File> fileList=new ArrayList<File>();
  FilesUtils.getAllFilesFromFolder(parentFolder,fileList,nonPropertyFileFilter);
  for (  File propFile : fileList) {
    try {
      handlePropertiesFile(propFile,folderMap,parentFolder);
    }
 catch (    Exception e) {
      log.warn(e,e);
    }
  }
  if (isWorksapcePath()) {
    collectConnectionID();
  }
}
Program: 138473
Project: 138473
Buggy source:
@Override public void dragEnter(DropTargetEvent event){
  super.dragEnter(event);
  IStructuredSelection selection=(IStructuredSelection)LocalSelectionTransfer.getTransfer().getSelection();
  Object object=selection.getFirstElement();
  if (object instanceof TdColumn) {
    receiver=new ColumnReceiverTable();
  }
  if (receiver == null) {
    event.detail=DND.DROP_NONE;
  }
 else {
    event.feedback=DND.FEEDBACK_EXPAND;
    receiver.doDropValidation(event,commonViewer);
  }
}

Fixed version (ground truth):
@Override public void dragEnter(DropTargetEvent event){
  super.dragEnter(event);
  IStructuredSelection selection=(IStructuredSelection)LocalSelectionTransfer.getTransfer().getSelection();
  Object object=selection.getFirstElement();
  if (object instanceof DBColumnRepNode) {
    receiver=new ColumnReceiverTable();
  }
  if (receiver == null) {
    event.detail=DND.DROP_NONE;
  }
 else {
    event.feedback=DND.FEEDBACK_EXPAND;
    receiver.doDropValidation(event,commonViewer);
  }
}
Program: 138474
Project: 138474
Buggy source:
public void doDropValidation(DropTargetEvent event,CommonViewer commonViewer){
  event.detail=DND.DROP_NONE;
  IRepositoryNode firstElement=(RepositoryNode)((StructuredSelection)LocalSelectionTransfer.getTransfer().getSelection()).getFirstElement();
  IRepositoryViewObject repViewObj=firstElement.getObject();
  if (repViewObj instanceof MetadataColumnRepositoryObject) {
    TdColumn column=(TdColumn)firstElement;
    Table table=(Table)((DropTarget)event.widget).getControl();
    AbstractColumnDropTree viewer=(AbstractColumnDropTree)table.getData();
    if (viewer != null && viewer.canDrop(firstElement)) {
      event.detail=DND.DROP_MOVE;
    }
  }
}

Fixed version (ground truth):
public void doDropValidation(DropTargetEvent event,CommonViewer commonViewer){
  event.detail=DND.DROP_NONE;
  IRepositoryNode firstElement=(RepositoryNode)((StructuredSelection)LocalSelectionTransfer.getTransfer().getSelection()).getFirstElement();
  IRepositoryViewObject repViewObj=firstElement.getObject();
  if (repViewObj instanceof MetadataColumnRepositoryObject) {
    DBColumnRepNode column=(DBColumnRepNode)firstElement;
    Table table=(Table)((DropTarget)event.widget).getControl();
    AbstractColumnDropTree viewer=(AbstractColumnDropTree)table.getData();
    if (viewer != null && viewer.canDrop(firstElement)) {
      event.detail=DND.DROP_MOVE;
    }
  }
}
Program: 138475
Project: 138475
Buggy source:
/** 
 * Change connection informations with server, port etc., and update related analyses. MOD yyi 9082 2010-02-25
 */
protected void changeConnectionInformations(){
  if (connectionItem != null) {
    RepositoryNode node=RepositoryNodeHelper.recursiveFind(connectionItem.getConnection());
    IWizard wizard=null;
    if (node != null) {
      if (node instanceof DBConnectionRepNode) {
        wizard=new DatabaseWizard(PlatformUI.getWorkbench(),false,node,null);
      }
 else       if (node instanceof MDMConnectionRepNode) {
        if (PluginChecker.isMDMPluginLoaded() && GlobalServiceRegister.getDefault().isServiceRegistered(IMDMProviderService.class)) {
          IMDMProviderService service=(IMDMProviderService)GlobalServiceRegister.getDefault().getService(IMDMProviderService.class);
          if (service != null) {
            wizard=service.newMDMWizard(PlatformUI.getWorkbench(),false,node,null);
          }
        }
      }
    }
    if (wizard != null) {
      WizardDialog dialog=new WizardDialog(null,wizard);
      dialog.setPageSize(550,550);
      wizard.setContainer(dialog);
      dialog.open();
    }
  }
}

Fixed version (ground truth):
/** 
 * Change connection informations with server, port etc., and update related analyses. MOD yyi 9082 2010-02-25
 */
protected void changeConnectionInformations(){
  if (connectionItem != null) {
    if (connectionItem.eIsProxy()) {
      connectionItem=(ConnectionItem)EObjectHelper.resolveObject(connectionItem);
    }
    RepositoryNode node=RepositoryNodeHelper.recursiveFind(connectionItem.getConnection());
    IWizard wizard=null;
    if (node != null) {
      if (node instanceof DBConnectionRepNode) {
        wizard=new DatabaseWizard(PlatformUI.getWorkbench(),false,node,null);
      }
 else       if (node instanceof MDMConnectionRepNode) {
        if (PluginChecker.isMDMPluginLoaded() && GlobalServiceRegister.getDefault().isServiceRegistered(IMDMProviderService.class)) {
          IMDMProviderService service=(IMDMProviderService)GlobalServiceRegister.getDefault().getService(IMDMProviderService.class);
          if (service != null) {
            wizard=service.newMDMWizard(PlatformUI.getWorkbench(),false,node,null);
          }
        }
      }
    }
    if (wizard != null) {
      WizardDialog dialog=new WizardDialog(null,wizard);
      dialog.setPageSize(550,550);
      wizard.setContainer(dialog);
      dialog.open();
    }
  }
}
Program: 138476
Project: 138476
Buggy source:
protected void initMetaTextFied(){
  Property property=getProperty();
  if (property != null) {
    String name=property.getLabel();
    String purpose=property.getPurpose();
    String description=property.getDescription();
    String author=property.getAuthor().getLogin();
    String version=property.getVersion();
    String devStatus=property.getStatusCode();
    String lockerStr=null;
    ItemState state=property.getItem().getState();
    if (state != null) {
      User locker=state.getLocker();
      if (locker != null) {
        lockerStr=locker.getLogin();
      }
    }
    nameText.setText(name == null ? PluginConstant.EMPTY_STRING : name);
    purposeText.setText(purpose == null ? PluginConstant.EMPTY_STRING : purpose);
    descriptionText.setText(description == null ? PluginConstant.EMPTY_STRING : description);
    authorText.setText(author == null ? PluginConstant.EMPTY_STRING : author);
    authorText.setEnabled(false);
    lockerText.setText(lockerStr == null ? PluginConstant.EMPTY_STRING : lockerStr);
    lockerText.setEnabled(false);
    statusCombo.setText(devStatus == null ? PluginConstant.EMPTY_STRING : devStatus);
  }
}

Fixed version (ground truth):
protected void initMetaTextFied(){
  Property property=getProperty();
  if (property != null) {
    String name=property.getLabel();
    String purpose=property.getPurpose();
    String description=property.getDescription();
    String author=property.getAuthor().getLogin();
    String version=property.getVersion();
    String devStatus=property.getStatusCode();
    String lockerStr=null;
    ItemState state=property.getItem().getState();
    if (state != null) {
      User locker=state.getLocker();
      if (locker != null) {
        lockerStr=locker.getLogin();
      }
    }
    nameText.setText(name == null ? PluginConstant.EMPTY_STRING : name);
    purposeText.setText(purpose == null ? PluginConstant.EMPTY_STRING : purpose);
    descriptionText.setText(description == null ? PluginConstant.EMPTY_STRING : description);
    authorText.setText(author == null ? PluginConstant.EMPTY_STRING : author);
    authorText.setEnabled(false);
    lockerText.setText(lockerStr == null ? PluginConstant.EMPTY_STRING : lockerStr);
    lockerText.setEnabled(false);
    versionText.setText(version == null ? VersionUtils.DEFAULT_VERSION : version);
    statusCombo.setText(devStatus == null ? PluginConstant.EMPTY_STRING : devStatus);
  }
}
Program: 138478
Project: 138478
Buggy source:
/** 
 * DOC qiongli Comment method "getChildren".
 * @param rcBinNode
 * @return
 */
public void loadChildren(RecycleBinRepNode rcBinNode){
  List<RepositoryNode> foldersList=new ArrayList<RepositoryNode>();
  Project newProject=ProjectManager.getInstance().getCurrentProject();
  List<FolderItem> folderItems=newProject.getEmfProject().getFolders();
  for (  FolderItem folder : new ArrayList<FolderItem>(folderItems)) {
    if (WorkbenchUtils.isTDQOrMetadataRootFolder(folder)) {
      addItemToRecycleBin(rcBinNode,folder,foldersList);
    }
  }
  recycleBinChildren=rcBinNode.getChildren();
}

Fixed version (ground truth):
/** 
 * DOC qiongli Comment method "getChildren".
 * @param rcBinNode
 * @return
 */
public void loadChildren(RecycleBinRepNode rcBinNode){
  List<RepositoryNode> foldersList=new ArrayList<RepositoryNode>();
  Project newProject=ProjectManager.getInstance().getCurrentProject();
  List<FolderItem> folderItems=ProjectManager.getInstance().getFolders(newProject.getEmfProject());
  for (  FolderItem folder : new ArrayList<FolderItem>(folderItems)) {
    if (WorkbenchUtils.isTDQOrMetadataRootFolder(folder)) {
      addItemToRecycleBin(rcBinNode,folder,foldersList);
    }
  }
  recycleBinChildren=rcBinNode.getChildren();
}
Program: 138479
Project: 138479
Buggy source:
public void openEditor(Item item){
  Class<?> clazz=null;
  IEditorInput editorInput=null;
  if (item instanceof ConnectionItem) {
    clazz=ConnectionEditor.class;
    editorInput=new ConnectionItemEditorInput(item);
  }
  if (editorInput != null && clazz != null) {
    CorePlugin.getDefault().closeEditorIfOpened(item.getProperty());
    CorePlugin.getDefault().openEditor(editorInput,clazz.getName());
  }
}

Fixed version (ground truth):
public void openEditor(Item item){
  Class<?> clazz=null;
  IEditorInput editorInput=null;
  if (item instanceof ConnectionItem) {
    clazz=ConnectionEditor.class;
    editorInput=new ConnectionItemEditorInput(item);
  }
  if (editorInput != null && clazz != null) {
    CorePlugin.getDefault().closeEditorIfOpened(item);
    CorePlugin.getDefault().openEditor(editorInput,clazz.getName());
  }
}