nus-yam/ex-repair huggingface dataset:
Program: 137305
Project: 137305
Buggy source:
@Override protected ReturnCode removeDependencies(Item item){
  ReturnCode rc=new ReturnCode();
  TDQAnalysisItem anaItem=(TDQAnalysisItem)item;
  Analysis analysis=anaItem.getAnalysis();
  List<Property> clintDependency=DependenciesHandler.getInstance().getClintDependency(anaItem.getProperty());
  List<ModelElement> getClientDepListByResultList=getClientDepListByResult(analysis);
  for (  Property currentClient : clintDependency) {
    ModelElement modelElement=PropertyHelper.getModelElement(currentClient);
    if (!getClientDepListByResultList.contains(modelElement)) {
      boolean isSuccess=DependenciesHandler.getInstance().removeDependenciesBetweenModel(analysis,modelElement);
      if (isSuccess) {
        try {
          ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider().getResourceManager().saveResource(modelElement.eResource());
        }
 catch (        PersistenceException e) {
          log.error(e,e);
          rc.setOk(false);
          rc.setMessage(e.getMessage());
        }
      }
 else {
        rc.setOk(false);
        rc.setMessage(Messages.getString("String_Node_Str",analysis.getName(),modelElement.getName()));
      }
    }
  }
  return rc;
}

Fixed version (ground truth):
@Override protected ReturnCode removeDependencies(Item item){
  ReturnCode rc=new ReturnCode();
  TDQAnalysisItem anaItem=(TDQAnalysisItem)item;
  Analysis analysis=anaItem.getAnalysis();
  List<Property> clintDependency=DependenciesHandler.getInstance().getClintDependency(anaItem.getProperty());
  List<ModelElement> clientDepListByResultList=getClientDepListByResult(analysis);
  for (  Property currentClient : clintDependency) {
    ModelElement modelElement=PropertyHelper.getModelElement(currentClient);
    if (!clientDepListByResultList.contains(modelElement)) {
      boolean isSuccess=DependenciesHandler.getInstance().removeDependenciesBetweenModel(analysis,modelElement);
      if (isSuccess) {
        try {
          ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider().getResourceManager().saveResource(modelElement.eResource());
        }
 catch (        PersistenceException e) {
          log.error(e,e);
          rc.setOk(false);
          rc.setMessage(e.getMessage());
        }
      }
 else {
        rc.setOk(false);
        rc.setMessage(Messages.getString("String_Node_Str",analysis.getName(),modelElement.getName()));
      }
    }
  }
  return rc;
}
Program: 137306
Project: 137306
Buggy source:
/** 
 * get Client Dependency List.
 * @param Analysis the analysis which we want to save
 * @return The list all of client dependency(Pattern UDI Connection DQRule)
 */
private List<ModelElement> getClientDepListByResult(Analysis analysis){
  List<ModelElement> clientDependencyList=new ArrayList<ModelElement>();
  DataManager connection=analysis.getContext().getConnection();
  clientDependencyList.addAll(AnalysisHelper.getUserDefinedIndicators(analysis));
  clientDependencyList.addAll(AnalysisHelper.getPatterns(analysis));
  if (connection != null) {
    clientDependencyList.add(connection);
  }
  return clientDependencyList;
}

Fixed version (ground truth):
/** 
 * get Client Dependency List.
 * @param Analysis the analysis which we want to save
 * @return The list all of client dependency(Pattern UDI Connection DQRule)
 */
private List<ModelElement> getClientDepListByResult(Analysis analysis){
  List<ModelElement> clientDependencyList=new ArrayList<ModelElement>();
  DataManager connection=analysis.getContext().getConnection();
  if (connection != null) {
    clientDependencyList.addAll(AnalysisHelper.getUserDefinedIndicators(analysis));
    clientDependencyList.addAll(AnalysisHelper.getPatterns(analysis));
    clientDependencyList.add(connection);
  }
  return clientDependencyList;
}
Program: 137312
Project: 137312
Buggy source:
@Override public void saveAnalysis() throws DataprofilerCoreException {
  Analysis ana=this.analysisItem.getAnalysis();
  for (  Domain domain : ana.getParameters().getDataFilter()) {
    domain.setName(ana.getName());
  }
  analysisHandler.clearAnalysis();
  TableIndicator[] tableIndicators=treeViewer.getTableIndicator();
  Connection tdProvider=null;
  Analysis analysis=analysisHandler.getAnalysis();
  analysis.getParameters().setExecutionLanguage(ExecutionLanguage.get(execLang));
  if (tableIndicators != null && tableIndicators.length != 0) {
    tdProvider=ConnectionHelper.getDataProvider(tableIndicators[0].getColumnSet());
    if (tdProvider.eIsProxy()) {
      tdProvider=(Connection)EObjectHelper.resolveObject(tdProvider);
    }
    analysis.getContext().setConnection(tdProvider);
    for (    TableIndicator tableIndicator : tableIndicators) {
      analysisHandler.addIndicator(tableIndicator.getColumnSet(),tableIndicator.getIndicators());
    }
  }
 else {
    deleteConnectionDependency(analysisItem);
  }
  analysisHandler.setStringDataFilter(dataFilterComp.getDataFilterString());
  this.saveNumberOfConnectionsPerAnalysis();
  ReturnCode saved=new ReturnCode(false);
  this.nameText.setText(analysisHandler.getName());
  saved=ElementWriterFactory.getInstance().createAnalysisWrite().save(analysisItem,true);
  logSaved(saved);
  treeViewer.setDirty(false);
  dataFilterComp.setDirty(false);
}

Fixed version (ground truth):
@Override public void saveAnalysis() throws DataprofilerCoreException {
  Analysis ana=this.analysisItem.getAnalysis();
  for (  Domain domain : ana.getParameters().getDataFilter()) {
    domain.setName(ana.getName());
  }
  analysisHandler.clearAnalysis();
  TableIndicator[] tableIndicators=treeViewer.getTableIndicator();
  Connection tdProvider=null;
  Analysis analysis=analysisHandler.getAnalysis();
  analysis.getParameters().setExecutionLanguage(ExecutionLanguage.get(execLang));
  if (tableIndicators != null && tableIndicators.length != 0) {
    tdProvider=ConnectionHelper.getDataProvider(tableIndicators[0].getColumnSet());
    if (tdProvider.eIsProxy()) {
      tdProvider=(Connection)EObjectHelper.resolveObject(tdProvider);
    }
    analysis.getContext().setConnection(tdProvider);
    for (    TableIndicator tableIndicator : tableIndicators) {
      analysisHandler.addIndicator(tableIndicator.getColumnSet(),tableIndicator.getIndicators());
    }
  }
 else {
    analysis.getContext().setConnection(null);
  }
  analysisHandler.setStringDataFilter(dataFilterComp.getDataFilterString());
  this.saveNumberOfConnectionsPerAnalysis();
  ReturnCode saved=new ReturnCode(false);
  this.nameText.setText(analysisHandler.getName());
  saved=ElementWriterFactory.getInstance().createAnalysisWrite().save(analysisItem,true);
  logSaved(saved);
  treeViewer.setDirty(false);
  dataFilterComp.setDirty(false);
}
Program: 137313
Project: 137313
Buggy source:
@Override protected void createExtendedControl(Composite container){
}

Fixed version (ground truth):
@Override protected void createExtendedControl(Composite container){
  return;
}
Program: 137314
Project: 137314
Buggy source:
public void createControl(Composite parent){
  super.createControl(parent);
  pathText.setText(getParameter().getFolderProvider().getFolderURI());
  button.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      openFolderSelectionDialog(ResourceManager.getIndicatorFolder());
    }
  }
);
}

Fixed version (ground truth):
@Override public void createControl(Composite parent){
  super.createControl(parent);
  pathText.setText(getParameter().getFolderProvider().getFolderURI());
  button.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      openFolderSelectionDialog(ResourceManager.getIndicatorFolder());
    }
  }
);
}
Program: 137319
Project: 137319
Buggy source:
/** 
 * delete the folder under TDQ_Data Profiling/Reports from the project and the disk, don't refresh the parent folder, the caller should refresh the parent by hand to change the svn info.
 * @param folder
 */
private static void deleteFolder(File folder){
  try {
    IFolder reportsFolder=ResourceManager.getReportsFolder();
    IFolder tempFolder=WorkspaceUtils.fileToIFolder(folder);
    if (tempFolder != null && tempFolder.exists()) {
      ProxyRepositoryFactory.getInstance().deleteFolder(ERepositoryObjectType.TDQ_REPORT_ELEMENT,tempFolder.getFullPath().makeRelativeTo(reportsFolder.getFullPath()));
    }
  }
 catch (  PersistenceException e) {
    e.printStackTrace();
  }
  if (folder.exists()) {
    FilesUtils.deleteFile(folder,Boolean.TRUE);
  }
}

Fixed version (ground truth):
/** 
 * delete the folder under TDQ_Data Profiling/Reports from the project and the disk, don't refresh the parent folder, the caller should refresh the parent by hand to change the svn info.
 * @param folder
 */
private static void deleteFolder(File folder){
  try {
    IFolder reportsFolder=ResourceManager.getReportsFolder();
    IFolder tempFolder=WorkspaceUtils.fileToIFolder(folder);
    if (tempFolder != null && tempFolder.exists()) {
      IProject fsProject=ResourceModelUtils.getProject(ProjectManager.getInstance().getCurrentProject());
      String completePath=new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.TDQ_REPORT_ELEMENT)).append(tempFolder.getFullPath().makeRelativeTo(reportsFolder.getFullPath())).toString();
      IFolder deleteFolder=ResourceUtils.getFolder(fsProject,completePath,true);
      for (      IResource subResource : deleteFolder.members()) {
        if (subResource.getType() == IResource.FILE) {
          subResource.delete(true,null);
        }
      }
      deleteFolder.delete(true,null);
    }
    if (folder.exists()) {
      FilesUtils.deleteFile(folder,Boolean.TRUE);
    }
  }
 catch (  PersistenceException e) {
    log.error(e,e);
  }
catch (  CoreException e) {
    log.error(e,e);
  }
}
Program: 137321
Project: 137321
Buggy source:
/** 
 * Test method for  {@link org.talend.cwm.dependencies.DependenciesHandler#removeDependenciesBetweenModel(orgomg.cwm.objectmodel.core.ModelElement,orgomg.cwm.objectmodel.core.ModelElement)}.
 */
@Test public void testRemoveDependenciesBetweenModel(){
  ModelElement ana=AnalysisHelper.createAnalysis("String_Node_Str");
  ModelElement conn=ConnectionHelper.createDatabaseConnection("String_Node_Str");
  EList<Dependency> clientDependencyFirst=ana.getClientDependency();
  assertEquals(0,clientDependencyFirst.size());
  TypedReturnCode<Dependency> setUsageDependencyOn=DependenciesHandler.getInstance().setUsageDependencyOn(ana,conn);
  assertEquals(1,clientDependencyFirst.size());
  EList<ModelElement> supplier=clientDependencyFirst.get(0).getSupplier();
  assertEquals(1,supplier.size());
  assertEquals(conn,supplier.get(0));
  if (setUsageDependencyOn.isOk()) {
    DependenciesHandler.getInstance().removeDependenciesBetweenModel(conn,ana);
  }
  assertEquals(0,clientDependencyFirst.size());
  EList<Dependency> clientDependencyTwo=conn.getClientDependency();
  assertEquals(0,clientDependencyTwo.size());
  setUsageDependencyOn=DependenciesHandler.getInstance().setUsageDependencyOn(conn,ana);
  assertEquals(1,clientDependencyTwo.size());
  supplier=clientDependencyTwo.get(0).getSupplier();
  assertEquals(1,supplier.size());
  assertEquals(ana,supplier.get(0));
  if (setUsageDependencyOn.isOk()) {
    DependenciesHandler.getInstance().removeDependenciesBetweenModel(ana,conn);
  }
  assertEquals(0,clientDependencyTwo.size());
}

Fixed version (ground truth):
/** 
 * Test method for  {@link org.talend.cwm.dependencies.DependenciesHandler#removeDependenciesBetweenModel(orgomg.cwm.objectmodel.core.ModelElement,orgomg.cwm.objectmodel.core.ModelElement)}.
 */
@Test public void testRemoveDependenciesBetweenModel(){
  ModelElement ana=AnalysisHelper.createAnalysis("String_Node_Str");
  ModelElement conn=ConnectionHelper.createDatabaseConnection("String_Node_Str");
  EList<Dependency> clientDependencyFirst=ana.getClientDependency();
  assertEquals(0,clientDependencyFirst.size());
  TypedReturnCode<Dependency> setUsageDependencyOn=DependenciesHandler.getInstance().setUsageDependencyOn(ana,conn);
  assertEquals(1,clientDependencyFirst.size());
  EList<ModelElement> supplier=clientDependencyFirst.get(0).getSupplier();
  assertEquals(1,supplier.size());
  assertEquals(conn,supplier.get(0));
  if (setUsageDependencyOn.isOk()) {
    DependenciesHandler.getInstance().removeDependenciesBetweenModel(ana,conn);
  }
  assertEquals(0,clientDependencyFirst.size());
  EList<Dependency> clientDependencyTwo=conn.getClientDependency();
  assertEquals(0,clientDependencyTwo.size());
  setUsageDependencyOn=DependenciesHandler.getInstance().setUsageDependencyOn(conn,ana);
  assertEquals(1,clientDependencyTwo.size());
  supplier=clientDependencyTwo.get(0).getSupplier();
  assertEquals(1,supplier.size());
  assertEquals(ana,supplier.get(0));
  if (setUsageDependencyOn.isOk()) {
    DependenciesHandler.getInstance().removeDependenciesBetweenModel(ana,conn);
  }
  assertEquals(0,clientDependencyTwo.size());
}
Program: 137322
Project: 137322
Buggy source:
/** 
 * Save analysis item and update the dependencies(optional). <B>To update dependencies of the analysis the #careDependency must be set as TRUE.</B>
 * @see org.talend.dq.writer.AElementPersistance#save(org.talend.core.model.properties.Item,boolean[])
 */
@Override public ReturnCode save(final Item item,final boolean careDependency){
  ReturnCode rc=new ReturnCode();
  RepositoryWorkUnit<Object> repositoryWorkUnit=new RepositoryWorkUnit<Object>("String_Node_Str"){
    @Override protected void run() throws LoginException, PersistenceException {
      TDQAnalysisItem anaItem=(TDQAnalysisItem)item;
      Analysis analysis=anaItem.getAnalysis();
      if (careDependency) {
        saveWithDependencies(anaItem,analysis);
      }
 else {
        saveWithoutDependencies(anaItem,analysis);
      }
    }
  }
;
  repositoryWorkUnit.setAvoidUnloadResources(true);
  ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(repositoryWorkUnit);
  try {
    repositoryWorkUnit.throwPersistenceExceptionIfAny();
  }
 catch (  PersistenceException e) {
    log.error(e,e);
    rc.setOk(Boolean.FALSE);
    rc.setMessage(e.getMessage());
  }
  return rc;
}

Fixed version (ground truth):
/** 
 * Save analysis item and update the dependencies(optional). <B>To update dependencies of the analysis the #careDependency must be set as TRUE.</B>
 * @see org.talend.dq.writer.AElementPersistance#save(org.talend.core.model.properties.Item,boolean[])
 */
@Override public ReturnCode save(Item item,boolean careDependency){
  TDQAnalysisItem anaItem=(TDQAnalysisItem)item;
  Analysis analysis=anaItem.getAnalysis();
  return careDependency ? saveWithDependencies(anaItem,analysis) : saveWithoutDependencies(anaItem,analysis);
}
Program: 137324
Project: 137324
Buggy source:
/** 
 * copy the block/match keys from matchRule to ruleDefinition.
 * @param ruleDefinition: created one
 * @param matchRule: exported one from the match analysis
 */
public void copy(MatchRuleDefinition ruleDefinition,MatchRuleDefinition matchRule){
  ruleDefinition.getBlockKeys().clear();
  if (matchRule.getBlockKeys() != null && matchRule.getBlockKeys().size() > 0) {
    for (    BlockKeyDefinition blockKey : matchRule.getBlockKeys()) {
      BlockKeyDefinition copy=EcoreUtil.copy(blockKey);
      ruleDefinition.getBlockKeys().add(copy);
    }
  }
  ruleDefinition.getMatchRules().clear();
  if (matchRule.getMatchRules() != null && matchRule.getMatchRules().size() > 0) {
    int index=1;
    for (    MatchRule oneMatchRule : matchRule.getMatchRules()) {
      ruleDefinition.getMatchRules().add(createMatchRuleByCopy(oneMatchRule,index++));
    }
  }
}

Fixed version (ground truth):
/** 
 * copy the block/match keys from matchRule to ruleDefinition.
 * @param ruleDefinition: created one
 * @param matchRule: exported one from the match analysis
 */
public void copy(MatchRuleDefinition ruleDefinition,MatchRuleDefinition matchRule){
  ruleDefinition.getBlockKeys().clear();
  if (matchRule.getBlockKeys() != null && matchRule.getBlockKeys().size() > 0) {
    for (    BlockKeyDefinition blockKey : matchRule.getBlockKeys()) {
      BlockKeyDefinition copy=EcoreUtil.copy(blockKey);
      ruleDefinition.getBlockKeys().add(copy);
    }
  }
  ruleDefinition.getMatchRules().clear();
  if (matchRule.getMatchRules() != null && matchRule.getMatchRules().size() > 0) {
    for (    MatchRule oneMatchRule : matchRule.getMatchRules()) {
      ruleDefinition.getMatchRules().add(EObjectHelper.deepCopy(oneMatchRule));
    }
  }
}
Program: 137325
Project: 137325
Buggy source:
/** 
 * create up/down Buttons.
 * @param parent
 */
public void createMoveButtons(Composite parent){
  Composite buttonsComposite=new Composite(parent,SWT.RIGHT);
  buttonsComposite.setLayoutData(new GridData(SWT.RIGHT,SWT.CENTER,false,false,1,1));
  buttonsComposite.setLayout(new GridLayout(2,true));
  GridData labelGd=new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
  labelGd.horizontalAlignment=SWT.LEFT;
  labelGd.widthHint=30;
  upButton=new Button(buttonsComposite,SWT.NONE);
  upButton.setToolTipText(DefaultMessagesImpl.getString("String_Node_Str"));
  upButton.setImage(ImageLib.getImage(ImageLib.UP_ACTION));
  upButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      moveItemUpOrDown(true);
    }
  }
);
  downButton=new Button(buttonsComposite,SWT.NONE);
  downButton.setToolTipText(DefaultMessagesImpl.getString("String_Node_Str"));
  downButton.setImage(ImageLib.getImage(ImageLib.DOWN_ACTION));
  downButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      moveItemUpOrDown(false);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * create up/down Buttons.
 * @param parent
 */
public void createMoveButtons(Composite parent){
  Composite buttonsComposite=new Composite(parent,SWT.RIGHT);
  buttonsComposite.setLayoutData(new GridData(SWT.RIGHT,SWT.CENTER,false,false,1,1));
  buttonsComposite.setLayout(new GridLayout(2,true));
  GridData labelGd=new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
  labelGd.horizontalAlignment=SWT.LEFT;
  labelGd.widthHint=30;
  upButton=new Button(buttonsComposite,SWT.NONE);
  upButton.setToolTipText(DefaultMessagesImpl.getString("String_Node_Str"));
  upButton.setImage(ImageLib.getImage(ImageLib.UP_ACTION));
  upButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      moveItemUpOrDown(true);
    }
  }
);
  upButton.setEnabled(false);
  downButton=new Button(buttonsComposite,SWT.NONE);
  downButton.setToolTipText(DefaultMessagesImpl.getString("String_Node_Str"));
  downButton.setImage(ImageLib.getImage(ImageLib.DOWN_ACTION));
  downButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      moveItemUpOrDown(false);
    }
  }
);
  downButton.setEnabled(false);
}
Program: 137326
Project: 137326
Buggy source:
/** 
 * Move the selected item up or down.
 * @param isMoveUp <code>true</code> if move up, and <code>false</code> if move down
 */
private void moveItemUpOrDown(boolean isMoveUp){
  int selectIndex=tableViewer.getTable().getSelectionIndex();
  int targetIndex=isMoveUp ? selectIndex - 1 : selectIndex + 1;
  boolean isValidatedIndex=isMoveUp ? targetIndex >= 0 : targetIndex < tableViewer.getTable().getItemCount();
  if (selectIndex >= 0 && isValidatedIndex) {
    if (hashtable != null && hashtable.size() > 0) {
      MatchRule oldTarget=hashtable.get(targetIndex);
      MatchRule oldSelect=hashtable.get(selectIndex);
      hashtable.put(selectIndex,oldTarget);
      hashtable.put(targetIndex,oldSelect);
    }
    tempList.clear();
    for (int i=0; i < hashtable.size(); i++) {
      tempList.add(hashtable.get(i));
    }
    tableViewer.setInput(tempList.toArray(new MatchRule[tempList.size()]));
    tableViewer.refresh();
    updateButtonsStatus();
    setDirty(true);
  }
}

Fixed version (ground truth):
/** 
 * Move the selected item up or down.
 * @param isMoveUp <code>true</code> if move up, and <code>false</code> if move down
 */
private void moveItemUpOrDown(boolean isMoveUp){
  int selectIndex=tableViewer.getTable().getSelectionIndex();
  int targetIndex=isMoveUp ? selectIndex - 1 : selectIndex + 1;
  boolean isValidatedIndex=isMoveUp ? targetIndex >= 0 : targetIndex < tableViewer.getTable().getItemCount();
  if (selectIndex >= 0 && isValidatedIndex) {
    if (orderMatchRuleList != null && orderMatchRuleList.size() > 0) {
      OrderMatchRule oldTarget=orderMatchRuleList.get(targetIndex);
      OrderMatchRule oldSelect=orderMatchRuleList.get(selectIndex);
      orderMatchRuleList.set(selectIndex,oldTarget);
      orderMatchRuleList.set(targetIndex,oldSelect);
    }
    tableViewer.setInput(orderMatchRuleList.toArray(new OrderMatchRule[orderMatchRuleList.size()]));
    tableViewer.refresh();
    updateButtonsStatus();
    setDirty(true);
    getButton(OK).setEnabled(true);
  }
}
Program: 137327
Project: 137327
Buggy source:
@Override public String getText(Object element){
  return ((MatchRule)element).getName();
}

Fixed version (ground truth):
@Override public String getText(Object element){
  return ((OrderMatchRule)element).getName();
}
Program: 137328
Project: 137328
Buggy source:
@Override protected void okPressed(){
  matchRuleList.clear();
  for (int i=0; i < hashtable.size(); i++) {
    matchRuleList.add(hashtable.get(i));
  }
  super.okPressed();
}

Fixed version (ground truth):
@Override protected void okPressed(){
  resultMatchRuleList.clear();
  for (int i=0; i < orderMatchRuleList.size(); i++) {
    OrderMatchRule orderMatchRule=orderMatchRuleList.get(i);
    MatchRule matchRule=orderMatchRule.getMatchRule();
    matchRule.setName(orderMatchRule.getName());
    resultMatchRuleList.add(matchRule);
  }
  super.okPressed();
}
Program: 137329
Project: 137329
Buggy source:
/** 
 * EditSortMatchRuleNamesDialog constructor.
 * @param parentShell
 * @param matchRuleList
 */
public EditSortMatchRuleNamesDialog(Shell parentShell,List<MatchRule> matchRuleList){
  super(parentShell);
  setShellStyle(SWT.CLOSE | SWT.RESIZE);
  this.matchRuleList=matchRuleList;
  if (matchRuleList != null) {
    int i=0;
    for (    MatchRule matchRule : matchRuleList) {
      hashtable.put(i++,matchRule);
    }
  }
}

Fixed version (ground truth):
/** 
 * EditSortMatchRuleNamesDialog constructor.
 * @param parentShell
 * @param orderMatchRuleList
 */
public EditSortMatchRuleNamesDialog(Shell parentShell,List<MatchRule> matchRuleList){
  super(parentShell);
  setShellStyle(SWT.CLOSE | SWT.RESIZE);
  for (  MatchRule matchRule : matchRuleList) {
    OrderMatchRule orderMatchRule=new OrderMatchRule();
    orderMatchRule.setName(matchRule.getName());
    orderMatchRule.setMatchRule(matchRule);
    this.orderMatchRuleList.add(orderMatchRule);
  }
}
Program: 137330
Project: 137330
Buggy source:
@Override protected Object getValue(Object element){
  return ((MatchRule)element).getName();
}

Fixed version (ground truth):
@Override protected Object getValue(Object element){
  return ((OrderMatchRule)element).getName();
}
Program: 137331
Project: 137331
Buggy source:
/** 
 * create Table Viewer.
 * @param parent
 * @return
 */
private void createTableViewer(Composite parent){
  tableViewer=new TableViewer(parent,SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
  Table table_1=tableViewer.getTable();
  GridData gd_table_1=new GridData(SWT.FILL,SWT.FILL,true,true,1,1);
  gd_table_1.heightHint=217;
  table_1.setLayoutData(gd_table_1);
  Table table=(Table)tableViewer.getControl();
  TableLayout tableLayout=new TableLayout();
  tableLayout.addColumnData(new ColumnPixelData(350));
  table.setLayout(tableLayout);
  tableViewer.setContentProvider(new IStructuredContentProvider(){
    @Override public Object[] getElements(    Object inputElement){
      return (MatchRule[])inputElement;
    }
    @Override public void dispose(){
    }
    @Override public void inputChanged(    Viewer viewer,    Object oldInput,    Object newInput){
    }
  }
);
  createMatchRuleNameColumn();
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  tableViewer.setInput(matchRuleList.toArray(new MatchRule[matchRuleList.size()]));
}

Fixed version (ground truth):
/** 
 * create Table Viewer.
 * @param parent
 * @return
 */
private void createTableViewer(Composite parent){
  tableViewer=new TableViewer(parent,SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
  Table table_1=tableViewer.getTable();
  GridData gd_table_1=new GridData(SWT.FILL,SWT.FILL,true,true,1,1);
  gd_table_1.heightHint=217;
  table_1.setLayoutData(gd_table_1);
  Table table=(Table)tableViewer.getControl();
  TableLayout tableLayout=new TableLayout();
  tableLayout.addColumnData(new ColumnPixelData(350));
  table.setLayout(tableLayout);
  tableViewer.setContentProvider(new IStructuredContentProvider(){
    @Override public Object[] getElements(    Object inputElement){
      return (OrderMatchRule[])inputElement;
    }
    @Override public void dispose(){
    }
    @Override public void inputChanged(    Viewer viewer,    Object oldInput,    Object newInput){
    }
  }
);
  createMatchRuleNameColumn();
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  tableViewer.setInput(orderMatchRuleList.toArray(new OrderMatchRule[orderMatchRuleList.size()]));
  tableViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      updateButtonsStatus();
    }
  }
);
}
Program: 137332
Project: 137332
Buggy source:
/** 
 * create Match Rule Name Column.
 */
private void createMatchRuleNameColumn(){
  TableViewerColumn vNameColumn=new TableViewerColumn(tableViewer,SWT.CENTER);
  TableColumn nameColumn=vNameColumn.getColumn();
  nameColumn.setWidth(300);
  nameColumn.setText(DefaultMessagesImpl.getString("String_Node_Str"));
  vNameColumn.setLabelProvider(new ColumnLabelProvider(){
    @Override public String getText(    Object element){
      return ((MatchRule)element).getName();
    }
  }
);
  vNameColumn.setEditingSupport(new EditingSupport(tableViewer){
    @Override protected boolean canEdit(    Object element){
      return true;
    }
    @Override protected CellEditor getCellEditor(    Object element){
      return new TextCellEditor((Table)tableViewer.getControl());
    }
    @Override protected Object getValue(    Object element){
      return ((MatchRule)element).getName();
    }
    @Override protected void setValue(    Object element,    Object value){
      if (value != null && !StringUtils.isBlank((String)value)) {
        if (!((MatchRule)element).getName().equals(value)) {
          setDirty(true);
        }
        ((MatchRule)element).setName((String)value);
      }
 else {
        ((MatchRule)element).setName(((MatchRule)element).getName());
      }
      tableViewer.refresh();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * create Match Rule Name Column.
 */
private void createMatchRuleNameColumn(){
  TableViewerColumn vNameColumn=new TableViewerColumn(tableViewer,SWT.CENTER);
  TableColumn nameColumn=vNameColumn.getColumn();
  nameColumn.setWidth(300);
  nameColumn.setText(DefaultMessagesImpl.getString("String_Node_Str"));
  vNameColumn.setLabelProvider(new ColumnLabelProvider(){
    @Override public String getText(    Object element){
      return ((OrderMatchRule)element).getName();
    }
  }
);
  vNameColumn.setEditingSupport(new EditingSupport(tableViewer){
    @Override protected boolean canEdit(    Object element){
      return true;
    }
    @Override protected CellEditor getCellEditor(    Object element){
      return new TextCellEditor((Table)tableViewer.getControl());
    }
    @Override protected Object getValue(    Object element){
      return ((OrderMatchRule)element).getName();
    }
    @Override protected void setValue(    Object element,    Object value){
      if (value != null && !StringUtils.isBlank((String)value)) {
        if (!((OrderMatchRule)element).getName().equals(value)) {
          setDirty(true);
          getButton(OK).setEnabled(true);
        }
        ((OrderMatchRule)element).setName((String)value);
      }
 else {
        ((OrderMatchRule)element).setName(((OrderMatchRule)element).getName());
      }
      tableViewer.refresh();
    }
  }
);
}
Program: 137333
Project: 137333
Buggy source:
@Override public Object[] getElements(Object inputElement){
  return (MatchRule[])inputElement;
}

Fixed version (ground truth):
@Override public Object[] getElements(Object inputElement){
  return (OrderMatchRule[])inputElement;
}
Program: 137334
Project: 137334
Buggy source:
@Override protected void setValue(Object element,Object value){
  if (value != null && !StringUtils.isBlank((String)value)) {
    if (!((MatchRule)element).getName().equals(value)) {
      setDirty(true);
    }
    ((MatchRule)element).setName((String)value);
  }
 else {
    ((MatchRule)element).setName(((MatchRule)element).getName());
  }
  tableViewer.refresh();
}

Fixed version (ground truth):
@Override protected void setValue(Object element,Object value){
  if (value != null && !StringUtils.isBlank((String)value)) {
    if (!((OrderMatchRule)element).getName().equals(value)) {
      setDirty(true);
      getButton(OK).setEnabled(true);
    }
    ((OrderMatchRule)element).setName((String)value);
  }
 else {
    ((OrderMatchRule)element).setName(((OrderMatchRule)element).getName());
  }
  tableViewer.refresh();
}
Program: 137336
Project: 137336
Buggy source:
/** 
 * Comment method "removeDependenciesBetweenModel".
 * @param supplier
 * @param client
 * @return
 */
public boolean removeDependenciesBetweenModel(ModelElement supplier,ModelElement client){
  boolean hasFind=false;
  EList<Dependency> supplierDependencies=supplier.getSupplierDependency();
  Iterator<Dependency> suppiterator=supplierDependencies.iterator();
  while (suppiterator.hasNext()) {
    Dependency supplierDep=suppiterator.next();
    if (supplierDep.getClient().contains(client)) {
      supplierDep.getClient().remove(client);
      hasFind=true;
      break;
    }
  }
  if (!hasFind) {
    EList<Dependency> clientDependency=supplier.getClientDependency();
    Iterator<Dependency> clientiterator=clientDependency.iterator();
    while (clientiterator.hasNext()) {
      Dependency clientDep=clientiterator.next();
      if (clientDep.getSupplier().contains(client)) {
        clientDep.getSupplier().remove(client);
        hasFind=true;
        break;
      }
    }
  }
  return hasFind;
}

Fixed version (ground truth):
/** 
 * Comment method "removeDependenciesBetweenModel".
 * @param supplier
 * @param client
 * @return
 */
public boolean removeDependenciesBetweenModel(ModelElement supplier,ModelElement client){
  boolean hasFind=false;
  EList<Dependency> supplierDependencies=supplier.getSupplierDependency();
  Iterator<Dependency> suppiterator=supplierDependencies.iterator();
  while (suppiterator.hasNext()) {
    Dependency supplierDep=suppiterator.next();
    if (supplierDep.getClient().contains(client)) {
      supplierDep.getClient().remove(client);
      hasFind=true;
      break;
    }
  }
  if (!hasFind) {
    EList<Dependency> clientDependency=supplier.getClientDependency();
    Iterator<Dependency> clientiterator=clientDependency.iterator();
    while (clientiterator.hasNext()) {
      Dependency clientDep=clientiterator.next();
      if (clientDep.getSupplier().contains(client)) {
        clientiterator.remove();
        hasFind=true;
        break;
      }
    }
  }
  return hasFind;
}
Program: 137337
Project: 137337
Buggy source:
/** 
 * @param object
 * @return SupplierDependencygetClintDependency
 */
public List<Property> getClintDependency(ModelElement object){
  List<Property> result=new ArrayList<Property>();
  Property property=PropertyHelper.getProperty(object);
  if (property != null) {
    result=iterateClientDependencies(property);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @param object
 * @return SupplierDependencygetClintDependency system indicators will not be contain at here.
 */
public List<Property> getClintDependency(ModelElement object){
  List<Property> result=new ArrayList<Property>();
  Property property=PropertyHelper.getProperty(object);
  if (property != null) {
    result=iterateClientDependencies(property);
  }
  return result;
}
Program: 137340
Project: 137340
Buggy source:
/** 
 * Test method for  {@link org.talend.cwm.dependencies.DependenciesHandler#removeDependenciesBetweenModel(orgomg.cwm.objectmodel.core.ModelElement,orgomg.cwm.objectmodel.core.ModelElement)}.
 */
@Test public void testRemoveDependenciesBetweenModel(){
  ModelElement ana=AnalysisHelper.createAnalysis("String_Node_Str");
  ModelElement conn=ConnectionHelper.createDatabaseConnection("String_Node_Str");
  EList<Dependency> clientDependencyFirst=ana.getClientDependency();
  assertEquals(0,clientDependencyFirst.size());
  TypedReturnCode<Dependency> setUsageDependencyOn=DependenciesHandler.getInstance().setUsageDependencyOn(ana,conn);
  assertEquals(1,clientDependencyFirst.size());
  EList<ModelElement> supplier=clientDependencyFirst.get(0).getSupplier();
  assertEquals(1,supplier.size());
  assertEquals(conn,supplier.get(0));
  if (setUsageDependencyOn.isOk()) {
    DependenciesHandler.getInstance().removeDependenciesBetweenModel(conn,ana);
  }
  assertEquals(0,clientDependencyFirst.size());
  EList<Dependency> clientDependencyTwo=conn.getClientDependency();
  assertEquals(0,clientDependencyTwo.size());
  setUsageDependencyOn=DependenciesHandler.getInstance().setUsageDependencyOn(conn,ana);
  assertEquals(1,clientDependencyTwo.size());
  supplier=clientDependencyTwo.get(0).getSupplier();
  assertEquals(1,supplier.size());
  assertEquals(ana,supplier.get(0));
  if (setUsageDependencyOn.isOk()) {
    DependenciesHandler.getInstance().removeDependenciesBetweenModel(ana,conn);
  }
  assertEquals(0,clientDependencyTwo.size());
}

Fixed version (ground truth):
/** 
 * Test method for  {@link org.talend.cwm.dependencies.DependenciesHandler#removeDependenciesBetweenModel(orgomg.cwm.objectmodel.core.ModelElement,orgomg.cwm.objectmodel.core.ModelElement)}.
 */
@Test public void testRemoveDependenciesBetweenModel(){
  ModelElement ana=AnalysisHelper.createAnalysis("String_Node_Str");
  ModelElement conn=ConnectionHelper.createDatabaseConnection("String_Node_Str");
  EList<Dependency> clientDependencyFirst=ana.getClientDependency();
  assertEquals(0,clientDependencyFirst.size());
  TypedReturnCode<Dependency> setUsageDependencyOn=DependenciesHandler.getInstance().setUsageDependencyOn(ana,conn);
  assertEquals(1,clientDependencyFirst.size());
  EList<ModelElement> supplier=clientDependencyFirst.get(0).getSupplier();
  assertEquals(1,supplier.size());
  assertEquals(conn,supplier.get(0));
  if (setUsageDependencyOn.isOk()) {
    DependenciesHandler.getInstance().removeDependenciesBetweenModel(ana,conn);
  }
  assertEquals(0,clientDependencyFirst.size());
  EList<Dependency> clientDependencyTwo=conn.getClientDependency();
  assertEquals(0,clientDependencyTwo.size());
  setUsageDependencyOn=DependenciesHandler.getInstance().setUsageDependencyOn(conn,ana);
  assertEquals(1,clientDependencyTwo.size());
  supplier=clientDependencyTwo.get(0).getSupplier();
  assertEquals(1,supplier.size());
  assertEquals(ana,supplier.get(0));
  if (setUsageDependencyOn.isOk()) {
    DependenciesHandler.getInstance().removeDependenciesBetweenModel(ana,conn);
  }
  assertEquals(0,clientDependencyTwo.size());
}
Program: 137341
Project: 137341
Buggy source:
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  if (element instanceof IFolder) {
    IFolder folder=(IFolder)element;
    if (SOURCE_FILES.equals(folder.getName()) || TDQ_LIBRARIES.equals(folder.getName())) {
      return true;
    }
 else {
      return defaultValidFolder.getFullPath().isPrefixOf(folder.getFullPath()) && !FilesUtils.isSVNFolder(folder.getName());
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  if (element instanceof IFolder) {
    IFolder folder=(IFolder)element;
    if (SOURCE_FILES.equals(folder.getName())) {
      return true;
    }
 else {
      return defaultValidFolder.getFullPath().isPrefixOf(folder.getFullPath()) && !FilesUtils.isSVNFolder(folder.getName());
    }
  }
  return false;
}
Program: 137343
Project: 137343
Buggy source:
/** 
 * check File Name.
 * @param String: file name
 */
private Status checkFileName(final String name){
  if (name == null || EMPTY_STR.equals(name.trim())) {
    return EMPTY_NAME_STATUS;
  }
 else {
    if (!WorkspaceUtils.checkNameIsOK(name)) {
      return SPECIAL_CHAR_STATUS;
    }
    if (fileNameExist(WorkspaceUtils.ifolderToFile(selectedFolder),name)) {
      return FILE_EXIST_STATUS;
    }
  }
  return OK_STATUS;
}

Fixed version (ground truth):
/** 
 * check File Name.
 * @param String: file name
 */
private Status checkFileName(final String name){
  if (name == null || EMPTY_STR.equals(name.trim())) {
    return EMPTY_NAME_STATUS;
  }
 else {
    if (!WorkspaceUtils.checkNameIsOK(name)) {
      return SPECIAL_CHAR_STATUS;
    }
    if (fileNameExist(WorkspaceUtils.ifolderToFile(defaultValidFolder),name)) {
      return FILE_EXIST_STATUS;
    }
  }
  return OK_STATUS;
}
Program: 137344
Project: 137344
Buggy source:
@Override protected boolean runAnalysis(Analysis analysis,String sqlStatement){
  boolean ok=true;
  TypedReturnCode<MdmWebserviceConnection> trc=this.getMdmConnection(analysis);
  if (!trc.isOk()) {
    return traceError(Messages.getString("String_Node_Str",analysis.getName(),trc.getMessage()));
  }
  MdmWebserviceConnection connection=trc.getObject();
  try {
    Map<ModelElement,List<Indicator>> elementToIndicator=new HashMap<ModelElement,List<Indicator>>();
    Collection<Indicator> indicators=IndicatorHelper.getIndicatorLeaves(analysis.getResults());
    ok=runAnalysisIndicators(connection,elementToIndicator,indicators);
    setRowCountAndNullCount(elementToIndicator);
  }
 catch (  RemoteException e) {
    log.error(e.getMessage(),e);
    this.errorMessage=e.getMessage();
    String unableDirectQueryStr="String_Node_Str";
    if (getErrorMessage().contains(unableDirectQueryStr)) {
      String sqlModeUnsupportedStr=Messages.getString("String_Node_Str");
      String refactoredErrorMessage=StringUtils.replace(getErrorMessage(),unableDirectQueryStr,sqlModeUnsupportedStr,-1);
      setError(refactoredErrorMessage);
    }
    ok=false;
  }
catch (  ServiceException e) {
    log.error(e.getMessage(),e);
    this.errorMessage=e.getMessage();
    ok=false;
  }
 finally {
  }
  return ok;
}

Fixed version (ground truth):
@Override protected boolean runAnalysis(Analysis analysis,String sqlStatement){
  boolean ok=true;
  TypedReturnCode<MdmWebserviceConnection> trc=this.getMdmConnection(analysis);
  if (!trc.isOk()) {
    return traceError(Messages.getString("String_Node_Str",analysis.getName(),trc.getMessage()));
  }
  MdmWebserviceConnection connection=trc.getObject();
  try {
    Map<ModelElement,List<Indicator>> elementToIndicator=new HashMap<ModelElement,List<Indicator>>();
    Collection<Indicator> indicators=IndicatorHelper.getIndicatorLeaves(analysis.getResults());
    ok=runAnalysisIndicators(connection,elementToIndicator,indicators);
    setRowCountAndNullCount(elementToIndicator);
  }
 catch (  RemoteException e) {
    log.error(e.getMessage(),e);
    this.errorMessage=e.getMessage();
    if (this.errorMessage.contains("String_Node_Str")) {
      this.errorMessage=Messages.getString("String_Node_Str");
    }
    ok=false;
  }
catch (  ServiceException e) {
    log.error(e.getMessage(),e);
    this.errorMessage=e.getMessage();
    ok=false;
  }
 finally {
  }
  return ok;
}
Program: 137345
Project: 137345
Buggy source:
private boolean setJDBCMysqlConnection(DatabaseConnection dbProvider){
  dbProvider.setComment("String_Node_Str");
  dbProvider.setSID("String_Node_Str");
  dbProvider.setDatasourceName("String_Node_Str");
  dbProvider.setDatabaseType("String_Node_Str");
  dbProvider.setDbVersionString("String_Node_Str");
  dbProvider.setDriverClass("String_Node_Str");
  dbProvider.setFileFieldName("String_Node_Str");
  dbProvider.setId("String_Node_Str");
  dbProvider.setLabel("String_Node_Str");
  dbProvider.setNullChar("String_Node_Str");
  dbProvider.setPassword("String_Node_Str");
  dbProvider.setPort("String_Node_Str");
  dbProvider.setServerName("String_Node_Str");
  dbProvider.setSqlSynthax("String_Node_Str");
  dbProvider.setUiSchema("String_Node_Str");
  dbProvider.setStringQuote("String_Node_Str");
  dbProvider.setURL("String_Node_Str");
  dbProvider.setAdditionalParams("String_Node_Str");
  dbProvider.setUsername("String_Node_Str");
  dbProvider.setDbmsId("String_Node_Str");
  dbProvider.setProductId("String_Node_Str");
  dbProvider.setDBRootPath("String_Node_Str");
  dbProvider.setSQLMode(false);
  dbProvider.setContextMode(false);
  dbProvider.setContextId("String_Node_Str");
  dbProvider.setContextName("String_Node_Str");
  return true;
}

Fixed version (ground truth):
private boolean setJDBCMysqlConnection(DatabaseConnection dbProvider){
  dbProvider.setComment("String_Node_Str");
  dbProvider.setSID("String_Node_Str");
  dbProvider.setDatasourceName("String_Node_Str");
  dbProvider.setDatabaseType("String_Node_Str");
  dbProvider.setDbVersionString("String_Node_Str");
  dbProvider.setDriverClass("String_Node_Str");
  dbProvider.setFileFieldName("String_Node_Str");
  dbProvider.setId("String_Node_Str");
  dbProvider.setLabel("String_Node_Str");
  dbProvider.setNullChar("String_Node_Str");
  dbProvider.setPassword("String_Node_Str");
  dbProvider.setPort("String_Node_Str");
  dbProvider.setServerName("String_Node_Str");
  dbProvider.setSqlSynthax("String_Node_Str");
  dbProvider.setUiSchema("String_Node_Str");
  dbProvider.setStringQuote("String_Node_Str");
  dbProvider.setURL("String_Node_Str");
  dbProvider.setAdditionalParams("String_Node_Str");
  dbProvider.setUsername("String_Node_Str");
  dbProvider.setDbmsId("String_Node_Str");
  dbProvider.setProductId("String_Node_Str");
  dbProvider.setDBRootPath("String_Node_Str");
  dbProvider.setSQLMode(false);
  dbProvider.setContextMode(false);
  dbProvider.setContextId("String_Node_Str");
  dbProvider.setContextName("String_Node_Str");
  dbProvider.setDatabaseType(SupportDBUrlType.MYSQLDEFAULTURL.getDBKey());
  return true;
}
Program: 137349
Project: 137349
Buggy source:
/** 
 * DOC yyi Comment method "createTable".
 */
private void createTable(){
  GridLayout layout=new GridLayout();
  Composite composite=new Composite(this,SWT.BORDER);
  layout.marginHeight=0;
  layout.marginWidth=0;
  composite.setLayout(layout);
  composite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,Boolean.TRUE,Boolean.TRUE));
  dataViewer=new TableViewer(composite,SWT.FULL_SELECTION | SWT.NO_SCROLL | SWT.H_SCROLL| SWT.MULTI| SWT.BORDER);
  dataViewer.getTable().setHeaderVisible(true);
  dataViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
  for (  String title : viewColumn) {
    TableViewerColumn column=new TableViewerColumn(dataViewer,SWT.NONE);
    column.getColumn().setText(title);
    column.getColumn().setWidth(150);
    column.getColumn().setMoveable(true);
  }
  dataViewer.setContentProvider(new ArrayContentProvider());
  dataViewer.setLabelProvider(new DataLabelProvider());
  dataViewer.getTable().addListener(SWT.Resize,new Listener(){
    @Override public void handleEvent(    Event event){
      reComputePageSize();
      loadPage(page);
      dataViewer.getTable().layout();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * DOC yyi Comment method "createTable".
 */
private void createTable(){
  GridLayout layout=new GridLayout();
  Composite composite=new Composite(this,SWT.BORDER);
  layout.marginHeight=0;
  layout.marginWidth=0;
  composite.setLayout(layout);
  composite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,Boolean.TRUE,Boolean.TRUE));
  dataViewer=new TableViewer(composite,SWT.FULL_SELECTION | SWT.NO_SCROLL | SWT.H_SCROLL| SWT.MULTI| SWT.BORDER);
  dataViewer.getTable().setHeaderVisible(true);
  dataViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
  for (  String title : viewColumn) {
    TableViewerColumn column=new TableViewerColumn(dataViewer,SWT.NONE);
    column.getColumn().setText(title);
    column.getColumn().setWidth(150);
    column.getColumn().setMoveable(true);
  }
  dataViewer.setContentProvider(new ArrayContentProvider());
  dataViewer.setLabelProvider(new DataLabelProvider());
  dataViewer.getTable().addControlListener(matchRuleTableResizeListener);
}
Program: 137350
Project: 137350
Buggy source:
protected void loadPage(int page){
  List<String[]> itemPage=new ArrayList<String[]>();
  for (int i=page * rowCount; i < Math.min((page + 1) * rowCount,getDisplayViewData().size()); i++) {
    itemPage.add(getDisplayViewData().get(i));
  }
  if (itemPage.size() >= 0) {
    this.dataViewer.setInput(itemPage);
  }
  updateButons();
}

Fixed version (ground truth):
protected void loadPage(int page){
  List<String[]> itemPage=new ArrayList<String[]>();
  for (int i=page * rowCount; i < Math.min((page + 1) * rowCount,getDisplayViewData().size()); i++) {
    itemPage.add(getDisplayViewData().get(i));
  }
  if (itemPage.size() >= 0) {
    dataViewer.getTable().removeControlListener(matchRuleTableResizeListener);
    this.dataViewer.setInput(itemPage);
    dataViewer.getTable().addControlListener(matchRuleTableResizeListener);
  }
  updateButons();
}
Program: 137352
Project: 137352
Buggy source:
/** 
 * fill schemas on the catalog
 * @return if fill action is success
 */
private boolean fillSchemaToCatalog(Item databaseItem){
  DatabaseConnection connection=(DatabaseConnection)((DatabaseConnectionItem)databaseItem).getConnection();
  TypedReturnCode<Connection> rcConn=MetadataConnectionUtils.createConnection(connection);
  if (!rcConn.isOk()) {
    log.error(rcConn.getMessage());
    return false;
  }
  java.sql.Connection sqlConnection=rcConn.getObject();
  try {
    DatabaseMetaData dbJDBCMetadata=ExtractMetaDataUtils.getInstance().getDatabaseMetaData(sqlConnection,connection,false);
    List<Schema> schemaList=MetadataFillFactory.getDBInstance(SupportDBUrlType.SYBASEDEFAULTURL).fillSchemaToCatalog(connection,dbJDBCMetadata,this.getCatalog(),null);
    if (schemaList != null && schemaList.size() > 0) {
      CatalogHelper.addSchemas(schemaList,this.getCatalog());
    }
  }
  finally {
    if (sqlConnection != null) {
      ConnectionUtils.closeConnection(sqlConnection);
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * fill schemas on the catalog
 * @return if fill action is success
 */
private boolean fillSchemaToCatalog(Item databaseItem){
  DatabaseConnection connection=(DatabaseConnection)((DatabaseConnectionItem)databaseItem).getConnection();
  TypedReturnCode<Connection> rcConn=MetadataConnectionUtils.createConnection(connection);
  if (!rcConn.isOk()) {
    log.error(rcConn.getMessage());
    return false;
  }
  java.sql.Connection sqlConnection=rcConn.getObject();
  try {
    DatabaseMetaData dbJDBCMetadata=ExtractMetaDataUtils.getInstance().getDatabaseMetaData(sqlConnection,connection,false);
    EDatabaseTypeName currentEDatabaseType=EDatabaseTypeName.getTypeFromDbType(connection.getDatabaseType());
    List<Schema> schemaList=null;
    if (currentEDatabaseType != null) {
      schemaList=MetadataFillFactory.getDBInstance(currentEDatabaseType).fillSchemaToCatalog(connection,dbJDBCMetadata,this.getCatalog(),null);
    }
    if (schemaList != null && schemaList.size() > 0) {
      CatalogHelper.addSchemas(schemaList,this.getCatalog());
    }
  }
  finally {
    if (sqlConnection != null) {
      ConnectionUtils.closeConnection(sqlConnection);
    }
  }
  return true;
}