nus-yam/ex-repair huggingface dataset:
Program: 137642
Project: 137642
Buggy source:
@Override public boolean addElement(String columnName,Analysis analysis){
  if (isAddedAlready(columnName)) {
    return false;
  }
  RecordMatchingIndicator recordMatchingIndiator=MatchRuleAnlaysisUtils.getRecordMatchIndicatorFromAna(analysis);
  if (recordMatchingIndiator == null) {
    log.error("String_Node_Str" + analysis.getName());
    return Boolean.FALSE;
  }
  List<BlockKeyDefinition> bkdList=recordMatchingIndiator.getBuiltInMatchRuleDefinition().getBlockKeys();
  BlockKeyDefinition blockKeyDef=createNewBlockDefinition(columnName);
  bkdList.add(blockKeyDef);
  List<KeyDefinition> keyDefListCopy=new ArrayList<>(bkdList.size());
  keyDefListCopy.addAll(bkdList);
  setInputData(keyDefListCopy);
  return true;
}

Fixed version (ground truth):
@Override public boolean addElement(String columnName,Analysis analysis){
  if (isAddedAlready(columnName)) {
    return false;
  }
  RecordMatchingIndicator recordMatchingIndiator=MatchRuleAnlaysisUtils.getRecordMatchIndicatorFromAna(analysis);
  if (recordMatchingIndiator == null) {
    log.error("String_Node_Str" + analysis.getName());
    return Boolean.FALSE;
  }
  List<BlockKeyDefinition> bkdList=recordMatchingIndiator.getBuiltInMatchRuleDefinition().getBlockKeys();
  BlockKeyDefinition blockKeyDef=createNewBlockDefinition(columnName);
  bkdList.add(blockKeyDef);
  List<KeyDefinition> keyDefListCopy=new ArrayList<KeyDefinition>(bkdList.size());
  keyDefListCopy.addAll(bkdList);
  setInputData(keyDefListCopy);
  return true;
}
Program: 137644
Project: 137644
Buggy source:
public static List<MatchRule> convertDataMapToRuleMatcher(Map<String,String> columnMap){
  List<MatchRule> matcherList=new ArrayList<>();
  if (columnMap == null) {
    return matcherList;
  }
  MatchRule createRuleMatcher=RulesFactory.eINSTANCE.createMatchRule();
  for (  String columnName : columnMap.keySet()) {
    MatchKeyDefinition createDefaultMatchRow=createDefaultMatchRow(columnName);
    createRuleMatcher.getMatchKeys().add(createDefaultMatchRow);
  }
  matcherList.add(createRuleMatcher);
  return matcherList;
}

Fixed version (ground truth):
public static List<MatchRule> convertDataMapToRuleMatcher(Map<String,String> columnMap){
  List<MatchRule> matcherList=new ArrayList<MatchRule>();
  if (columnMap == null) {
    return matcherList;
  }
  MatchRule createRuleMatcher=RulesFactory.eINSTANCE.createMatchRule();
  for (  String columnName : columnMap.keySet()) {
    MatchKeyDefinition createDefaultMatchRow=createDefaultMatchRow(columnName);
    createRuleMatcher.getMatchKeys().add(createDefaultMatchRow);
  }
  matcherList.add(createRuleMatcher);
  return matcherList;
}
Program: 137645
Project: 137645
Buggy source:
/** 
 * DOC yyin Comment method "ruleMatcherConvert".
 * @param blockKeyDef
 * @param columnMap
 * @return
 */
public static List<Map<String,String>> blockingKeyDataConvert(List<KeyDefinition> blockKeyDefList){
  List<Map<String,String>> resultListData=new ArrayList<>();
  for (  KeyDefinition keyDef : blockKeyDefList) {
    BlockKeyDefinition blockKeydef=(BlockKeyDefinition)keyDef;
    Map<String,String> blockKeyDefMap=new HashMap<>();
    blockKeyDefMap.put(MatchAnalysisConstant.COLUMN,blockKeydef.getColumn());
    blockKeyDefMap.put(MatchAnalysisConstant.PRE_ALGORITHM,blockKeydef.getPreAlgorithm().getAlgorithmType());
    blockKeyDefMap.put(MatchAnalysisConstant.PRE_VALUE,blockKeydef.getPreAlgorithm().getAlgorithmParameters());
    blockKeyDefMap.put(MatchAnalysisConstant.ALGORITHM,blockKeydef.getAlgorithm().getAlgorithmType());
    blockKeyDefMap.put(MatchAnalysisConstant.VALUE,blockKeydef.getAlgorithm().getAlgorithmParameters());
    blockKeyDefMap.put(MatchAnalysisConstant.POST_ALGORITHM,blockKeydef.getPostAlgorithm().getAlgorithmType());
    blockKeyDefMap.put(MatchAnalysisConstant.POST_VALUE,blockKeydef.getPostAlgorithm().getAlgorithmParameters());
    resultListData.add(blockKeyDefMap);
  }
  return resultListData;
}

Fixed version (ground truth):
/** 
 * DOC yyin Comment method "ruleMatcherConvert".
 * @param blockKeyDef
 * @param columnMap
 * @return
 */
public static List<Map<String,String>> blockingKeyDataConvert(List<KeyDefinition> blockKeyDefList){
  List<Map<String,String>> resultListData=new ArrayList<Map<String,String>>();
  for (  KeyDefinition keyDef : blockKeyDefList) {
    BlockKeyDefinition blockKeydef=(BlockKeyDefinition)keyDef;
    Map<String,String> blockKeyDefMap=new HashMap<String,String>();
    blockKeyDefMap.put(MatchAnalysisConstant.COLUMN,blockKeydef.getColumn());
    blockKeyDefMap.put(MatchAnalysisConstant.PRE_ALGORITHM,blockKeydef.getPreAlgorithm().getAlgorithmType());
    blockKeyDefMap.put(MatchAnalysisConstant.PRE_VALUE,blockKeydef.getPreAlgorithm().getAlgorithmParameters());
    blockKeyDefMap.put(MatchAnalysisConstant.ALGORITHM,blockKeydef.getAlgorithm().getAlgorithmType());
    blockKeyDefMap.put(MatchAnalysisConstant.VALUE,blockKeydef.getAlgorithm().getAlgorithmParameters());
    blockKeyDefMap.put(MatchAnalysisConstant.POST_ALGORITHM,blockKeydef.getPostAlgorithm().getAlgorithmType());
    blockKeyDefMap.put(MatchAnalysisConstant.POST_VALUE,blockKeydef.getPostAlgorithm().getAlgorithmParameters());
    resultListData.add(blockKeyDefMap);
  }
  return resultListData;
}
Program: 137646
Project: 137646
Buggy source:
/** 
 * DOC zhao Comment method "initTableInput".
 */
private void initTableInput(){
  RecordMatchingIndicator recordMatchingIndicator=MatchRuleAnlaysisUtils.getRecordMatchIndicatorFromAna(analysis);
  List<BlockKeyDefinition> keyDefs=recordMatchingIndicator.getBuiltInMatchRuleDefinition().getBlockKeys();
  List<KeyDefinition> keyDefsCopy=new ArrayList<>(keyDefs.size());
  keyDefsCopy.addAll(keyDefs);
  blockingKeyComposite.setInput(keyDefsCopy);
}

Fixed version (ground truth):
/** 
 * DOC zhao Comment method "initTableInput".
 */
private void initTableInput(){
  RecordMatchingIndicator recordMatchingIndicator=MatchRuleAnlaysisUtils.getRecordMatchIndicatorFromAna(analysis);
  List<BlockKeyDefinition> keyDefs=recordMatchingIndicator.getBuiltInMatchRuleDefinition().getBlockKeys();
  List<KeyDefinition> keyDefsCopy=new ArrayList<KeyDefinition>(keyDefs.size());
  keyDefsCopy.addAll(keyDefs);
  blockingKeyComposite.setInput(keyDefsCopy);
}
Program: 137647
Project: 137647
Buggy source:
/** 
 * save the removed elements(clean depency) in treeviewer.
 */
protected void saveRemovedElements(){
  HashSet<ModelElement> removedElements=this.getTreeViewer().getRemovedElements();
  for (  ModelElement mod : removedElements) {
    EMFUtil.saveSingleResource(mod.eResource());
  }
  this.getTreeViewer().getRemovedElements().clear();
}

Fixed version (ground truth):
/** 
 * save the removed elements(clean depency) in treeviewer.
 */
protected void saveRemovedElements(){
  HashSet<ModelElement> removedElements=this.getTreeViewer().getRemovedElements();
  for (  ModelElement mod : removedElements) {
    if (mod.eIsProxy()) {
      mod=(ModelElement)EObjectHelper.resolveObject(mod);
    }
    if (mod.eResource() == null) {
      log.error("String_Node_Str" + mod.getName() + "String_Node_Str"+ this.getAnalysis().getName());
    }
 else {
      EMFUtil.saveSingleResource(mod.eResource());
    }
  }
  this.getTreeViewer().getRemovedElements().clear();
}
Program: 137648
Project: 137648
Buggy source:
@Override public void partOpened(IWorkbenchPart part){
  if (part instanceof SQLEditor) {
    lockFile(part);
    super.partOpened(part);
    return;
  }
  if (!isCommonFormEditor(part)) {
    return;
  }
  Item item=getItem((IEditorPart)part);
  if (item == null) {
    return;
  }
  CorePlugin.getDefault().refreshWorkSpace();
  if (!ProxyRepositoryFactory.getInstance().isEditableAndLockIfPossible(item)) {
    String message="String_Node_Str";
    ERepositoryStatus status=ProxyRepositoryFactory.getInstance().getStatus(item);
    if (status == ERepositoryStatus.LOCK_BY_OTHER) {
      message=DefaultMessagesImpl.getString("String_Node_Str");
    }
 else {
      message=DefaultMessagesImpl.getString("String_Node_Str");
    }
    MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),"String_Node_Str",part.getTitle() + DefaultMessagesImpl.getString("String_Node_Str") + message);
    lockCommonFormEditor(part);
    WorkspaceResourceHelper.refreshItem(item);
    return;
  }
  WorkspaceResourceHelper.refreshItem(item);
  super.partOpened(part);
}

Fixed version (ground truth):
@Override public void partOpened(IWorkbenchPart part){
  if (part instanceof SQLEditor) {
    lockFile(part);
    super.partOpened(part);
    return;
  }
  if (!isCommonFormEditor(part)) {
    return;
  }
  Item item=getItem((IEditorPart)part);
  if (item == null) {
    return;
  }
  CorePlugin.getDefault().refreshWorkSpace();
  if (!ProxyRepositoryFactory.getInstance().isEditableAndLockIfPossible(item)) {
    lockCommonFormEditor(part);
    WorkspaceResourceHelper.refreshItem(item);
    return;
  }
  WorkspaceResourceHelper.refreshItem(item);
  super.partOpened(part);
}
Program: 137649
Project: 137649
Buggy source:
@Override public void partOpened(IWorkbenchPart part){
  if (part instanceof SQLEditor) {
    lockFile(part);
    super.partOpened(part);
    return;
  }
  if (!isCommonFormEditor(part)) {
    return;
  }
  Item item=getItem((IEditorPart)part);
  if (item == null) {
    return;
  }
  CorePlugin.getDefault().refreshWorkSpace();
  if (!ProxyRepositoryFactory.getInstance().isEditableAndLockIfPossible(item)) {
    String message="String_Node_Str";
    ERepositoryStatus status=ProxyRepositoryFactory.getInstance().getStatus(item);
    if (status == ERepositoryStatus.LOCK_BY_OTHER) {
      message=DefaultMessagesImpl.getString("String_Node_Str");
    }
 else {
      message=DefaultMessagesImpl.getString("String_Node_Str");
    }
    MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),"String_Node_Str",part.getTitle() + DefaultMessagesImpl.getString("String_Node_Str") + message);
    lockCommonFormEditor(part);
    WorkspaceResourceHelper.refreshItem(item);
    return;
  }
  WorkspaceResourceHelper.refreshItem(item);
  super.partOpened(part);
}

Fixed version (ground truth):
@Override public void partOpened(IWorkbenchPart part){
  if (part instanceof SQLEditor) {
    lockFile(part);
    super.partOpened(part);
    return;
  }
  if (!isCommonFormEditor(part)) {
    return;
  }
  Item item=getItem((IEditorPart)part);
  if (item == null) {
    return;
  }
  CorePlugin.getDefault().refreshWorkSpace();
  if (!ProxyRepositoryFactory.getInstance().isEditableAndLockIfPossible(item)) {
    lockCommonFormEditor(part);
    WorkspaceResourceHelper.refreshItem(item);
    return;
  }
  WorkspaceResourceHelper.refreshItem(item);
  super.partOpened(part);
}
Program: 137650
Project: 137650
Buggy source:
/** 
 * DOC hcheng Comment method "getInRangeRowsStatement".
 * @return
 */
private String getInRangeRowsStatement(){
  Double upperValue=null;
  Double lowerValue=null;
  if (indicator instanceof RangeIndicator) {
    upperValue=((RangeIndicator)indicator).getUpperValue().getRealValue();
    lowerValue=((RangeIndicator)indicator).getLowerValue().getRealValue();
  }
 else   if (indicator instanceof IQRIndicator) {
    upperValue=((IQRIndicator)indicator).getUpperValue().getRealValue();
    lowerValue=((IQRIndicator)indicator).getLowerValue().getRealValue();
  }
  String whereClause=dbmsLanguage.where() + this.columnName + dbmsLanguage.greaterOrEqual()+ lowerValue+ dbmsLanguage.and()+ this.columnName+ dbmsLanguage.lessOrEqual()+ upperValue;
  TdColumn column=(TdColumn)indicator.getAnalyzedElement();
  return SELECT_ALL + dbmsLanguage.from() + getFullyQualifiedTableName(column)+ whereClause;
}

Fixed version (ground truth):
/** 
 * DOC hcheng Comment method "getInRangeRowsStatement".
 * @return
 */
private String getInRangeRowsStatement(){
  Double upperValue=null;
  Double lowerValue=null;
  if (indicator instanceof RangeIndicator) {
    upperValue=((RangeIndicator)indicator).getUpperValue().getRealValue();
    lowerValue=((RangeIndicator)indicator).getLowerValue().getRealValue();
  }
 else   if (indicator instanceof IQRIndicator) {
    upperValue=((IQRIndicator)indicator).getUpperValue().getRealValue();
    lowerValue=((IQRIndicator)indicator).getLowerValue().getRealValue();
  }
  String whereClause=dbmsLanguage.where() + this.columnName + dbmsLanguage.greaterOrEqual()+ lowerValue+ dbmsLanguage.and()+ this.columnName+ dbmsLanguage.lessOrEqual()+ upperValue;
  return SELECT_ALL + dbmsLanguage.from() + getFullyQualifiedTableName(indicator.getAnalyzedElement())+ whereClause;
}
Program: 137651
Project: 137651
Buggy source:
public Map<String,String> getQueryMap(){
  Map<String,String> map=new HashMap<String,String>();
switch (indicatorEnum) {
case MeanIndicatorEnum:
    break;
case IQRIndicatorEnum:
case RangeIndicatorEnum:
  map.put(MENU_ROWS_IN_RANGE,getComment(MENU_ROWS_IN_RANGE) + getInRangeRowsStatement());
map.put(MENU_ROWS_OUTSIDE_RANGE,getComment(MENU_ROWS_OUTSIDE_RANGE) + getOutRangeRowsStatement());
break;
default :
if (entity.isOutOfRange(entity.getValue())) {
map.put(MENU_VIEW_INVALID_ROWS,getComment(MENU_VIEW_INVALID_ROWS) + getInvalidRowsStatement());
}
map.put(MENU_VIEW_ROWS,getComment(MENU_VIEW_ROWS) + getMatchingRowsStatement());
}
return map;
}

Fixed version (ground truth):
public Map<String,String> getQueryMap(){
  Map<String,String> map=new HashMap<String,String>();
  boolean isSqlEngine=ExecutionLanguage.SQL.equals(this.analysis.getParameters().getExecutionLanguage());
  boolean isJavaEngine=ExecutionLanguage.JAVA.equals(this.analysis.getParameters().getExecutionLanguage());
  if (isSqlEngine) {
switch (indicatorEnum) {
case MeanIndicatorEnum:
      break;
case IQRIndicatorEnum:
case RangeIndicatorEnum:
    map.put(MENU_ROWS_IN_RANGE,getComment(MENU_ROWS_IN_RANGE) + getInRangeRowsStatement());
  map.put(MENU_ROWS_OUTSIDE_RANGE,getComment(MENU_ROWS_OUTSIDE_RANGE) + getOutRangeRowsStatement());
break;
default :
if (entity.isOutOfRange(entity.getValue())) {
map.put(MENU_VIEW_INVALID_ROWS,getComment(MENU_VIEW_INVALID_ROWS) + getInvalidRowsStatement());
}
map.put(MENU_VIEW_ROWS,getComment(MENU_VIEW_ROWS) + getMatchingRowsStatement());
}
}
 else if (isJavaEngine) {
switch (indicatorEnum) {
case MeanIndicatorEnum:
case IQRIndicatorEnum:
case RangeIndicatorEnum:
break;
default :
map.put(MENU_VIEW_ROWS,null);
}
}
return map;
}
Program: 137652
Project: 137652
Buggy source:
/** 
 * Method "getMatchingRowsStatement".
 * @return the query to get the rows with a matching value
 */
private String getMatchingRowsStatement(){
  double value=Double.valueOf(entity.getValue());
  String whereClause=dbmsLanguage.where() + this.columnName + dbmsLanguage.equal()+ value;
  TdColumn column=(TdColumn)indicator.getAnalyzedElement();
  return SELECT_ALL + dbmsLanguage.from() + getFullyQualifiedTableName(column)+ whereClause;
}

Fixed version (ground truth):
/** 
 * Method "getMatchingRowsStatement".
 * @return the query to get the rows with a matching value
 */
private String getMatchingRowsStatement(){
  double value=Double.valueOf(entity.getValue());
  String whereClause=dbmsLanguage.where() + this.columnName + dbmsLanguage.equal()+ value;
  return SELECT_ALL + dbmsLanguage.from() + getFullyQualifiedTableName(indicator.getAnalyzedElement())+ whereClause;
}
Program: 137657
Project: 137657
Buggy source:
public void modifyText(ModifyEvent e){
  String textContent=maxNumText.getText();
  if (StringUtils.isNumeric(textContent)) {
    setDirty(true);
  }
 else {
    MessageDialog.openWarning(e.display.getActiveShell(),DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"));
    maxNumText.setText(textContent.substring(0,textContent.length() - 1));
  }
}

Fixed version (ground truth):
public void modifyText(ModifyEvent e){
  setDirty(true);
}
Program: 137659
Project: 137659
Buggy source:
public void modifyText(ModifyEvent e){
  String textContent=maxNumText.getText();
  if (StringUtils.isNumeric(textContent)) {
    setDirty(true);
  }
 else {
    MessageDialog.openWarning(e.display.getActiveShell(),DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"));
    maxNumText.setText(textContent.substring(0,textContent.length() - 1));
  }
}

Fixed version (ground truth):
public void modifyText(ModifyEvent e){
  setDirty(true);
}
Program: 137660
Project: 137660
Buggy source:
@Before public void setup(){
  indiDefinition=mock(IndicatorDefinition.class);
  EList<TdExpression> tdExpessionLs=new BasicEList<TdExpression>();
  TdExpression tdExpression1=BooleanExpressionHelper.createTdExpression("String_Node_Str","String_Node_Str");
  TdExpression tdExpression2=BooleanExpressionHelper.createTdExpression("String_Node_Str","String_Node_Str");
  tdExpessionLs.add(tdExpression1);
  tdExpessionLs.add(tdExpression2);
  when(indiDefinition.getSqlGenericExpression()).thenReturn(tdExpessionLs);
}

Fixed version (ground truth):
@Before public void setup(){
  indiDefinition=mock(IndicatorDefinition.class);
  EList<TdExpression> tdExpessionLs=new BasicEList<TdExpression>();
  TdExpression tdExpression1=BooleanExpressionHelper.createTdExpression("String_Node_Str","String_Node_Str");
  TdExpression tdExpression2=BooleanExpressionHelper.createTdExpression("String_Node_Str","String_Node_Str");
  tdExpessionLs.add(tdExpression1);
  tdExpessionLs.add(tdExpression2);
  when(indiDefinition.getSqlGenericExpression()).thenReturn(tdExpessionLs);
  UnitTestBuildHelper.deleteCurrentProject("String_Node_Str");
  UnitTestBuildHelper.createRealProject("String_Node_Str");
}
Program: 137661
Project: 137661
Buggy source:
/** 
 * DOC bZhou Comment method "saveAndRefresh".
 */
private void saveAndRefresh(){
  ProxyRepositoryManager.getInstance().save();
  CorePlugin.getDefault().refreshDQView(node);
  CorePlugin.getDefault().refreshWorkSpace();
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "saveAndRefresh".
 */
private void saveAndRefresh(){
  CorePlugin.getDefault().refreshDQView(node);
}
Program: 137662
Project: 137662
Buggy source:
/** 
 * Remove all items from parent
 */
private void clearParent(){
  Control[] children=_parent.getChildren();
  if (children != null) {
    for (int i=0; i < children.length; i++) {
      children[i].dispose();
    }
  }
}

Fixed version (ground truth):
/** 
 * Remove all items from parent
 */
private void clearParent(){
  Control[] children=_parent.getChildren();
  if (children != null) {
    for (    Control element : children) {
      element.dispose();
    }
  }
}
Program: 137663
Project: 137663
Buggy source:
/** 
 * Adds a new user
 * @param user
 */
public void addUser(final User user) throws SQLCannotConnectException {
  for (  Session session : _allSessions)   if (session.getUser() == user)   return;
  MetaDataSession session=user.getMetaDataSession();
  if (session != null)   addSession(user.getMetaDataSession());
}

Fixed version (ground truth):
/** 
 * Adds a new user
 * @param user
 */
public void addUser(final User user) throws SQLCannotConnectException {
  for (  Session session : _allSessions) {
    if (session.getUser() == user) {
      return;
    }
  }
  MetaDataSession session=user.getMetaDataSession();
  if (session != null) {
    addSession(user.getMetaDataSession());
  }
}
Program: 137664
Project: 137664
Buggy source:
public void dragStart(DragSourceEvent event){
  event.doit=!treeViewer.getSelection().isEmpty();
  if (event.doit) {
    Object sel=((IStructuredSelection)treeViewer.getSelection()).getFirstElement();
    if (!(sel instanceof TableNode)) {
      event.doit=false;
    }
 else {
      TableNode tn=(TableNode)sel;
      TableNodeTransfer.getInstance().setSelection(tn);
      if (!tn.isTable())       event.doit=false;
    }
  }
}

Fixed version (ground truth):
public void dragStart(DragSourceEvent event){
  event.doit=!treeViewer.getSelection().isEmpty();
  if (event.doit) {
    Object sel=((IStructuredSelection)treeViewer.getSelection()).getFirstElement();
    if (!(sel instanceof TableNode)) {
      event.doit=false;
    }
 else {
      TableNode tn=(TableNode)sel;
      TableNodeTransfer.getInstance().setSelection(tn);
      if (!tn.isTable()) {
        event.doit=false;
      }
    }
  }
}
Program: 137665
Project: 137665
Buggy source:
/** 
 * Loop through all tabs and refresh trees for sessions with session
 */
public void refreshSessionTrees(Session session){
  if (_tabFolder == null || _tabFolder.getSelectionIndex() < 0)   return;
  CTabItem[] items=_tabFolder.getItems();
  if (items != null) {
    for (    CTabItem item : items) {
      TabData tabData=(TabData)item.getData();
      if (tabData.session.getUser() == session.getUser()) {
        tabData.session.getRoot().refresh();
        tabData.treeViewer.refresh();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Loop through all tabs and refresh trees for sessions with session
 */
public void refreshSessionTrees(Session session){
  if (_tabFolder == null || _tabFolder.getSelectionIndex() < 0) {
    return;
  }
  CTabItem[] items=_tabFolder.getItems();
  if (items != null) {
    for (    CTabItem item : items) {
      TabData tabData=(TabData)item.getData();
      if (tabData.session.getUser() == session.getUser()) {
        tabData.session.getRoot().refresh();
        tabData.treeViewer.refresh();
      }
    }
  }
}
Program: 137666
Project: 137666
Buggy source:
public void close(CTabFolderEvent event){
  CTabItem tabItem=(CTabItem)event.item;
  TabData tabData=(TabData)tabItem.getData();
  _allSessions.remove(tabData.session);
  event.doit=true;
}

Fixed version (ground truth):
@Override public void close(CTabFolderEvent event){
  CTabItem tabItem=(CTabItem)event.item;
  TabData tabData=(TabData)tabItem.getData();
  _allSessions.remove(tabData.session);
  event.doit=true;
}
Program: 137667
Project: 137667
Buggy source:
/** 
 * DOC qiongli Comment method "closeCurrentCabItem".bug 16394.
 */
public void closeCurrentCabItem(String conName){
  if (_tabFolder == null || _tabFolder.isDisposed() || conName == null)   return;
  CTabItem items[]=_tabFolder.getItems();
  for (  CTabItem item : items) {
    if (!item.isDisposed() && item.getText().startsWith(conName + "String_Node_Str")) {
      TabData tabData=(TabData)item.getData();
      _allSessions.remove(tabData.session);
      item.dispose();
      this.dispose();
      _filterAction.setEnabled(!_allSessions.isEmpty());
      _tabFolder.layout();
      _tabFolder.redraw();
      break;
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC qiongli Comment method "closeCurrentCabItem".bug 16394.
 */
public void closeCurrentCabItem(String conName){
  if (_tabFolder == null || _tabFolder.isDisposed() || conName == null) {
    return;
  }
  CTabItem items[]=_tabFolder.getItems();
  for (  CTabItem item : items) {
    if (!item.isDisposed() && item.getText().startsWith(conName + "String_Node_Str")) {
      TabData tabData=(TabData)item.getData();
      _allSessions.remove(tabData.session);
      _filterAction.setEnabled(!_allSessions.isEmpty());
      _tabFolder.layout();
      _tabFolder.redraw();
      item.dispose();
      this.dispose();
      break;
    }
  }
}
Program: 137668
Project: 137668
Buggy source:
public void widgetSelected(SelectionEvent e){
  DatabaseDetailView detailView=(DatabaseDetailView)getSite().getPage().findView(SqlexplorerViewConstants.SQLEXPLORER_DBDETAIL);
  synchronizeDetailView(detailView);
}

Fixed version (ground truth):
@Override public void widgetSelected(SelectionEvent e){
  DatabaseDetailView detailView=(DatabaseDetailView)getSite().getPage().findView(SqlexplorerViewConstants.SQLEXPLORER_DBDETAIL);
  synchronizeDetailView(detailView);
}
Program: 137669
Project: 137669
Buggy source:
/** 
 * Set focus on our database structure view..
 * @see org.eclipse.ui.IWorkbenchPart#setFocus()
 */
public void setFocus(){
}

Fixed version (ground truth):
/** 
 * Set focus on our database structure view..
 * @see org.eclipse.ui.IWorkbenchPart#setFocus()
 */
@Override public void setFocus(){
}
Program: 137670
Project: 137670
Buggy source:
public boolean isConnectedToUser(User user){
  for (  Session session : _allSessions)   if (session.getUser().compareTo(user) == 0)   return true;
  return false;
}

Fixed version (ground truth):
public boolean isConnectedToUser(User user){
  for (  Session session : _allSessions) {
    if (session.getUser().compareTo(user) == 0) {
      return true;
    }
  }
  return false;
}
Program: 137672
Project: 137672
Buggy source:
/** 
 * Cleanup and reset detail view.
 * @see org.eclipse.ui.IWorkbenchPart#dispose()
 */
public void dispose(){
  DatabaseDetailView detailView=(DatabaseDetailView)getSite().getPage().findView(SqlexplorerViewConstants.SQLEXPLORER_DBDETAIL);
  if (detailView != null) {
    detailView.setSelectedNode(null);
    detailView.dispose();
  }
  _allSessions.clear();
  if (_tabFolder != null && !_tabFolder.isDisposed()) {
    _tabFolder.dispose();
  }
  SQLExplorerPlugin.getDefault().setDatabaseStructureView(null);
}

Fixed version (ground truth):
/** 
 * Cleanup and reset detail view.
 * @see org.eclipse.ui.IWorkbenchPart#dispose()
 */
@Override public void dispose(){
  DatabaseDetailView detailView=(DatabaseDetailView)getSite().getPage().findView(SqlexplorerViewConstants.SQLEXPLORER_DBDETAIL);
  if (detailView != null) {
    detailView.setSelectedNode(null);
  }
  _allSessions.clear();
  if (_tabFolder != null && !_tabFolder.isDisposed()) {
    _tabFolder.dispose();
  }
  SQLExplorerPlugin.getDefault().setDatabaseStructureView(null);
}
Program: 137673
Project: 137673
Buggy source:
/** 
 * Initializes the view and creates the root tabfolder that holds all the sessions.
 * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
 */
public void createPartControl(Composite parent){
  PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,SQLExplorerPlugin.PLUGIN_ID + "String_Node_Str");
  _parent=parent;
  if (_allSessions.isEmpty()) {
    setDefaultMessage();
  }
  _filterAction=new FilterStructureAction();
  _filterAction.setEnabled(!_allSessions.isEmpty());
  IToolBarManager toolBarMgr=getViewSite().getActionBars().getToolBarManager();
  toolBarMgr.add(_filterAction);
}

Fixed version (ground truth):
/** 
 * Initializes the view and creates the root tabfolder that holds all the sessions.
 * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
 */
@Override public void createPartControl(Composite parent){
  PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,SQLExplorerPlugin.PLUGIN_ID + "String_Node_Str");
  _parent=parent;
  if (_allSessions.isEmpty()) {
    setDefaultMessage();
  }
  _filterAction=new FilterStructureAction();
  _filterAction.setEnabled(!_allSessions.isEmpty());
  IToolBarManager toolBarMgr=getViewSite().getActionBars().getToolBarManager();
  toolBarMgr.add(_filterAction);
}
Program: 137674
Project: 137674
Buggy source:
public MetaDataSession getSession(){
  if (_tabFolder == null || _tabFolder.getSelectionIndex() < 0)   return null;
  CTabItem item=_tabFolder.getItem(_tabFolder.getSelectionIndex());
  TabData tabData=(TabData)item.getData();
  return tabData.session;
}

Fixed version (ground truth):
public MetaDataSession getSession(){
  if (_tabFolder == null || _tabFolder.getSelectionIndex() < 0) {
    return null;
  }
  CTabItem item=_tabFolder.getItem(_tabFolder.getSelectionIndex());
  TabData tabData=(TabData)item.getData();
  return tabData.session;
}
Program: 137675
Project: 137675
Buggy source:
/** 
 * DOC qiongli Comment method "updateConnetionAliasByName".
 * @param connection
 * @param aliasName
 */
public void updateConnetionAliasByName(Connection connection,String aliasName){
  if (connection == null || aliasName == null) {
    return;
  }
  SQLExplorerPlugin sqlPlugin=SQLExplorerPlugin.getDefault();
  DatabaseStructureView view=sqlPlugin.getDatabaseStructureView();
  if (view != null) {
    view.closeCurrentCabItem(aliasName);
  }
  AliasManager aliasManager=sqlPlugin.getAliasManager();
  Alias alias=aliasManager.getAlias(aliasName);
  if (alias != null) {
    try {
      aliasManager.removeAlias(aliasName);
      aliasManager.saveAliases();
      aliasManager.modelChanged();
      addConnetionAliasToSQLPlugin(connection);
    }
 catch (    Exception e) {
      log.error(e,e);
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC qiongli Comment method "updateConnetionAliasByName".
 * @param connection
 * @param aliasName
 */
public void updateConnetionAliasByName(Connection connection,String aliasName){
  if (connection == null || aliasName == null) {
    return;
  }
  SQLExplorerPlugin sqlPlugin=SQLExplorerPlugin.getDefault();
  IWorkbenchPage page=sqlPlugin.getActivePage();
  if (page != null) {
    DatabaseStructureView view=(DatabaseStructureView)page.findView(DatabaseStructureView.class.getName());
    if (view != null) {
      view.closeCurrentCabItem(aliasName);
    }
  }
 else {
    log.error("String_Node_Str");
  }
  AliasManager aliasManager=sqlPlugin.getAliasManager();
  Alias alias=aliasManager.getAlias(aliasName);
  if (alias != null) {
    try {
      aliasManager.removeAlias(aliasName);
      aliasManager.saveAliases();
      aliasManager.modelChanged();
      addConnetionAliasToSQLPlugin(connection);
    }
 catch (    Exception e) {
      log.error(e,e);
    }
  }
}
Program: 137676
Project: 137676
Buggy source:
private static boolean containsJavaUDI(IndicatorDefinition definition){
  EList<TaggedValue> tvs=definition.getTaggedValue();
  int findCount=0;
  for (  TaggedValue tv : tvs) {
    if (tv.getTag().equals(TaggedValueHelper.CLASS_NAME_TEXT)) {
      findCount++;
    }
 else     if (tv.getTag().equals(TaggedValueHelper.JAR_FILE_PATH)) {
      findCount++;
    }
    if (findCount == 2) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public static boolean containsJavaUDI(IndicatorDefinition definition){
  EList<TaggedValue> tvs=definition.getTaggedValue();
  int findCount=0;
  for (  TaggedValue tv : tvs) {
    if (tv.getTag().equals(TaggedValueHelper.CLASS_NAME_TEXT)) {
      findCount++;
    }
 else     if (tv.getTag().equals(TaggedValueHelper.JAR_FILE_PATH)) {
      findCount++;
    }
    if (findCount == 2) {
      return true;
    }
  }
  return false;
}
Program: 137677
Project: 137677
Buggy source:
/** 
 * Returns unused connections
 * @return
 */
public List<SQLConnection> getUnusedConnections(){
  LinkedList<SQLConnection> result=new LinkedList<SQLConnection>();
  result.addAll(allocated);
  result.addAll(unused);
  return result;
}

Fixed version (ground truth):
/** 
 * Returns unused connections
 * @return
 */
public List<SQLConnection> getUnusedConnections(){
  LinkedList<SQLConnection> result=new LinkedList<SQLConnection>();
  result.addAll(unused);
  return result;
}
Program: 137679
Project: 137679
Buggy source:
private boolean hasChildrenInDataBase(){
  boolean hasChildrenInDB=false;
  IRepositoryViewObject object=this.getParent().getObject();
  if (object instanceof MetadataCatalogRepositoryObject) {
    viewObject=((MetadataCatalogRepositoryObject)object).getViewObject();
    item=(ConnectionItem)viewObject.getProperty().getItem();
    connection=item.getConnection();
    catalog=((MetadataCatalogRepositoryObject)object).getCatalog();
    try {
      hasChildrenInDB=DqRepositoryViewService.isContainsTable(connection,catalog,null);
    }
 catch (    Exception e) {
      log.error(e.toString());
    }
  }
 else {
    viewObject=((MetadataSchemaRepositoryObject)object).getViewObject();
    item=(ConnectionItem)viewObject.getProperty().getItem();
    connection=item.getConnection();
    schema=((MetadataSchemaRepositoryObject)object).getSchema();
    try {
      hasChildrenInDB=DqRepositoryViewService.isContainsTable(connection,schema,null);
    }
 catch (    RuntimeException e) {
      throw new RuntimeException(e);
    }
catch (    Exception e) {
      log.error(e.toString());
    }
  }
  return hasChildrenInDB;
}

Fixed version (ground truth):
private boolean hasChildrenInDataBase(){
  boolean hasChildrenInDB=false;
  IRepositoryViewObject object=this.getParent().getObject();
  if (object instanceof MetadataCatalogRepositoryObject) {
    viewObject=((MetadataCatalogRepositoryObject)object).getViewObject();
    item=(ConnectionItem)viewObject.getProperty().getItem();
    connection=item.getConnection();
    catalog=((MetadataCatalogRepositoryObject)object).getCatalog();
    try {
      hasChildrenInDB=DqRepositoryViewService.isContainsTable(connection,catalog,null);
    }
 catch (    Exception e) {
      log.error(e.toString());
    }
  }
 else {
    viewObject=((MetadataSchemaRepositoryObject)object).getViewObject();
    item=(ConnectionItem)viewObject.getProperty().getItem();
    connection=item.getConnection();
    schema=((MetadataSchemaRepositoryObject)object).getSchema();
    try {
      hasChildrenInDB=DqRepositoryViewService.isContainsTable(connection,schema,null);
    }
 catch (    MissingDriverException e) {
      throw e;
    }
catch (    Exception e) {
      log.error(e.toString());
    }
  }
  return hasChildrenInDB;
}
Program: 137680
Project: 137680
Buggy source:
private boolean hasChildrenInDataBase(){
  boolean hasChildrenInDB=false;
  IRepositoryViewObject object=this.getParent().getObject();
  if (object instanceof MetadataCatalogRepositoryObject) {
    viewObject=((MetadataCatalogRepositoryObject)object).getViewObject();
    item=(ConnectionItem)viewObject.getProperty().getItem();
    connection=item.getConnection();
    catalog=((MetadataCatalogRepositoryObject)object).getCatalog();
    try {
      hasChildrenInDB=DqRepositoryViewService.isContainsView(connection,catalog,null);
    }
 catch (    Exception e) {
      log.error(e.toString());
    }
  }
 else {
    viewObject=((MetadataSchemaRepositoryObject)object).getViewObject();
    item=(ConnectionItem)viewObject.getProperty().getItem();
    connection=item.getConnection();
    schema=((MetadataSchemaRepositoryObject)object).getSchema();
    try {
      hasChildrenInDB=DqRepositoryViewService.isContainsView(connection,schema,null);
    }
 catch (    RuntimeException e) {
      throw new RuntimeException(e);
    }
catch (    Exception e) {
      log.error(e.toString());
    }
  }
  return hasChildrenInDB;
}

Fixed version (ground truth):
private boolean hasChildrenInDataBase(){
  boolean hasChildrenInDB=false;
  IRepositoryViewObject object=this.getParent().getObject();
  if (object instanceof MetadataCatalogRepositoryObject) {
    viewObject=((MetadataCatalogRepositoryObject)object).getViewObject();
    item=(ConnectionItem)viewObject.getProperty().getItem();
    connection=item.getConnection();
    catalog=((MetadataCatalogRepositoryObject)object).getCatalog();
    try {
      hasChildrenInDB=DqRepositoryViewService.isContainsView(connection,catalog,null);
    }
 catch (    Exception e) {
      log.error(e.toString());
    }
  }
 else {
    viewObject=((MetadataSchemaRepositoryObject)object).getViewObject();
    item=(ConnectionItem)viewObject.getProperty().getItem();
    connection=item.getConnection();
    schema=((MetadataSchemaRepositoryObject)object).getSchema();
    try {
      hasChildrenInDB=DqRepositoryViewService.isContainsView(connection,schema,null);
    }
 catch (    MissingDriverException e) {
      throw e;
    }
catch (    Exception e) {
      log.error(e.toString());
    }
  }
  return hasChildrenInDB;
}
Program: 137683
Project: 137683
Buggy source:
private boolean isNeedAddDriverConnection(IRepositoryNode repNode){
  ERepositoryObjectType objectType=repNode.getObjectType();
  if (objectType == ERepositoryObjectType.METADATA_CONNECTIONS) {
    ConnectionItem connectionItem=(ConnectionItem)repNode.getObject().getProperty().getItem();
    if (connectionItem.getConnection() instanceof DatabaseConnection) {
      IMetadataConnection metadataConnection=ConvertionHelper.convert(connectionItem.getConnection());
      try {
        MetadataConnectionUtils.getClassDriver(metadataConnection);
      }
 catch (      RuntimeException e) {
        int indexOf=e.getMessage().indexOf("String_Node_Str");
        if (indexOf > 0) {
          return true;
        }
 else {
          log.error(e,e);
        }
      }
catch (      Exception e) {
        log.error(e,e);
      }
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean isNeedAddDriverConnection(IRepositoryNode repNode){
  ERepositoryObjectType objectType=repNode.getObjectType();
  if (objectType == ERepositoryObjectType.METADATA_CONNECTIONS) {
    ConnectionItem connectionItem=(ConnectionItem)repNode.getObject().getProperty().getItem();
    if (connectionItem.getConnection() instanceof DatabaseConnection) {
      IMetadataConnection metadataConnection=ConvertionHelper.convert(connectionItem.getConnection());
      try {
        if (!EDatabaseTypeName.HIVE.getXmlName().equalsIgnoreCase(metadataConnection.getDbType())) {
          MetadataConnectionUtils.getClassDriver(metadataConnection);
        }
      }
 catch (      MissingDriverException e) {
        return true;
      }
catch (      Exception e) {
        log.error(e,e);
      }
    }
  }
  return false;
}
Program: 137685
Project: 137685
Buggy source:
/** 
 * get the jrxml folder according to the Report file(if the Report file is out of current workspace, the Jrxml Folder should also out of it).
 * @param rep the Report file
 * @param folder the Jrxml Folder in the current project
 * @return
 */
private File getJrxmlFolderFromReport(TdReport rep,IFolder folder){
  File jrxmlFolderFile=null;
  String repFileString=rep.eResource().getURI().toFileString();
  String projectString=folder.getProject().getLocation().toString();
  if (repFileString.startsWith(projectString)) {
    jrxmlFolderFile=folder.getLocation().toFile();
  }
 else {
    String jrxmlFolderString=folder.getLocation().toString();
    jrxmlFolderFile=new File(jrxmlFolderString.replaceFirst(projectString,repFileString.substring(0,repFileString.indexOf(EResourceConstant.DATA_PROFILING.getPath()) - 1)));
  }
  return jrxmlFolderFile;
}

Fixed version (ground truth):
/** 
 * get the jrxml folder according to the Report file(if the Report file is out of current workspace, the Jrxml Folder should also out of it).
 * @param rep the Report file
 * @param folder the Jrxml Folder in the current project
 * @return
 */
private File getJrxmlFolderFromReport(TdReport rep,IFolder folder){
  File jrxmlFolderFile=null;
  String repFileString=new File(rep.eResource().getURI().toFileString()).getAbsolutePath();
  String projectString=folder.getProject().getLocation().toFile().getAbsolutePath();
  if (repFileString.startsWith(projectString)) {
    jrxmlFolderFile=folder.getLocation().toFile();
  }
 else {
    String jrxmlFolderString=folder.getLocation().toFile().getAbsolutePath();
    jrxmlFolderFile=new File(jrxmlFolderString.replaceFirst(projectString,repFileString.substring(0,repFileString.indexOf(EResourceConstant.DATA_PROFILING.getPath()) - 1)));
  }
  return jrxmlFolderFile;
}
Program: 137686
Project: 137686
Buggy source:
private void writeToFile(String content) throws FileNotFoundException {
  BufferedOutputStream stream=new BufferedOutputStream(new FileOutputStream(file));
  try {
    stream.write(content.getBytes());
  }
 catch (  IOException e) {
    Assert.fail("String_Node_Str");
  }
 finally {
    if (stream != null) {
      try {
        stream.close();
      }
 catch (      IOException e) {
        Assert.fail("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
private void writeToFile(String content) throws FileNotFoundException {
  BufferedOutputStream stream=new BufferedOutputStream(new FileOutputStream(file.getAbsoluteFile()));
  try {
    stream.write(content.getBytes());
  }
 catch (  IOException e) {
    Assert.fail("String_Node_Str");
  }
 finally {
    if (stream != null) {
      try {
        stream.close();
      }
 catch (      IOException e) {
        Assert.fail("String_Node_Str");
      }
    }
  }
}
Program: 137687
Project: 137687
Buggy source:
@Override protected int getHScrollSelectionInPixels(){
  ScrollBar hScrollBar=getHorizontalBar();
  int res=hScrollBar.getSelection() * COLUMN_WIDTH;
  int max=hScrollBar.getMaximum();
  if (max > 1 && hScrollBar.getSelection() >= max - 3) {
    return res + 100;
  }
  return res;
}

Fixed version (ground truth):
@Override protected int getHScrollSelectionInPixels(){
  ScrollBar hScrollBar=getHorizontalBar();
  int res=hScrollBar.getSelection() * COLUMN_WIDTH;
  int max=hScrollBar.getMaximum();
  if (max > 3 && hScrollBar.getSelection() >= max - 3) {
    return res + 100;
  }
  return res;
}
Program: 137688
Project: 137688
Buggy source:
/** 
 * DOC bZhou Comment method "initConnectionItem".
 * @param tdDataProvider
 * @return
 */
private ConnectionItem initConnectionItem(DatabaseConnection tdDataProvider,Package pack){
  ConnectionItem connectionItem=PropertiesFactory.eINSTANCE.createDatabaseConnectionItem();
  if (tdDataProvider != null) {
    IMetadataConnection newMetadataConnection=ConvertionHelper.convert(tdDataProvider);
    String connName=tdDataProvider.getName();
    newMetadataConnection.setLabel(connName + "String_Node_Str" + pack.getName());
    String database=pack.getName();
    if (pack instanceof Schema) {
      Package parent=ColumnSetHelper.getParentCatalogOrSchema(pack);
      if (parent != null) {
        database=parent.getName();
      }
 else {
        database=tdDataProvider.getSID();
      }
      newMetadataConnection.setUiSchema(pack.getName());
    }
    newMetadataConnection.setDatabase(database);
    DatabaseConnection newConnection=fillCatalogSchema(newMetadataConnection);
    connectionItem.setConnection(newConnection);
  }
  return connectionItem;
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "initConnectionItem".
 * @param tdDataProvider
 * @return
 */
private ConnectionItem initConnectionItem(DatabaseConnection tdDataProvider,Package pack){
  ConnectionItem connectionItem=PropertiesFactory.eINSTANCE.createDatabaseConnectionItem();
  if (tdDataProvider != null) {
    IMetadataConnection newMetadataConnection=ConvertionHelper.convert(tdDataProvider);
    String connName=tdDataProvider.getName();
    newMetadataConnection.setLabel(connName + "String_Node_Str" + pack.getName());
    String database=pack.getName();
    if (pack instanceof Schema) {
      Package parent=ColumnSetHelper.getParentCatalogOrSchema(pack);
      if (parent != null) {
        database=parent.getName();
      }
 else {
        database=tdDataProvider.getSID();
      }
      newMetadataConnection.setUiSchema(pack.getName());
      if (EDatabaseTypeName.TERADATA.getXmlName().equalsIgnoreCase(tdDataProvider.getDatabaseType())) {
        if (database.isEmpty()) {
          database=pack.getName();
        }
      }
    }
    newMetadataConnection.setDatabase(database);
    DatabaseConnection newConnection=fillCatalogSchema(newMetadataConnection);
    connectionItem.setConnection(newConnection);
  }
  return connectionItem;
}
Program: 137689
Project: 137689
Buggy source:
@Override protected int getHScrollSelectionInPixels(){
  ScrollBar hScrollBar=getHorizontalBar();
  int res=hScrollBar.getSelection() * COLUMN_WIDTH;
  int max=hScrollBar.getMaximum();
  if (max > 3 && hScrollBar.getSelection() >= max - 3) {
    return res + 100;
  }
  return res;
}

Fixed version (ground truth):
@Override protected int getHScrollSelectionInPixels(){
  ScrollBar hScrollBar=getHorizontalBar();
  int res=hScrollBar.getSelection() * COLUMN_WIDTH;
  int max=hScrollBar.getMaximum();
  if (max > 1 && hScrollBar.getSelection() >= max - 1) {
    return res + 100;
  }
  return res;
}
Program: 137690
Project: 137690
Buggy source:
public void widgetSelected(SelectionEvent e){
  ReturnCode rc=selectedObjectAvailable();
  if (rc.isOk()) {
    dataProvider=callChangeConnectionAction(masterPage,prevSelect,dataProvider);
    prevSelect=masterPage.getConnCombo().getSelectionIndex();
  }
 else {
    MessageDialogWithToggle.openError(null,DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str",rc.getMessage()));
    masterPage.reloadDataproviderAndFillConnCombo();
    masterPage.getConnCombo().removeSelectionListener(selectionListener);
    String uuid=ResourceHelper.getUUID(dataProvider);
    if (uuid != null) {
      int itemCount=masterPage.getConnCombo().getItemCount();
      for (int i=0; i < itemCount; i++) {
        Object connectionObj=masterPage.getConnCombo().getData(String.valueOf(i));
        RepositoryNode repoNode=(RepositoryNode)connectionObj;
        Connection connection=getConnectionFromRepositoryNode(repoNode);
        if (connection != null && uuid.endsWith(ResourceHelper.getUUID(connection))) {
          masterPage.getConnCombo().select(i);
          break;
        }
      }
    }
    masterPage.getConnCombo().addSelectionListener(selectionListener);
  }
}

Fixed version (ground truth):
public void widgetSelected(SelectionEvent e){
  ReturnCode rc=selectedObjectAvailable();
  if (rc.isOk()) {
    if (dataProvider.eIsProxy()) {
      dataProvider=(Connection)EObjectHelper.resolveObject(dataProvider);
    }
    dataProvider=callChangeConnectionAction(masterPage,prevSelect,dataProvider);
    prevSelect=masterPage.getConnCombo().getSelectionIndex();
  }
 else {
    MessageDialogWithToggle.openError(null,DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str",rc.getMessage()));
    masterPage.reloadDataproviderAndFillConnCombo();
    masterPage.getConnCombo().removeSelectionListener(selectionListener);
    String uuid=ResourceHelper.getUUID(dataProvider);
    if (uuid != null) {
      int itemCount=masterPage.getConnCombo().getItemCount();
      for (int i=0; i < itemCount; i++) {
        Object connectionObj=masterPage.getConnCombo().getData(String.valueOf(i));
        RepositoryNode repoNode=(RepositoryNode)connectionObj;
        Connection connection=getConnectionFromRepositoryNode(repoNode);
        if (connection != null && uuid.endsWith(ResourceHelper.getUUID(connection))) {
          masterPage.getConnCombo().select(i);
          break;
        }
      }
    }
    masterPage.getConnCombo().addSelectionListener(selectionListener);
  }
}
Program: 137697
Project: 137697
Buggy source:
public ExecutionResultImpl(AbstractDatabaseProduct product,Statement stmt,boolean hasResults,LinkedList<NamedParameter> parameters,int maxRows) throws SQLException {
  super();
  this.product=product;
  this.stmt=stmt;
  this.parameters=parameters;
  this.maxRows=maxRows;
  if (!hasResults)   state=State.SECONDARY_RESULTS;
}

Fixed version (ground truth):
public ExecutionResultImpl(AbstractDatabaseProduct product,Statement stmt,boolean hasResults,LinkedList<NamedParameter> parameters,int maxRows) throws SQLException {
  super();
  this.product=product;
  this.stmt=stmt;
  this.parameters=parameters;
  this.maxRows=maxRows;
  if (!hasResults) {
    state=State.SECONDARY_RESULTS;
  }
}
Program: 137699
Project: 137699
Buggy source:
public void close() throws SQLException {
  try {
    stmt.close();
  }
 catch (  SQLException e) {
  }
  if (currentResultSet != null)   currentResultSet.close();
}

Fixed version (ground truth):
public void close() throws SQLException {
  try {
    stmt.close();
  }
 catch (  SQLException e) {
  }
  if (currentResultSet != null) {
    currentResultSet.close();
  }
}