nus-yam/ex-repair huggingface dataset:
Program: 138065
Project: 138065
Buggy source:
protected void removeItemBranch(TreeItem item){
  TreeEditor[] editors=(TreeEditor[])item.getData(ITEM_EDITOR_KEY);
  if (editors != null) {
    for (int j=0; j < editors.length; j++) {
      editors[j].getEditor().dispose();
      editors[j].dispose();
    }
  }
  if (item.getItemCount() == 0) {
    item.dispose();
    this.setDirty(true);
    return;
  }
  TreeItem[] items=item.getItems();
  for (int i=0; i < items.length; i++) {
    removeItemBranch(items[i]);
    removeTreeItem(items[i]);
  }
  item.dispose();
  this.setDirty(true);
}

Fixed version (ground truth):
protected void removeItemBranch(TreeItem item){
  if (item == null) {
    return;
  }
  TreeEditor[] editors=(TreeEditor[])item.getData(ITEM_EDITOR_KEY);
  if (editors != null) {
    for (int j=0; j < editors.length; j++) {
      editors[j].getEditor().dispose();
      editors[j].dispose();
    }
  }
  if (item.getItemCount() == 0) {
    item.dispose();
    this.setDirty(true);
    return;
  }
  TreeItem[] items=item.getItems();
  for (int i=0; i < items.length; i++) {
    removeItemBranch(items[i]);
    removeTreeItem(items[i]);
  }
  item.dispose();
  this.setDirty(true);
}
Program: 138068
Project: 138068
Buggy source:
/** 
 * ADD mzhao 2009-05-05 bug:6587.
 */
protected void updateBindConnection(AbstractAnalysisMetadataPage masterPage,List<TableViewer> tableViewerPosStack){
  boolean isEmpty1=tableViewerPosStack.get(0) == null || tableViewerPosStack.get(0).getInput() == null || ((List<TdColumn>)tableViewerPosStack.get(0).getInput()).size() == 0;
  boolean isEmpty2=tableViewerPosStack.get(1) == null || tableViewerPosStack.get(1).getInput() == null || ((List<TdColumn>)tableViewerPosStack.get(1).getInput()).size() == 0;
  if (isEmpty1 && isEmpty2) {
    return;
  }
 else {
    TableViewer columnsElementViewer=null;
    if (!isEmpty1) {
      columnsElementViewer=tableViewerPosStack.get(0);
    }
 else {
      columnsElementViewer=tableViewerPosStack.get(1);
    }
    Connection tdProvider=null;
    Object input=columnsElementViewer.getInput();
    List<DBColumnRepNode> columnSet=(List<DBColumnRepNode>)input;
    if (columnSet != null && columnSet.size() != 0) {
      TdColumn column=(TdColumn)((MetadataColumnRepositoryObject)columnSet.get(0).getObject()).getTdColumn();
      if (column != null && column.eIsProxy()) {
        column=(TdColumn)EObjectHelper.resolveObject(column);
      }
      tdProvider=ConnectionHelper.getTdDataProvider(column);
      setConnectionState(masterPage,tdProvider);
    }
  }
}

Fixed version (ground truth):
/** 
 * ADD mzhao 2009-05-05 bug:6587.
 */
protected void updateBindConnection(AbstractAnalysisMetadataPage masterPage,List<TableViewer> tableViewerPosStack){
  boolean isEmpty1=tableViewerPosStack.get(0) == null || tableViewerPosStack.get(0).getInput() == null || ((List)tableViewerPosStack.get(0).getInput()).size() == 0;
  boolean isEmpty2=tableViewerPosStack.get(1) == null || tableViewerPosStack.get(1).getInput() == null || ((List)tableViewerPosStack.get(1).getInput()).size() == 0;
  if (isEmpty1 && isEmpty2) {
    return;
  }
 else {
    TableViewer columnsElementViewer=null;
    if (!isEmpty1) {
      columnsElementViewer=tableViewerPosStack.get(0);
    }
 else {
      columnsElementViewer=tableViewerPosStack.get(1);
    }
    Connection tdProvider=null;
    Object input=columnsElementViewer.getInput();
    List<DBColumnRepNode> columnSet=(List<DBColumnRepNode>)input;
    if (columnSet != null && columnSet.size() != 0) {
      TdColumn column=(TdColumn)((MetadataColumnRepositoryObject)columnSet.get(0).getObject()).getTdColumn();
      if (column != null && column.eIsProxy()) {
        column=(TdColumn)EObjectHelper.resolveObject(column);
      }
      tdProvider=ConnectionHelper.getTdDataProvider(column);
      setConnectionState(masterPage,tdProvider);
    }
  }
}
Program: 138069
Project: 138069
Buggy source:
public void testGetSearchResultStringStringMapOfStringStringBoolean(){
  Map<String,String> information2value=new HashMap<String,String>();
  information2value.put("String_Node_Str","String_Node_Str");
  Map<String,String[]> hits=null;
  try {
    final String inputName="String_Node_Str";
    hits=hl.getSearchResult(indexfolder,inputName,information2value,false);
    String[] soreDocs=hits.get(inputName);
    assertNotNull(soreDocs);
    if (soreDocs != null) {
      boolean found=false;
      for (      String doc : soreDocs) {
        if (inputName.equals(doc)) {
          found=true;
          break;
        }
        System.out.println(doc);
      }
      assertTrue(inputName + "String_Node_Str",found);
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
catch (  ParseException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Test public void testGetSearchResultStringStringMapOfStringStringBoolean(){
  Map<String,String> information2value=new HashMap<String,String>();
  information2value.put("String_Node_Str","String_Node_Str");
  Map<String,String[]> hits=null;
  try {
    final String inputName="String_Node_Str";
    hits=hl.getSearchResult(indexfolder,inputName,information2value,false);
    String[] soreDocs=hits.get(inputName);
    assertNotNull(soreDocs);
    if (soreDocs != null) {
      boolean found=false;
      for (      String doc : soreDocs) {
        if (inputName.equals(doc)) {
          found=true;
          break;
        }
        System.out.println(doc);
      }
      assertTrue(inputName + "String_Node_Str",found);
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
catch (  ParseException e) {
    e.printStackTrace();
  }
}
Program: 138070
Project: 138070
Buggy source:
@AfterClass public static void tearDown() throws Exception {
  searcher.close();
}

Fixed version (ground truth):
@AfterClass public static void tearDown() throws Exception {
  if (searcher != null) {
    searcher.close();
  }
}
Program: 138071
Project: 138071
Buggy source:
public void modifyText(ModifyEvent e){
  if (text.getText() == null || "String_Node_Str".equals(text.getText().trim())) {
    int status=IStatus.ERROR;
    IProject rootProject=SQLExplorerPlugin.getDefault().getRootProject();
    final IFolder defaultValidFolder=rootProject.getFolder("String_Node_Str").getFolder("String_Node_Str");
    if (selectedFolder != null && ("String_Node_Str".equals(selectedFolder.getName()) || defaultValidFolder.getFullPath().isPrefixOf(selectedFolder.getFullPath()))) {
      status=IStatus.INFO;
    }
    updateStatus(new Status(status,SQLExplorerPlugin.PLUGIN_ID,"String_Node_Str"));
    text.setText(DEFAULT_FILE_NAME);
    fileName=DEFAULT_FILE_NAME;
  }
 else {
    fileName=text.getText();
  }
}

Fixed version (ground truth):
public void modifyText(ModifyEvent e){
  if (text.getText() == null || "String_Node_Str".equals(text.getText().trim())) {
    int status=IStatus.ERROR;
    IProject rootProject=ReponsitoryContextBridge.getRootProject();
    final IFolder defaultValidFolder=rootProject.getFolder("String_Node_Str").getFolder("String_Node_Str");
    if (selectedFolder != null && ("String_Node_Str".equals(selectedFolder.getName()) || defaultValidFolder.getFullPath().isPrefixOf(selectedFolder.getFullPath()))) {
      status=IStatus.INFO;
    }
    updateStatus(new Status(status,SQLExplorerPlugin.PLUGIN_ID,"String_Node_Str"));
    text.setText(DEFAULT_FILE_NAME);
    fileName=DEFAULT_FILE_NAME;
  }
 else {
    fileName=text.getText();
  }
}
Program: 138072
Project: 138072
Buggy source:
/** 
 * qzhang FolderSelectionDialog constructor comment.
 * @param parent
 * @param labelProvider
 * @param contentProvider
 */
public FolderSelectionDialog(Shell parent,ILabelProvider labelProvider,ITreeContentProvider contentProvider){
  super(parent,labelProvider,contentProvider);
  IProject rootProject=SQLExplorerPlugin.getDefault().getRootProject();
  final IFolder defaultValidFolder=rootProject.getFolder("String_Node_Str").getFolder("String_Node_Str");
  setComparator(new ResourceComparator(ResourceComparator.NAME));
  setValidator(new ISelectionStatusValidator(){
    public IStatus validate(    Object[] selection){
      if (selection.length == 1) {
        if (selection[0] instanceof IFolder) {
          selectedFolder=(IFolder)selection[0];
          IPath projectRelativePath=selectedFolder.getProjectRelativePath();
          if ("String_Node_Str".equals(selectedFolder.getName()) || defaultValidFolder.getFullPath().isPrefixOf(selectedFolder.getFullPath())) {
            return Status.OK_STATUS;
          }
        }
      }
      return new Status(IStatus.ERROR,SQLExplorerPlugin.PLUGIN_ID,"String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
/** 
 * qzhang FolderSelectionDialog constructor comment.
 * @param parent
 * @param labelProvider
 * @param contentProvider
 */
public FolderSelectionDialog(Shell parent,ILabelProvider labelProvider,ITreeContentProvider contentProvider){
  super(parent,labelProvider,contentProvider);
  IProject rootProject=ReponsitoryContextBridge.getRootProject();
  final IFolder defaultValidFolder=rootProject.getFolder("String_Node_Str").getFolder("String_Node_Str");
  setComparator(new ResourceComparator(ResourceComparator.NAME));
  setValidator(new ISelectionStatusValidator(){
    public IStatus validate(    Object[] selection){
      if (selection.length == 1) {
        if (selection[0] instanceof IFolder) {
          selectedFolder=(IFolder)selection[0];
          IPath projectRelativePath=selectedFolder.getProjectRelativePath();
          if ("String_Node_Str".equals(selectedFolder.getName()) || defaultValidFolder.getFullPath().isPrefixOf(selectedFolder.getFullPath())) {
            return Status.OK_STATUS;
          }
        }
      }
      return new Status(IStatus.ERROR,SQLExplorerPlugin.PLUGIN_ID,"String_Node_Str");
    }
  }
);
}
Program: 138073
Project: 138073
Buggy source:
protected Control createDialogArea(Composite parent){
  Composite result=(Composite)super.createDialogArea(parent);
  Composite fileNameComp=new Composite(result,SWT.NULL);
  fileNameComp.setLayout(new GridLayout(2,false));
  fileNameComp.setLayoutData(new GridData(GridData.FILL_BOTH));
  Label label=new Label(fileNameComp,SWT.NULL);
  label.setText("String_Node_Str");
  final Text text=new Text(fileNameComp,SWT.BORDER);
  text.setText(this.getFileName());
  text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  text.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      if (text.getText() == null || "String_Node_Str".equals(text.getText().trim())) {
        int status=IStatus.ERROR;
        IProject rootProject=SQLExplorerPlugin.getDefault().getRootProject();
        final IFolder defaultValidFolder=rootProject.getFolder("String_Node_Str").getFolder("String_Node_Str");
        if (selectedFolder != null && ("String_Node_Str".equals(selectedFolder.getName()) || defaultValidFolder.getFullPath().isPrefixOf(selectedFolder.getFullPath()))) {
          status=IStatus.INFO;
        }
        updateStatus(new Status(status,SQLExplorerPlugin.PLUGIN_ID,"String_Node_Str"));
        text.setText(DEFAULT_FILE_NAME);
        fileName=DEFAULT_FILE_NAME;
      }
 else {
        fileName=text.getText();
      }
    }
  }
);
  getTreeViewer().addSelectionChangedListener(this);
  getTreeViewer().expandAll();
  applyDialogFont(result);
  return result;
}

Fixed version (ground truth):
protected Control createDialogArea(Composite parent){
  Composite result=(Composite)super.createDialogArea(parent);
  Composite fileNameComp=new Composite(result,SWT.NULL);
  fileNameComp.setLayout(new GridLayout(2,false));
  fileNameComp.setLayoutData(new GridData(GridData.FILL_BOTH));
  Label label=new Label(fileNameComp,SWT.NULL);
  label.setText("String_Node_Str");
  final Text text=new Text(fileNameComp,SWT.BORDER);
  text.setText(this.getFileName());
  text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  text.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      if (text.getText() == null || "String_Node_Str".equals(text.getText().trim())) {
        int status=IStatus.ERROR;
        IProject rootProject=ReponsitoryContextBridge.getRootProject();
        final IFolder defaultValidFolder=rootProject.getFolder("String_Node_Str").getFolder("String_Node_Str");
        if (selectedFolder != null && ("String_Node_Str".equals(selectedFolder.getName()) || defaultValidFolder.getFullPath().isPrefixOf(selectedFolder.getFullPath()))) {
          status=IStatus.INFO;
        }
        updateStatus(new Status(status,SQLExplorerPlugin.PLUGIN_ID,"String_Node_Str"));
        text.setText(DEFAULT_FILE_NAME);
        fileName=DEFAULT_FILE_NAME;
      }
 else {
        fileName=text.getText();
      }
    }
  }
);
  getTreeViewer().addSelectionChangedListener(this);
  getTreeViewer().expandAll();
  applyDialogFont(result);
  return result;
}
Program: 138075
Project: 138075
Buggy source:
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#getColumn2()}.
 */
@Test public void testGetColumn2(){
  fail("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#getColumn2()}.
 */
@Test public void testGetColumn2(){
  CwmZExpression<Double> exp=new CwmZExpression<Double>(SqlPredicate.EQUAL);
  String name="String_Node_Str";
  TdColumn column=getColumn(name);
  TdTable table=getTable(tableName);
  column.setOwner(table);
  Double value=new Double(5.0);
  exp.setOperands(column,value);
  Assert.assertNull(exp.getColumn2());
}
Program: 138076
Project: 138076
Buggy source:
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#generateExpressions()}.
 */
@Test public void testGenerateExpressions(){
  fail("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#generateExpressions()}.
 */
@Test public void testGenerateExpressions(){
  CwmZExpression<String> expre=new CwmZExpression<String>(SqlPredicate.EQUAL);
  TdColumn column=getColumn("String_Node_Str");
  TdTable table=getTable(tableName);
  column.setOwner(table);
  expre.setOperands(column,"String_Node_Str");
  Assert.assertNotNull(expre.generateExpressions());
  String nameStr=tableName + "String_Node_Str" + column.getName();
  System.out.println(expre.generateExpressions().getExpression().getBody());
  Assert.assertEquals(simpleExpectedExpression(nameStr,SqlPredicate.EQUAL,"String_Node_Str"),expre.generateExpressions().getExpression().getBody());
}
Program: 138077
Project: 138077
Buggy source:
/** 
 * DOC scorreia Comment method "generateExpression".
 * @param operator
 * @param value
 * @param name
 */
private <T>void generateExpression(SqlPredicate operator,String name,T value){
  CwmZExpression<T> exp=new CwmZExpression<T>(operator);
  TdColumn column=getColumn(name);
  exp.setOperands(column,value);
  ZExpression zExpression=exp.generateZExpression();
  Assert.assertNotNull(zExpression);
  Assert.assertEquals(simpleExpectedExpression(name,operator,value),zExpression.toString());
  System.out.println(zExpression.toString());
}

Fixed version (ground truth):
/** 
 * DOC scorreia Comment method "generateExpression".
 * @param operator
 * @param value
 * @param name
 */
private <T>void generateExpression(SqlPredicate operator,String name,T value){
  CwmZExpression<T> exp=new CwmZExpression<T>(operator);
  TdColumn column=getColumn(name);
  TdTable table=getTable(tableName);
  column.setOwner(table);
  exp.setOperands(column,value);
  ZExpression zExpression=exp.generateZExpression();
  Assert.assertNotNull(zExpression);
  String nameStr=tableName + "String_Node_Str" + column.getName();
  Assert.assertEquals(simpleExpectedExpression(nameStr,operator,value),zExpression.toString());
  System.out.println(zExpression.toString());
}
Program: 138078
Project: 138078
Buggy source:
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#getColumn1()}.
 */
@Test public void testGetColumn1(){
  fail("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#getColumn1()}.
 */
@Test public void testGetColumn1(){
  CwmZExpression<Double> exp=new CwmZExpression<Double>(SqlPredicate.EQUAL);
  String name="String_Node_Str";
  TdColumn column=getColumn(name);
  TdTable table=getTable(tableName);
  column.setOwner(table);
  Double value=new Double(5.0);
  exp.setOperands(column,value);
  Assert.assertNotNull(exp.getColumn1());
}
Program: 138079
Project: 138079
Buggy source:
private <T>String simpleExpectedExpression(String left,SqlPredicate operator,T right){
  String rightStr=right.toString();
  if (operator.equals(SqlPredicate.IN) || operator.equals(SqlPredicate.NOT_IN)) {
    rightStr=parenthesis(rightStr);
  }
  return parenthesis(left + "String_Node_Str" + operator.getLiteral()+ "String_Node_Str"+ rightStr);
}

Fixed version (ground truth):
private <T>String simpleExpectedExpression(String left,SqlPredicate operator,T right){
  String rightStr=right.toString();
  if (operator.equals(SqlPredicate.UNION) || operator.equals(SqlPredicate.ALL)) {
    return left + "String_Node_Str" + operator.getLiteral()+ "String_Node_Str"+ rightStr;
  }
  if (operator.equals(SqlPredicate.IN) || operator.equals(SqlPredicate.NOT_IN)) {
    rightStr=parenthesis(rightStr);
  }
  return parenthesis(left + "String_Node_Str" + operator.getLiteral()+ "String_Node_Str"+ rightStr);
}
Program: 138080
Project: 138080
Buggy source:
/** 
 * Test method for  {@link org.talend.dq.sql.converters.CwmZExpression#setOperands(orgomg.cwm.resource.relational.Column,orgomg.cwm.resource.relational.Column)}.
 */
@Test public void testSetOperandsColumnColumn(){
  fail("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Test method for  {@link org.talend.dq.sql.converters.CwmZExpression#setOperands(orgomg.cwm.resource.relational.Column,orgomg.cwm.resource.relational.Column)}.
 */
@Test public void testSetOperandsColumnColumn(){
  CwmZExpression<Integer> exp=new CwmZExpression<Integer>(SqlPredicate.EQUAL);
  String column1_Name="String_Node_Str";
  TdColumn column1=getColumn(column1_Name);
  String column2_Name="String_Node_Str";
  TdColumn column2=getColumn(column2_Name);
  exp.setOperands(column1,column2);
  Assert.assertNull(exp.getInstance());
}
Program: 138081
Project: 138081
Buggy source:
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#getInstance()}.
 */
@Test public void testGetInstance(){
  CwmZExpression<Double> exp=new CwmZExpression<Double>(SqlPredicate.EQUAL);
  String name="String_Node_Str";
  TdColumn column=getColumn(name);
  Double value=new Double(5.0);
  exp.setOperands(column,value);
  Assert.assertEquals(value.toString(),exp.getInstance().toString());
}

Fixed version (ground truth):
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#getInstance()}.
 */
@Test public void testGetInstance(){
  CwmZExpression<Double> exp=new CwmZExpression<Double>(SqlPredicate.EQUAL);
  String name="String_Node_Str";
  TdColumn column=getColumn(name);
  TdTable table=getTable(tableName);
  column.setOwner(table);
  Double value=new Double(5.0);
  exp.setOperands(column,value);
  Assert.assertEquals(value.toString(),exp.getInstance().toString());
}
Program: 138082
Project: 138082
Buggy source:
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#getOperator()}.
 */
@Test public void testGetOperator(){
  Assert.assertTrue(operators.length == 17);
  for (  SqlPredicate equalOp : operators) {
    CwmZExpression<?> exp=new CwmZExpression<Integer>(equalOp);
    String operator=exp.getOperator();
    Assert.assertEquals(equalOp.getLiteral(),operator);
  }
}

Fixed version (ground truth):
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#getOperator()}.
 */
@Test public void testGetOperator(){
  Assert.assertTrue(operators.length == 19);
  for (  SqlPredicate equalOp : operators) {
    CwmZExpression<?> exp=new CwmZExpression<Integer>(equalOp);
    String operator=exp.getOperator();
    Assert.assertEquals(equalOp.getLiteral(),operator);
  }
}
Program: 138084
Project: 138084
Buggy source:
private boolean allowDND(IRepositoryNode sourceNode,IRepositoryNode targetNode){
  IPath sourcePath=WorkbenchUtils.getPath((RepositoryNode)sourceNode);
  IPath targetPath=WorkbenchUtils.getPath((RepositoryNode)targetNode);
  int sourceCount=sourcePath.segmentCount();
  int targetCount=targetPath.segmentCount();
  if (sourceCount == 1 || targetCount == 1) {
    return false;
  }
  if (isSubObjectType(sourceNode,targetNode)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean allowDND(IRepositoryNode sourceNode,IRepositoryNode targetNode){
  IPath sourcePath=WorkbenchUtils.getPath((RepositoryNode)sourceNode);
  IPath targetPath=WorkbenchUtils.getPath((RepositoryNode)targetNode);
  int sourceCount=sourcePath.segmentCount();
  int targetCount=targetPath.segmentCount();
  if (sourceCount == 1 || targetCount == 1) {
    return false;
  }
  if (isSubObjectType(sourceNode,targetNode)) {
    return false;
  }
  IRepositoryViewObject object=sourceNode.getObject();
  if (object != null) {
    if (object.getProperty().getItem().getState().isLocked()) {
      return false;
    }
  }
  return true;
}
Program: 138085
Project: 138085
Buggy source:
public Boolean isModelTask(){
  return "String_Node_Str".equals(getId()) || "String_Node_Str".equals(getId()) || "String_Node_Str".equals(getId())|| "String_Node_Str".equals(getId())|| "String_Node_Str".equals(getId())|| "String_Node_Str".equals(getId())|| "String_Node_Str".equals(getId())|| "String_Node_Str".equals(getId());
}

Fixed version (ground truth):
public Boolean isModelTask(){
  return "String_Node_Str".equals(getId()) || "String_Node_Str".equals(getId()) || "String_Node_Str".equals(getId())|| "String_Node_Str".equals(getId())|| "String_Node_Str".equals(getId())|| "String_Node_Str".equals(getId())|| "String_Node_Str".equals(getId())|| "String_Node_Str".equals(getId())|| "String_Node_Str".equals(getId());
}
Program: 138086
Project: 138086
Buggy source:
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#getColumn2()}.
 */
@Test public void testGetColumn2(){
  fail("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#getColumn2()}.
 */
@Test public void testGetColumn2(){
  CwmZExpression<Double> exp=new CwmZExpression<Double>(SqlPredicate.EQUAL);
  String name="String_Node_Str";
  TdColumn column=getColumn(name);
  TdTable table=getTable(tableName);
  column.setOwner(table);
  Double value=new Double(5.0);
  exp.setOperands(column,value);
  Assert.assertNull(exp.getColumn2());
}
Program: 138087
Project: 138087
Buggy source:
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#generateExpressions()}.
 */
@Test public void testGenerateExpressions(){
  fail("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#generateExpressions()}.
 */
@Test public void testGenerateExpressions(){
  CwmZExpression<String> expre=new CwmZExpression<String>(SqlPredicate.EQUAL);
  TdColumn column=getColumn("String_Node_Str");
  TdTable table=getTable(tableName);
  column.setOwner(table);
  expre.setOperands(column,"String_Node_Str");
  Assert.assertNotNull(expre.generateExpressions());
  String nameStr=tableName + "String_Node_Str" + column.getName();
  System.out.println(expre.generateExpressions().getExpression().getBody());
  Assert.assertEquals(simpleExpectedExpression(nameStr,SqlPredicate.EQUAL,"String_Node_Str"),expre.generateExpressions().getExpression().getBody());
}
Program: 138088
Project: 138088
Buggy source:
/** 
 * DOC scorreia Comment method "generateExpression".
 * @param operator
 * @param value
 * @param name
 */
private <T>void generateExpression(SqlPredicate operator,String name,T value){
  CwmZExpression<T> exp=new CwmZExpression<T>(operator);
  TdColumn column=getColumn(name);
  exp.setOperands(column,value);
  ZExpression zExpression=exp.generateZExpression();
  Assert.assertNotNull(zExpression);
  Assert.assertEquals(simpleExpectedExpression(name,operator,value),zExpression.toString());
  System.out.println(zExpression.toString());
}

Fixed version (ground truth):
/** 
 * DOC scorreia Comment method "generateExpression".
 * @param operator
 * @param value
 * @param name
 */
private <T>void generateExpression(SqlPredicate operator,String name,T value){
  CwmZExpression<T> exp=new CwmZExpression<T>(operator);
  TdColumn column=getColumn(name);
  TdTable table=getTable(tableName);
  column.setOwner(table);
  exp.setOperands(column,value);
  ZExpression zExpression=exp.generateZExpression();
  Assert.assertNotNull(zExpression);
  String nameStr=tableName + "String_Node_Str" + column.getName();
  Assert.assertEquals(simpleExpectedExpression(nameStr,operator,value),zExpression.toString());
  System.out.println(zExpression.toString());
}
Program: 138089
Project: 138089
Buggy source:
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#getColumn1()}.
 */
@Test public void testGetColumn1(){
  fail("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#getColumn1()}.
 */
@Test public void testGetColumn1(){
  CwmZExpression<Double> exp=new CwmZExpression<Double>(SqlPredicate.EQUAL);
  String name="String_Node_Str";
  TdColumn column=getColumn(name);
  TdTable table=getTable(tableName);
  column.setOwner(table);
  Double value=new Double(5.0);
  exp.setOperands(column,value);
  Assert.assertNotNull(exp.getColumn1());
}
Program: 138090
Project: 138090
Buggy source:
private <T>String simpleExpectedExpression(String left,SqlPredicate operator,T right){
  String rightStr=right.toString();
  if (operator.equals(SqlPredicate.IN) || operator.equals(SqlPredicate.NOT_IN)) {
    rightStr=parenthesis(rightStr);
  }
  return parenthesis(left + "String_Node_Str" + operator.getLiteral()+ "String_Node_Str"+ rightStr);
}

Fixed version (ground truth):
private <T>String simpleExpectedExpression(String left,SqlPredicate operator,T right){
  String rightStr=right.toString();
  if (operator.equals(SqlPredicate.UNION) || operator.equals(SqlPredicate.ALL)) {
    return left + "String_Node_Str" + operator.getLiteral()+ "String_Node_Str"+ rightStr;
  }
  if (operator.equals(SqlPredicate.IN) || operator.equals(SqlPredicate.NOT_IN)) {
    rightStr=parenthesis(rightStr);
  }
  return parenthesis(left + "String_Node_Str" + operator.getLiteral()+ "String_Node_Str"+ rightStr);
}
Program: 138091
Project: 138091
Buggy source:
/** 
 * Test method for  {@link org.talend.dq.sql.converters.CwmZExpression#setOperands(orgomg.cwm.resource.relational.Column,orgomg.cwm.resource.relational.Column)}.
 */
@Test public void testSetOperandsColumnColumn(){
  fail("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Test method for  {@link org.talend.dq.sql.converters.CwmZExpression#setOperands(orgomg.cwm.resource.relational.Column,orgomg.cwm.resource.relational.Column)}.
 */
@Test public void testSetOperandsColumnColumn(){
  CwmZExpression<Integer> exp=new CwmZExpression<Integer>(SqlPredicate.EQUAL);
  String column1_Name="String_Node_Str";
  TdColumn column1=getColumn(column1_Name);
  String column2_Name="String_Node_Str";
  TdColumn column2=getColumn(column2_Name);
  exp.setOperands(column1,column2);
  Assert.assertNull(exp.getInstance());
}
Program: 138092
Project: 138092
Buggy source:
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#getInstance()}.
 */
@Test public void testGetInstance(){
  CwmZExpression<Double> exp=new CwmZExpression<Double>(SqlPredicate.EQUAL);
  String name="String_Node_Str";
  TdColumn column=getColumn(name);
  Double value=new Double(5.0);
  exp.setOperands(column,value);
  Assert.assertEquals(value.toString(),exp.getInstance().toString());
}

Fixed version (ground truth):
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#getInstance()}.
 */
@Test public void testGetInstance(){
  CwmZExpression<Double> exp=new CwmZExpression<Double>(SqlPredicate.EQUAL);
  String name="String_Node_Str";
  TdColumn column=getColumn(name);
  TdTable table=getTable(tableName);
  column.setOwner(table);
  Double value=new Double(5.0);
  exp.setOperands(column,value);
  Assert.assertEquals(value.toString(),exp.getInstance().toString());
}
Program: 138093
Project: 138093
Buggy source:
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#getOperator()}.
 */
@Test public void testGetOperator(){
  Assert.assertTrue(operators.length == 17);
  for (  SqlPredicate equalOp : operators) {
    CwmZExpression<?> exp=new CwmZExpression<Integer>(equalOp);
    String operator=exp.getOperator();
    Assert.assertEquals(equalOp.getLiteral(),operator);
  }
}

Fixed version (ground truth):
/** 
 * Test method for   {@link org.talend.dq.sql.converters.CwmZExpression#getOperator()}.
 */
@Test public void testGetOperator(){
  Assert.assertTrue(operators.length == 19);
  for (  SqlPredicate equalOp : operators) {
    CwmZExpression<?> exp=new CwmZExpression<Integer>(equalOp);
    String operator=exp.getOperator();
    Assert.assertEquals(equalOp.getLiteral(),operator);
  }
}
Program: 138095
Project: 138095
Buggy source:
private boolean allowDND(IRepositoryNode sourceNode,IRepositoryNode targetNode){
  IPath sourcePath=WorkbenchUtils.getPath((RepositoryNode)sourceNode);
  IPath targetPath=WorkbenchUtils.getPath((RepositoryNode)targetNode);
  int sourceCount=sourcePath.segmentCount();
  int targetCount=targetPath.segmentCount();
  if (sourceCount == 1 || targetCount == 1) {
    return false;
  }
  if (isSubObjectType(sourceNode,targetNode)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean allowDND(IRepositoryNode sourceNode,IRepositoryNode targetNode){
  IPath sourcePath=WorkbenchUtils.getPath((RepositoryNode)sourceNode);
  IPath targetPath=WorkbenchUtils.getPath((RepositoryNode)targetNode);
  int sourceCount=sourcePath.segmentCount();
  int targetCount=targetPath.segmentCount();
  if (sourceCount == 1 || targetCount == 1) {
    return false;
  }
  if (isSubObjectType(sourceNode,targetNode)) {
    return false;
  }
  IRepositoryViewObject object=sourceNode.getObject();
  if (object != null) {
    if (object.getProperty().getItem().getState().isLocked()) {
      return false;
    }
  }
  return true;
}
Program: 138096
Project: 138096
Buggy source:
@Override public List<IRepositoryNode> getChildren(){
  if (children.isEmpty()) {
    return filterResultsIfAny(children);
  }
  DBColumnFolderRepNode columnFolderNode=new DBColumnFolderRepNode(null,this,ENodeType.TDQ_REPOSITORY_ELEMENT);
  children.add(columnFolderNode);
  return filterResultsIfAny(children);
}

Fixed version (ground truth):
@Override public List<IRepositoryNode> getChildren(){
  if (!children.isEmpty()) {
    return filterResultsIfAny(children);
  }
  DBColumnFolderRepNode columnFolderNode=new DBColumnFolderRepNode(null,this,ENodeType.TDQ_REPOSITORY_ELEMENT);
  children.add(columnFolderNode);
  return filterResultsIfAny(children);
}
Program: 138101
Project: 138101
Buggy source:
public static List<RuleRepNode> getRuleRepNodes(IRepositoryNode parrentNode,boolean recursiveFind,boolean withDeleted){
  List<RuleRepNode> result=new ArrayList<RuleRepNode>();
  if (parrentNode != null && (parrentNode instanceof RulesSQLFolderRepNode || parrentNode instanceof RulesSubFolderRepNode || parrentNode instanceof RulesParserFolderRepNode)) {
    List<IRepositoryNode> children=parrentNode.getChildren(withDeleted);
    if (children.size() > 0) {
      for (      IRepositoryNode inode : children) {
        if (inode instanceof RuleRepNode) {
          result.add((RuleRepNode)inode);
        }
 else         if (inode instanceof RulesSQLFolderRepNode || inode instanceof RulesSubFolderRepNode) {
          if (recursiveFind) {
            result.addAll(getRuleRepNodes(inode,recursiveFind,withDeleted));
          }
        }
      }
    }
  }
  return result;
}

Fixed version (ground truth):
public static List<RuleRepNode> getRuleRepNodes(IRepositoryNode parrentNode,boolean recursiveFind,boolean withDeleted){
  List<RuleRepNode> result=new ArrayList<RuleRepNode>();
  if (parrentNode != null && (parrentNode instanceof RulesSQLFolderRepNode || parrentNode instanceof RulesSQLSubFolderRepNode || parrentNode instanceof RulesParserSubFolderRepNode|| parrentNode instanceof RulesParserFolderRepNode)) {
    List<IRepositoryNode> children=parrentNode.getChildren(withDeleted);
    if (children.size() > 0) {
      for (      IRepositoryNode inode : children) {
        if (inode instanceof RuleRepNode) {
          result.add((RuleRepNode)inode);
        }
 else         if (inode instanceof RulesSQLFolderRepNode || inode instanceof RulesSQLSubFolderRepNode || inode instanceof RulesParserSubFolderRepNode) {
          if (recursiveFind) {
            result.addAll(getRuleRepNodes(inode,recursiveFind,withDeleted));
          }
        }
      }
    }
  }
  return result;
}
Program: 138104
Project: 138104
Buggy source:
private boolean shouldShowRenameFolderMenu(RepositoryNode node){
  boolean show=false;
  if (node instanceof AnalysisSubFolderRepNode) {
    AnalysisSubFolderRepNode anaSubFolderNode=(AnalysisSubFolderRepNode)node;
    show=!anaSubFolderNode.isVirtualFolder();
  }
 else   if (node instanceof ReportSubFolderRepNode) {
    ReportSubFolderRepNode repSubFolderNode=(ReportSubFolderRepNode)node;
    show=!repSubFolderNode.isVirtualFolder();
  }
 else   if (node instanceof UserDefIndicatorSubFolderRepNode || node instanceof PatternRegexSubFolderRepNode || node instanceof PatternSqlSubFolderRepNode|| node instanceof RulesSubFolderRepNode|| node instanceof DBConnectionSubFolderRepNode|| node instanceof MDMConnectionSubFolderRepNode|| node instanceof DFConnectionSubFolderRepNode) {
    show=true;
  }
  return show;
}

Fixed version (ground truth):
private boolean shouldShowRenameFolderMenu(RepositoryNode node){
  boolean show=false;
  if (node instanceof AnalysisSubFolderRepNode) {
    AnalysisSubFolderRepNode anaSubFolderNode=(AnalysisSubFolderRepNode)node;
    show=!anaSubFolderNode.isVirtualFolder();
  }
 else   if (node instanceof ReportSubFolderRepNode) {
    ReportSubFolderRepNode repSubFolderNode=(ReportSubFolderRepNode)node;
    show=!repSubFolderNode.isVirtualFolder();
  }
 else   if (node instanceof UserDefIndicatorSubFolderRepNode || node instanceof PatternRegexSubFolderRepNode || node instanceof PatternSqlSubFolderRepNode|| node instanceof RulesSQLSubFolderRepNode|| node instanceof RulesParserSubFolderRepNode|| node instanceof DBConnectionSubFolderRepNode|| node instanceof MDMConnectionSubFolderRepNode|| node instanceof DFConnectionSubFolderRepNode) {
    show=true;
  }
  return show;
}
Program: 138105
Project: 138105
Buggy source:
private void moveCommonRepNode(IRepositoryNode sourceNode,IRepositoryNode targetNode){
  IRepositoryViewObject objectToMove=sourceNode.getObject();
  ERepositoryObjectType targetObjectType=targetNode.getContentType();
  IPath fullPath=getNodeFullPath(targetObjectType);
  IPath makeRelativeTo=fullPath.makeRelativeTo(ResourceManager.getRootProject().getFullPath());
  IPath removeLastSegments=makeRelativeTo.removeLastSegments(1);
  if (ERepositoryObjectType.TDQ_RULES_SQL.equals(targetObjectType) || ERepositoryObjectType.TDQ_ANALYSIS_ELEMENT.equals(targetObjectType) || ERepositoryObjectType.TDQ_REPORT_ELEMENT.equals(targetObjectType)|| ERepositoryObjectType.METADATA_CONNECTIONS.equals(targetObjectType)|| ERepositoryObjectType.METADATA_FILE_DELIMITED.equals(targetObjectType)|| ERepositoryObjectType.METADATA_MDMCONNECTION.equals(targetObjectType)) {
    removeLastSegments=makeRelativeTo;
  }
  if (targetNode.getType() == ENodeType.SIMPLE_FOLDER) {
    moveObject(objectToMove,sourceNode,targetNode,removeLastSegments);
  }
 else   if (targetNode.getType() == ENodeType.SYSTEM_FOLDER) {
    moveObject(objectToMove,sourceNode,targetNode,removeLastSegments);
  }
  CorePlugin.getDefault().refreshDQView(targetNode.getParent());
}

Fixed version (ground truth):
private void moveCommonRepNode(IRepositoryNode sourceNode,IRepositoryNode targetNode){
  IRepositoryViewObject objectToMove=sourceNode.getObject();
  ERepositoryObjectType targetObjectType=targetNode.getContentType();
  IPath fullPath=getNodeFullPath(targetObjectType);
  IPath makeRelativeTo=fullPath.makeRelativeTo(ResourceManager.getRootProject().getFullPath());
  IPath removeLastSegments=makeRelativeTo.removeLastSegments(1);
  if (ERepositoryObjectType.TDQ_RULES_SQL.equals(targetObjectType) || ERepositoryObjectType.TDQ_RULES_PARSER.equals(targetObjectType) || ERepositoryObjectType.METADATA_FILE_DELIMITED.equals(targetObjectType)|| ERepositoryObjectType.METADATA_MDMCONNECTION.equals(targetObjectType)) {
    removeLastSegments=makeRelativeTo;
  }
  if (targetNode.getType() == ENodeType.SIMPLE_FOLDER) {
    moveObject(objectToMove,sourceNode,targetNode,removeLastSegments);
  }
 else   if (targetNode.getType() == ENodeType.SYSTEM_FOLDER) {
    moveObject(objectToMove,sourceNode,targetNode,removeLastSegments);
  }
  CorePlugin.getDefault().refreshDQView(targetNode.getParent());
}
Program: 138107
Project: 138107
Buggy source:
/** 
 * DOC bZhou Comment method "createNewItemFile".
 * @param file
 */
private void createNewItemFile(File file){
  ModelElement modelElement=getModelElement(file);
  if (modelElement != null) {
    boolean needUpdateFlag=!modelElement.eIsProxy();
    if (needUpdateFlag) {
      IFile iFile=WorkspaceUtils.fileToIFile(file);
      IFolder parentFolder=(IFolder)iFile.getParent();
      Resource oldRes=modelElement.eResource();
      List<Resource> needSaves=getReferenceResources(oldRes);
      AElementPersistance writer=ElementWriterFactory.getInstance().create(modelElement);
      writer.create(modelElement,parentFolder,true);
      EMFUtil.changeUri(oldRes,EObjectHelper.getURI(modelElement));
      for (      Resource toSave : needSaves) {
        EMFSharedResources.getInstance().saveResource(toSave);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "createNewItemFile".
 * @param file
 */
private void createNewItemFile(File file){
  ModelElement modelElement=getModelElement(file);
  if (modelElement != null) {
    boolean needUpdateFlag=!modelElement.eIsProxy();
    if (needUpdateFlag) {
      IFile iFile=WorkspaceUtils.fileToIFile(file);
      IFolder parentFolder=(IFolder)iFile.getParent();
      Resource oldRes=modelElement.eResource();
      List<Resource> needSaves=getReferenceResources(oldRes,modelElement);
      AElementPersistance writer=ElementWriterFactory.getInstance().create(modelElement);
      writer.create(modelElement,parentFolder,true);
      EMFUtil.changeUri(oldRes,EObjectHelper.getURI(modelElement));
      for (      Resource toSave : needSaves) {
        EMFSharedResources.getInstance().saveResource(toSave);
      }
    }
  }
}
Program: 138108
Project: 138108
Buggy source:
/** 
 * DOC bZhou Comment method "getReferenceResources".
 * @param res
 * @return
 */
public List<Resource> getReferenceResources(Resource res){
  EcoreUtil.resolveAll(res);
  Map<EObject,Collection<Setting>> find=EcoreUtil.ExternalCrossReferencer.find(res);
  List<Resource> needSaves=new ArrayList<Resource>();
  for (  EObject object : find.keySet()) {
    Resource resource=object.eResource();
    if (resource == null) {
      continue;
    }
    EcoreUtil.resolveAll(resource);
    needSaves.add(resource);
  }
  needSaves.add(res);
  return needSaves;
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "getReferenceResources".
 * @param res
 * @param modelElement
 * @return
 */
public List<Resource> getReferenceResources(Resource res,ModelElement modelElement){
  EcoreUtil.resolveAll(res);
  Map<EObject,Collection<Setting>> find=EcoreUtil.ExternalCrossReferencer.find(res);
  List<Resource> needSaves=new ArrayList<Resource>();
  for (  EObject object : find.keySet()) {
    Resource resource=object.eResource();
    if (resource == null) {
      continue;
    }
    EcoreUtil.resolveAll(resource);
    needSaves.add(resource);
  }
  if (res.getURI().toPlatformString(false).contains(EResourceConstant.LIBRARIES.getPath())) {
    final List<? extends ModelElement> allElement=AnaResourceFileHelper.getInstance().getAllElement();
    for (    ModelElement element : allElement) {
      Map<EObject,Collection<Setting>> allFind=EcoreUtil.ExternalCrossReferencer.find(element.eResource());
      if (allFind.keySet().contains(modelElement)) {
        needSaves.add(element.eResource());
      }
    }
  }
  needSaves.add(res);
  return needSaves;
}
Program: 138111
Project: 138111
Buggy source:
/** 
 * DOC bZhou Comment method "createNewItemFile".
 * @param file
 */
private void createNewItemFile(File file){
  ModelElement modelElement=getModelElement(file);
  if (modelElement != null) {
    boolean needUpdateFlag=!modelElement.eIsProxy();
    if (needUpdateFlag) {
      IFile iFile=WorkspaceUtils.fileToIFile(file);
      IFolder parentFolder=(IFolder)iFile.getParent();
      AElementPersistance writer=ElementWriterFactory.getInstance().create(modelElement);
      writer.create(modelElement,parentFolder,true);
    }
    URI uri=EObjectHelper.getURI(modelElement);
    if (uri != null) {
      replaceMap.put(file.getName(),uri.lastSegment());
      if (needUpdateFlag && uri.isPlatform()) {
        IPath filePath=new Path(uri.toPlatformString(false));
        IFile needUpdateFile=ResourceManager.getRoot().getFile(filePath);
        newFileList.add(needUpdateFile.getLocation().toFile());
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "createNewItemFile".
 * @param file
 */
private void createNewItemFile(File file){
  ModelElement modelElement=getModelElement(file);
  if (modelElement != null) {
    boolean needUpdateFlag=!modelElement.eIsProxy();
    if (needUpdateFlag) {
      IFile iFile=WorkspaceUtils.fileToIFile(file);
      IFolder parentFolder=(IFolder)iFile.getParent();
      Resource oldRes=modelElement.eResource();
      List<Resource> needSaves=getReferenceResources(oldRes);
      AElementPersistance writer=ElementWriterFactory.getInstance().create(modelElement);
      writer.create(modelElement,parentFolder,true);
      EMFUtil.changeUri(oldRes,EObjectHelper.getURI(modelElement));
      for (      Resource toSave : needSaves) {
        EMFSharedResources.getInstance().saveResource(toSave);
      }
    }
  }
}
Program: 138112
Project: 138112
Buggy source:
@Override protected boolean doExecute() throws Exception {
  newFileList=new ArrayList<File>();
  replaceMap=new HashMap<String,String>();
  ArrayList<File> fileList=getNeedUpdateFiles();
  for (  File file : fileList) {
    createNewItemFile(file);
    deleteOldItemFile(file);
  }
  updateConnectionFile();
  updateFile();
  return true;
}

Fixed version (ground truth):
@Override protected boolean doExecute() throws Exception {
  ArrayList<File> fileList=getNeedUpdateFiles();
  for (  File file : fileList) {
    createNewItemFile(file);
    deleteOldItemFile(file);
  }
  updateConnectionFile();
  return true;
}
Program: 138113
Project: 138113
Buggy source:
/** 
 * DOC bZhou Comment method "addConnectionFileToUpdate".
 */
private void updateConnectionFile(){
  File rawDir=getWorkspacePath().append(EResourceConstant.METADATA.getPath()).toFile();
  ArrayList<File> fileList=new ArrayList<File>();
  if (rawDir.exists()) {
    getAllFilesFromFolder(rawDir,fileList,new FilenameFilter(){
      public boolean accept(      File dir,      String name){
        return name.endsWith(FactoriesUtil.ITEM_EXTENSION);
      }
    }
);
  }
  for (  File file : fileList) {
    IFile iFile=WorkspaceUtils.fileToIFile(file);
    Property property=PropertyHelper.getProperty(iFile);
    if (property != null) {
      Item item=property.getItem();
      EResourceConstant type=EResourceConstant.getTypedConstant(item);
      if (type == EResourceConstant.DB_CONNECTIONS) {
        DatabaseConnectionItem dbItem=(DatabaseConnectionItem)item;
        DatabaseConnection connection=(DatabaseConnection)dbItem.getConnection();
        String otherParameter=ConnectionHelper.getOtherParameter(connection);
        if (!StringUtils.isBlank(otherParameter)) {
          connection.setUiSchema(otherParameter);
          EMFSharedResources.getInstance().saveResource(connection.eResource());
        }
      }
    }
  }
  newFileList.addAll(fileList);
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "addConnectionFileToUpdate".
 */
private void updateConnectionFile(){
  File rawDir=getWorkspacePath().append(EResourceConstant.METADATA.getPath()).toFile();
  ArrayList<File> fileList=new ArrayList<File>();
  if (rawDir.exists()) {
    getAllFilesFromFolder(rawDir,fileList,new FilenameFilter(){
      public boolean accept(      File dir,      String name){
        return name.endsWith(FactoriesUtil.ITEM_EXTENSION);
      }
    }
);
  }
  for (  File file : fileList) {
    IFile iFile=WorkspaceUtils.fileToIFile(file);
    Property property=PropertyHelper.getProperty(iFile);
    if (property != null) {
      Item item=property.getItem();
      EResourceConstant type=EResourceConstant.getTypedConstant(item);
      if (type == EResourceConstant.DB_CONNECTIONS) {
        DatabaseConnectionItem dbItem=(DatabaseConnectionItem)item;
        DatabaseConnection connection=(DatabaseConnection)dbItem.getConnection();
        String otherParameter=ConnectionHelper.getOtherParameter(connection);
        if (!StringUtils.isBlank(otherParameter)) {
          connection.setUiSchema(otherParameter);
          EMFSharedResources.getInstance().saveResource(connection.eResource());
        }
      }
    }
  }
}
Program: 138118
Project: 138118
Buggy source:
/** 
 * DOC klliu Comment method "expandImageComposite".
 * @param expand
 */
protected void expandImageComposite(boolean expand){
  GridData formData=new GridData(GridData.FILL_HORIZONTAL);
  if (expand) {
    formData.heightHint=30;
  }
 else {
    formData.heightHint=0;
  }
  formData.horizontalAlignment=GridData.BEGINNING;
  imgCom.setLayoutData(formData);
  imgCom.getParent().layout();
}

Fixed version (ground truth):
/** 
 * DOC klliu Comment method "expandImageComposite".
 * @param expand
 */
protected void expandImageComposite(){
  GridData formData=new GridData(GridData.FILL_HORIZONTAL);
  formData.heightHint=30;
  formData.horizontalAlignment=GridData.BEGINNING;
  imgCom.setLayoutData(formData);
  imgCom.getParent().layout();
}
Program: 138121
Project: 138121
Buggy source:
/** 
 * DOC qiongli :excute super method run().
 * @param currentNode:null for logical delete a selected element by UI.none-null for physical delete or logicaldelete dependecy.
 */
private void excuteSuperRun(RepositoryNode currentNode){
  this.currentNode=currentNode;
  if (currentNode != null) {
    deleteConnectionForSQL(currentNode);
  }
  super.setAvoidUnloadResources(true);
  IRepositoryNode node=getCurrentRepositoryNode();
  super.run();
  if (currentNode != null) {
    RepositoryNode parent=currentNode.getParent();
    if (parent != null && (parent.getType() == ENodeType.SIMPLE_FOLDER || parent.getLabel().equalsIgnoreCase(ERepositoryObjectType.RECYCLE_BIN.name().replaceAll("String_Node_Str",PluginConstant.SPACE_STRING)))) {
      parent.getChildren(true).remove(currentNode);
    }
  }
  if (null != node) {
    CorePlugin.getDefault().refreshDQView(node.getParent());
  }
}

Fixed version (ground truth):
/** 
 * DOC qiongli :excute super method run().
 * @param currentNode:null for logical delete a selected element by UI.none-null for physical delete or logicaldelete dependecy.
 */
private void excuteSuperRun(RepositoryNode currentNode){
  this.currentNode=currentNode;
  if (currentNode != null) {
    deleteConnectionForSQL(currentNode);
  }
  super.setAvoidUnloadResources(true);
  IRepositoryNode node=getCurrentRepositoryNode();
  super.run();
  if (currentNode != null) {
    RepositoryNode parent=currentNode.getParent();
    if (parent != null && (parent.getType() == ENodeType.SIMPLE_FOLDER || parent.getLabel().equalsIgnoreCase(ERepositoryObjectType.RECYCLE_BIN.name().replaceAll("String_Node_Str",PluginConstant.SPACE_STRING)))) {
      parent.getChildren(true).remove(currentNode);
    }
  }
}