nus-yam/ex-repair huggingface dataset:
Program: 136437
Project: 136437
Buggy source:
@Test public void unlockWithCommitShouldCommitChanges() throws RepositoryException, LibrarySaveException {
  ProjectNode uploadProject=createProject("String_Node_Str",getRepositoryForTest(),"String_Node_Str");
  LibraryNode testLibary=LibraryNodeBuilder.create("String_Node_Str",getRepositoryForTest().getNamespace() + "String_Node_Str","String_Node_Str",new Version(1,0,0)).build(uploadProject,pc);
  LibraryChainNode library=rc.manage(getRepositoryForTest(),Collections.singletonList(testLibary)).get(0);
  library.getHead().lock();
  String coreObjectName="String_Node_Str";
  library.getHead().addMember(ComponentNodeBuilder.createCoreObject(coreObjectName).addProperty("String_Node_Str").setSimpleType().get());
  mc.getRepositoryController().unlock(library.getHead());
  Assert.assertEquals(1,library.getDescendants_NamedTypes().size());
  library.close();
  RepositoryItemNode nodeToRetrive=findRepositoryItem(library,getRepositoryForTest());
  pc.add(defaultProject,nodeToRetrive.getItem());
  Assert.assertEquals(1,defaultProject.getChildren().size());
  LibraryChainNode nodes=(LibraryChainNode)defaultProject.getChildren().get(0);
  Assert.assertEquals(library.getName(),nodes.getName());
  Assert.assertEquals(library.getHead().getNamespace(),nodes.getHead().getNamespace());
  Assert.assertEquals(1,nodes.getDescendants_NamedTypes().size());
}

Fixed version (ground truth):
@Test public void unlockWithCommitShouldCommitChanges() throws RepositoryException, LibrarySaveException {
  ProjectNode uploadProject=createProject("String_Node_Str",getRepositoryForTest(),"String_Node_Str");
  LibraryNode testLibary=LibraryNodeBuilder.create("String_Node_Str",getRepositoryForTest().getNamespace() + "String_Node_Str","String_Node_Str",new Version(1,0,0)).build(uploadProject,pc);
  LibraryChainNode library=rc.manage(getRepositoryForTest(),Collections.singletonList(testLibary)).get(0);
  library.getHead().lock();
  String coreObjectName="String_Node_Str";
  library.getHead().addMember(ComponentNodeBuilder.createCoreObject(coreObjectName).addProperty("String_Node_Str").setSimpleType().get());
  mc.getRepositoryController().unlock(library.getHead());
  Assert.assertEquals(1,library.getDescendants_NamedTypes().size());
  String libraryName=library.getHead().getName();
  String libraryChainName=library.getName();
  String namespace=library.getNamespace();
  library.close();
  RepositoryItemNode nodeToRetrive=findRepositoryItem(libraryName,namespace,getRepositoryForTest());
  pc.add(defaultProject,nodeToRetrive.getItem());
  Assert.assertEquals(1,defaultProject.getChildren().size());
  LibraryChainNode nodes=(LibraryChainNode)defaultProject.getChildren().get(0);
  Assert.assertEquals(libraryChainName,nodes.getName());
  Assert.assertEquals(namespace,nodes.getHead().getNamespace());
  Assert.assertEquals(1,nodes.getDescendants_NamedTypes().size());
}
Program: 136440
Project: 136440
Buggy source:
/** 
 * Versioning - major, minor, patch Project controller Legal library, illegal library (duplicate VWA namespace:name) Assure new version is in LibraryChain correctly. Assure old version is not directly in TLProject or projectNode.children Assure new version is in repository. Assure versions can start with 0.0.0 and variations.
 */
@Test public void createMajorVersionWithSimpleCoreWithoutType() throws RepositoryException, LibrarySaveException {
  ProjectNode uploadProject=createProject("String_Node_Str",getRepositoryForTest(),"String_Node_Str");
  LibraryNode testLibary=LibraryNodeBuilder.create("String_Node_Str",getRepositoryForTest().getNamespace() + "String_Node_Str","String_Node_Str",new Version(1,0,0)).makeFinal().build(uploadProject,pc);
  testLibary.addMember(ComponentNodeBuilder.createCoreObject("String_Node_Str").addProperty("String_Node_Str").get());
  LibraryChainNode chain=rc.manage(getRepositoryForTest(),Collections.singletonList(testLibary)).get(0);
  LibraryNode newMajor=rc.createMajorVersion(chain.getHead());
  ValidationFindings findings=newMajor.validate();
  Assert.assertEquals(0,findings.getFindingsAsList(FindingType.ERROR).size());
}

Fixed version (ground truth):
@Test public void createMajorVersionWithSimpleCoreWithoutType() throws RepositoryException, LibrarySaveException {
  ProjectNode uploadProject=createProject("String_Node_Str",getRepositoryForTest(),"String_Node_Str");
  LibraryNode testLibary=LibraryNodeBuilder.create("String_Node_Str",getRepositoryForTest().getNamespace() + "String_Node_Str","String_Node_Str",new Version(1,0,0)).makeFinal().build(uploadProject,pc);
  testLibary.addMember(ComponentNodeBuilder.createCoreObject("String_Node_Str").addProperty("String_Node_Str").get());
  LibraryChainNode chain=rc.manage(getRepositoryForTest(),Collections.singletonList(testLibary)).get(0);
  LibraryNode newMajor=rc.createMajorVersion(chain.getHead());
  ValidationFindings findings=newMajor.validate();
  Assert.assertEquals(0,findings.getFindingsAsList(FindingType.ERROR).size());
}
Program: 136441
Project: 136441
Buggy source:
private void assertAllLibrariesLoadedCorrectly(LibraryChainNode baseChain,LibraryChainNode extChain){
  mc.getLibraryController().remove(Collections.singletonList(baseChain));
  mc.getLibraryController().remove(Collections.singletonList(extChain));
  Assert.assertEquals(0,uploadProject.getChildren().size());
  RepositoryItemNode nodeToRetrive=findRepositoryItem(extChain,getRepositoryForTest());
  pc.add(uploadProject,nodeToRetrive.getItem());
  Assert.assertEquals(2,uploadProject.getChildren().size());
  LibraryChainNode lib=findLibrary(extLib.getName(),uploadProject.getChildren());
  VWA_Node vwaNode=(VWA_Node)lib.getDescendants_NamedTypes().get(0);
  AttributeNode attr=(AttributeNode)vwaNode.getAttributeFacet().getChildren().get(0);
  Assert.assertNotSame(ModelNode.getUnassignedNode(),attr.getTypeNode());
  Assert.assertSame(attr.getTypeNode().getModelObject().getTLModelObj(),attr.getTLTypeObject());
}

Fixed version (ground truth):
private void assertAllLibrariesLoadedCorrectly(LibraryChainNode baseChain,LibraryChainNode extChain){
  mc.getLibraryController().remove(Collections.singletonList(baseChain));
  RepositoryItemNode nodeToRetrive=findRepositoryItem(extChain,getRepositoryForTest());
  mc.getLibraryController().remove(Collections.singletonList(extChain));
  Assert.assertEquals(0,uploadProject.getChildren().size());
  pc.add(uploadProject,nodeToRetrive.getItem());
  Assert.assertEquals(2,uploadProject.getChildren().size());
  LibraryChainNode lib=findLibrary(extLib.getName(),uploadProject.getChildren());
  VWA_Node vwaNode=(VWA_Node)lib.getDescendants_NamedTypes().get(0);
  AttributeNode attr=(AttributeNode)vwaNode.getAttributeFacet().getChildren().get(0);
  Assert.assertNotSame(ModelNode.getUnassignedNode(),attr.getTypeNode());
  Assert.assertSame(attr.getTypeNode().getModelObject().getTLModelObj(),attr.getTLTypeObject());
}
Program: 136443
Project: 136443
Buggy source:
public Record next() throws IOException {
  currentRowIndex++;
  if (currentRowIndex < csvHeadValue) {
    if (hasNext()) {
      return next();
    }
 else {
      return null;
    }
  }
  if (csvLimitValue != -1 && currentRowIndex > csvLimitValue - 1) {
    return null;
  }
  String[] values=csvReader.getValues();
  String[] analysedValues=new String[analysedColumnIndex.length];
  for (int i=0; i < analysedColumnIndex.length; i++) {
    analysedValues[i]=values[analysedColumnIndex[i]];
  }
  return createRichRecord(analysedValues);
}

Fixed version (ground truth):
public Record next() throws IOException {
  currentRowIndex++;
  if (currentRowIndex < csvHeadValue) {
    if (hasNext()) {
      return next();
    }
 else {
      return null;
    }
  }
  if (csvLimitValue != -1 && currentRowIndex > csvLimitValue - 1) {
    return null;
  }
  String[] values=csvReader.getValues();
  String[] analysedValues=new String[analysedColumnIndex.length];
  for (int i=0; i < analysedColumnIndex.length; i++) {
    if (values.length <= i) {
      analysedValues[i]=StringUtils.EMPTY;
    }
 else {
      analysedValues[i]=values[analysedColumnIndex[i]];
    }
  }
  return createRichRecord(analysedValues);
}
Program: 136444
Project: 136444
Buggy source:
@SuppressWarnings("String_Node_Str") private void handleReferenced(RepositoryNode parent){
  Project currentProject=((DQRepositoryNode)parent).getProject();
  if (parent.getType().equals(ENodeType.SYSTEM_FOLDER)) {
    for (    ProjectReference refProject : (List<ProjectReference>)currentProject.getEmfProject().getReferencedProjects()) {
      String parentBranch=ProjectManager.getInstance().getMainProjectBranch(currentProject);
      org.talend.core.model.properties.Project emfProject=refProject.getReferencedProject();
      if (emfProject.getUrl() != null && emfProject.getUrl().startsWith("String_Node_Str") || (refProject.getBranch() != null && refProject.getBranch().equals(parentBranch))) {
        DQRepositoryNode referencedProjectNode=new DQRepositoryNode(null,parent,ENodeType.REFERENCED_PROJECT,currentProject);
        referencedProjectNode.setProperties(EProperties.LABEL,emfProject.getLabel());
        referencedProjectNode.setProperties(EProperties.CONTENT_TYPE,ERepositoryObjectType.REFERENCED_PROJECTS);
        parent.getChildren().add(referencedProjectNode);
        try {
          Object[] createWorkspaceRootChildren=createWorkspaceRootChildren(ResourceManager.getRoot(),emfProject.getTechnicalLabel());
          referencedProjectNode.getChildren().addAll((Collection<? extends IRepositoryNode>)Arrays.asList(createWorkspaceRootChildren));
        }
 catch (        CoreException e) {
          log.error(e,e);
        }
      }
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void handleReferenced(RepositoryNode parent){
  Project currentProject=((DQRepositoryNode)parent).getProject();
  if (parent.getType().equals(ENodeType.SYSTEM_FOLDER)) {
    for (    ProjectReference refProject : currentProject.getProjectReferenceList()) {
      if (ProjectManager.validReferenceProject(currentProject.getEmfProject(),refProject)) {
        org.talend.core.model.properties.Project emfProject=refProject.getReferencedProject();
        DQRepositoryNode referencedProjectNode=new DQRepositoryNode(null,parent,ENodeType.REFERENCED_PROJECT,currentProject);
        referencedProjectNode.setProperties(EProperties.LABEL,emfProject.getLabel());
        referencedProjectNode.setProperties(EProperties.CONTENT_TYPE,ERepositoryObjectType.REFERENCED_PROJECTS);
        parent.getChildren().add(referencedProjectNode);
        try {
          Object[] createWorkspaceRootChildren=createWorkspaceRootChildren(ResourceManager.getRoot(),emfProject.getTechnicalLabel());
          referencedProjectNode.getChildren().addAll((Collection<? extends IRepositoryNode>)Arrays.asList(createWorkspaceRootChildren));
        }
 catch (        CoreException e) {
          log.error(e,e);
        }
      }
    }
  }
}
Program: 136446
Project: 136446
Buggy source:
@Override public int compare(Viewer iviewer,Object o1,Object o2){
  DQRepositoryNode recursiveFind=RepositoryNodeHelper.recursiveFind(((ItemRecord)o1).getElement());
  DQRepositoryNode recursiveFind2=RepositoryNodeHelper.recursiveFind(((ItemRecord)o2).getElement());
  return new RepositoryNodeComparator().compare(recursiveFind,recursiveFind2);
}

Fixed version (ground truth):
@Override public int compare(Viewer iviewer,Object o1,Object o2){
  DQRepositoryNode recursiveFind=RepositoryNodeHelper.recursiveFind(((ItemRecord)o1).getElement());
  DQRepositoryNode recursiveFind2=RepositoryNodeHelper.recursiveFind(((ItemRecord)o2).getElement());
  return repositoryNodeComparator.compare(recursiveFind,recursiveFind2);
}
Program: 136447
Project: 136447
Buggy source:
/** 
 * DOC bZhou Comment method "createRepositoryTree".
 * @param top
 */
protected void createRepositoryTree(Composite top){
  Composite treeComposite=new Composite(top,SWT.NONE);
  treeComposite.setLayout(new GridLayout(2,false));
  treeComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
  repositoryTree=new ContainerCheckedTreeViewer(treeComposite);
  repositoryTree.setContentProvider(new FileTreeContentProvider());
  repositoryTree.setLabelProvider(new FileTreeLabelProvider());
  repositoryTree.setInput(writer.computeInput(specifiedPath));
  repositoryTree.expandAll();
  repositoryTree.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
  if (intCheckedElements != null) {
    List<ItemRecord> selectedItemRecords=new ArrayList<ItemRecord>();
    for (    Object intCheckedElement : intCheckedElements) {
      getFileFromNode(selectedItemRecords,(IRepositoryNode)intCheckedElement);
    }
    repositoryTree.setCheckedElements(selectedItemRecords.toArray());
  }
  repositoryTree.setComparator(new ViewerComparator(){
    @Override public int compare(    Viewer iviewer,    Object o1,    Object o2){
      DQRepositoryNode recursiveFind=RepositoryNodeHelper.recursiveFind(((ItemRecord)o1).getElement());
      DQRepositoryNode recursiveFind2=RepositoryNodeHelper.recursiveFind(((ItemRecord)o2).getElement());
      return new RepositoryNodeComparator().compare(recursiveFind,recursiveFind2);
    }
  }
);
  createUtilityButtons(treeComposite);
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "createRepositoryTree".
 * @param top
 */
protected void createRepositoryTree(Composite top){
  Composite treeComposite=new Composite(top,SWT.NONE);
  treeComposite.setLayout(new GridLayout(2,false));
  treeComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
  repositoryTree=new ContainerCheckedTreeViewer(treeComposite);
  repositoryTree.setContentProvider(new FileTreeContentProvider());
  repositoryTree.setLabelProvider(new FileTreeLabelProvider());
  repositoryTree.setInput(writer.computeInput(specifiedPath));
  repositoryTree.expandAll();
  repositoryTree.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
  if (intCheckedElements != null) {
    List<ItemRecord> selectedItemRecords=new ArrayList<ItemRecord>();
    for (    Object intCheckedElement : intCheckedElements) {
      getFileFromNode(selectedItemRecords,(IRepositoryNode)intCheckedElement);
    }
    repositoryTree.setCheckedElements(selectedItemRecords.toArray());
  }
  final RepositoryNodeComparator repositoryNodeComparator=new RepositoryNodeComparator();
  repositoryTree.setComparator(new ViewerComparator(){
    @Override public int compare(    Viewer iviewer,    Object o1,    Object o2){
      DQRepositoryNode recursiveFind=RepositoryNodeHelper.recursiveFind(((ItemRecord)o1).getElement());
      DQRepositoryNode recursiveFind2=RepositoryNodeHelper.recursiveFind(((ItemRecord)o2).getElement());
      return repositoryNodeComparator.compare(recursiveFind,recursiveFind2);
    }
  }
);
  createUtilityButtons(treeComposite);
}
Program: 136449
Project: 136449
Buggy source:
private void removeInvalidDependency(ModelElement modelElement){
  EList<Dependency> clientDependencys=modelElement.getSupplierDependency();
  for (  Dependency dependency : clientDependencys) {
    EList<ModelElement> clients=dependency.getClient();
    Iterator<ModelElement> dependencyIterator=clients.iterator();
    while (dependencyIterator.hasNext()) {
      ModelElement client=dependencyIterator.next();
      if (client == null || client.eIsProxy()) {
        dependencyIterator.remove();
      }
    }
  }
  Resource modEResource=modelElement.eResource();
  if (!clientDependencys.isEmpty() && modEResource != null) {
    EMFSharedResources.getInstance().saveResource(modEResource);
  }
}

Fixed version (ground truth):
private void removeInvalidDependency(ModelElement modelElement){
  EList<Dependency> supplierDependencys=modelElement.getSupplierDependency();
  for (  Dependency dependency : supplierDependencys) {
    EList<ModelElement> clients=dependency.getClient();
    Iterator<ModelElement> dependencyIterator=clients.iterator();
    while (dependencyIterator.hasNext()) {
      ModelElement client=dependencyIterator.next();
      if (client == null || client.eIsProxy()) {
        dependencyIterator.remove();
      }
    }
  }
  Resource modEResource=modelElement.eResource();
  if (modEResource != null) {
    Iterator<EObject> iterator=modEResource.getContents().iterator();
    while (iterator.hasNext()) {
      EObject eObject=iterator.next();
      if (eObject instanceof Dependency && !supplierDependencys.contains(eObject)) {
        iterator.remove();
      }
    }
  }
  Iterator<Dependency> ClientDependencyIterator=modelElement.getClientDependency().iterator();
  while (ClientDependencyIterator.hasNext()) {
    Dependency dependency=ClientDependencyIterator.next();
    EList<ModelElement> suppliers=dependency.getSupplier();
    if (suppliers.isEmpty()) {
      ClientDependencyIterator.remove();
      continue;
    }
    Iterator<ModelElement> suppLiterator=suppliers.iterator();
    while (suppLiterator.hasNext()) {
      ModelElement supplier=suppLiterator.next();
      if (supplier == null || supplier.eIsProxy()) {
        suppLiterator.remove();
      }
    }
  }
  if (!supplierDependencys.isEmpty() && modEResource != null) {
    EMFSharedResources.getInstance().saveResource(modEResource);
  }
}
Program: 136452
Project: 136452
Buggy source:
@Override protected String getNonJavaIndicatorMessage(){
  String dialogMessage="String_Node_Str";
  if (isExistSqlExpr) {
    dialogMessage=DefaultMessagesImpl.getString("String_Node_Str");
  }
 else {
    DbmsLanguage dbmsLanguage=DbmsLanguageFactory.createDbmsLanguage(ColumnAnalysisDetailsPage.this.getCurrentModelElement(),ExecutionLanguage.SQL);
    dialogMessage=DefaultMessagesImpl.getString("String_Node_Str",dbmsLanguage.getDbmsName());
    ;
  }
  return dialogMessage;
}

Fixed version (ground truth):
@Override protected String getNonJavaIndicatorMessage(){
  DbmsLanguage dbmsLanguage=DbmsLanguageFactory.createDbmsLanguage(ColumnAnalysisDetailsPage.this.getCurrentModelElement(),ExecutionLanguage.SQL);
  return DefaultMessagesImpl.getString("String_Node_Str",dbmsLanguage.getDbmsName());
}
Program: 136453
Project: 136453
Buggy source:
/** 
 * Judge whether there are java indicator exist.
 * @return whether there are java indicator exist.
 */
@Override protected boolean includeJavaEngineIndicator(){
  for (  ModelElementIndicator modelElementIndicator : this.treeViewer.getModelElementIndicator()) {
    if (modelElementIndicator.containsAny(IndicatorEnum.getJavaIndicatorsEnum()) || (modelElementIndicator.contains(IndicatorEnum.UserDefinedIndicatorEnum) && searchJUDI(modelElementIndicator,true))) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Judge whether there are java indicator exist.
 * @return whether there are java indicator exist.
 */
@Override protected boolean includeJavaEngineIndicator(){
  for (  ModelElementIndicator modelElementIndicator : this.treeViewer.getModelElementIndicator()) {
    if (modelElementIndicator.containsAny(IndicatorEnum.getJavaIndicatorsEnum()) || (modelElementIndicator.contains(IndicatorEnum.UserDefinedIndicatorEnum) && checkUDIInvalid(modelElementIndicator,true))) {
      return true;
    }
  }
  return false;
}
Program: 136454
Project: 136454
Buggy source:
@Override protected boolean checkSqlEngineIndicatorExist(){
  for (  ModelElementIndicator modelElementIndicator : this.treeViewer.getModelElementIndicator()) {
    if (modelElementIndicator.contains(IndicatorEnum.SqlPatternMatchingIndicatorEnum) || (modelElementIndicator.contains(IndicatorEnum.UserDefinedIndicatorEnum) && searchJUDI(modelElementIndicator,false))) {
      return true;
    }
  }
  return super.checkSqlEngineIndicatorExist();
}

Fixed version (ground truth):
@Override protected boolean checkSqlEngineIndicatorExist(){
  for (  ModelElementIndicator modelElementIndicator : this.treeViewer.getModelElementIndicator()) {
    if (modelElementIndicator.contains(IndicatorEnum.SqlPatternMatchingIndicatorEnum) || (modelElementIndicator.contains(IndicatorEnum.UserDefinedIndicatorEnum) && checkUDIInvalid(modelElementIndicator,false))) {
      return true;
    }
  }
  return super.checkSqlEngineIndicatorExist();
}
Program: 136455
Project: 136455
Buggy source:
public List<Object[]> executeQuery(DataManager connection,List<ModelElement> analysedElements,String where) throws SQLException {
  getDataFromTable().clear();
  try {
    beginQuery();
  }
 catch (  Exception e1) {
    log.error(e1.getMessage(),e1);
    return getDataFromTable();
  }
  int columnListSize=analysedElements.size();
  TypedReturnCode<java.sql.Connection> sqlconnection=getSQLConnection(connection);
  Statement statement=null;
  ResultSet resultSet=null;
  try {
    statement=sqlconnection.getObject().createStatement();
    statement.execute(createSqlStatement(connection,analysedElements,where));
    resultSet=statement.getResultSet();
    while (resultSet.next()) {
      Object[] oneRow=new Object[columnListSize];
      for (int i=0; i < columnListSize; i++) {
        oneRow[i]=ResultSetUtils.getObject(resultSet,i + 1);
      }
      handleRow(oneRow);
    }
  }
 catch (  Exception e) {
    log.error(e,e);
    if (SQLException.class.isInstance(e)) {
      throw (SQLException)e;
    }
  }
 finally {
    if (resultSet != null) {
      resultSet.close();
    }
    if (statement != null) {
      statement.close();
    }
    ReturnCode closed=ConnectionUtils.closeConnection(sqlconnection.getObject());
    if (!closed.isOk()) {
      log.error(closed.getMessage());
    }
  }
  try {
    endQuery();
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
  }
  return getDataFromTable();
}

Fixed version (ground truth):
public List<Object[]> executeQuery(DataManager connection,List<ModelElement> analysedElements,String where) throws SQLException {
  getDataFromTable().clear();
  try {
    beginQuery();
  }
 catch (  Exception e1) {
    log.error(e1.getMessage(),e1);
    return getDataFromTable();
  }
  int columnListSize=analysedElements.size();
  TypedReturnCode<java.sql.Connection> sqlconnection=getSQLConnection(connection);
  Statement statement=null;
  ResultSet resultSet=null;
  try {
    statement=sqlconnection.getObject().createStatement();
    statement.execute(createSqlStatement(connection,analysedElements,where));
    resultSet=statement.getResultSet();
    while (resultSet.next()) {
      Object[] oneRow=new Object[columnListSize];
      for (int i=0; i < columnListSize; i++) {
        oneRow[i]=ResultSetUtils.getBigObject(resultSet,i + 1);
      }
      handleRow(oneRow);
    }
  }
 catch (  Exception e) {
    log.error(e,e);
    if (SQLException.class.isInstance(e)) {
      throw (SQLException)e;
    }
  }
 finally {
    if (resultSet != null) {
      resultSet.close();
    }
    if (statement != null) {
      statement.close();
    }
    ReturnCode closed=ConnectionUtils.closeConnection(sqlconnection.getObject());
    if (!closed.isOk()) {
      log.error(closed.getMessage());
    }
  }
  try {
    endQuery();
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
  }
  return getDataFromTable();
}
Program: 136457
Project: 136457
Buggy source:
/** 
 * orgnize EList 'objectLs' by SQL.
 * @param sqlStatement
 * @param ok
 * @return
 * @throws SQLException
 */
private ReturnCode evaluateBySql(String sqlStatement,ReturnCode ok) throws SQLException {
  Statement statement=null;
  ResultSet resultSet=null;
  try {
    statement=createStatement();
    if (continueRun()) {
      if (log.isInfoEnabled()) {
        log.info("String_Node_Str" + sqlStatement);
      }
      statement.execute(sqlStatement);
    }
    resultSet=statement.getResultSet();
    List<String> columnNames=getAnalyzedElementsName();
    if (resultSet == null) {
      String mess=Messages.getString("String_Node_Str",sqlStatement);
      log.warn(mess);
      ok.setReturnCode(mess,false);
      return ok;
    }
    EMap<Indicator,AnalyzedDataSet> indicToRowMap=analysis.getResults().getIndicToRowMap();
    indicToRowMap.clear();
    while (resultSet.next()) {
      if (!continueRun()) {
        break;
      }
      EList<Object> objectLs=new BasicEList<Object>();
      Iterator<String> it=columnNames.iterator();
      while (it.hasNext()) {
        Object obj=ResultSetUtils.getObject(resultSet,it.next());
        objectLs.add(obj);
      }
      if (objectLs.size() == 0) {
        continue;
      }
      handleObjects(objectLs,resultSet);
    }
  }
  finally {
    if (resultSet != null) {
      resultSet.close();
    }
    if (statement != null) {
      statement.close();
    }
    closeConnection();
  }
  return ok;
}

Fixed version (ground truth):
/** 
 * orgnize EList 'objectLs' by SQL.
 * @param sqlStatement
 * @param ok
 * @return
 * @throws SQLException
 */
private ReturnCode evaluateBySql(String sqlStatement,ReturnCode ok) throws SQLException {
  Statement statement=null;
  ResultSet resultSet=null;
  try {
    statement=createStatement();
    if (continueRun()) {
      if (log.isInfoEnabled()) {
        log.info("String_Node_Str" + sqlStatement);
      }
      statement.execute(sqlStatement);
    }
    resultSet=statement.getResultSet();
    List<String> columnNames=getAnalyzedElementsName();
    if (resultSet == null) {
      String mess=Messages.getString("String_Node_Str",sqlStatement);
      log.warn(mess);
      ok.setReturnCode(mess,false);
      return ok;
    }
    EMap<Indicator,AnalyzedDataSet> indicToRowMap=analysis.getResults().getIndicToRowMap();
    indicToRowMap.clear();
    while (resultSet.next()) {
      if (!continueRun()) {
        break;
      }
      EList<Object> objectLs=new BasicEList<Object>();
      Iterator<String> it=columnNames.iterator();
      while (it.hasNext()) {
        Object obj=ResultSetUtils.getBigObject(resultSet,it.next());
        objectLs.add(obj);
      }
      if (objectLs.size() == 0) {
        continue;
      }
      handleObjects(objectLs,resultSet);
    }
  }
  finally {
    if (resultSet != null) {
      resultSet.close();
    }
    if (statement != null) {
      statement.close();
    }
    closeConnection();
  }
  return ok;
}
Program: 136459
Project: 136459
Buggy source:
/** 
 * DOC xqliu Comment method "canParallel".
 * @return
 */
private boolean canParallel(Connection connection){
  try {
    @SuppressWarnings("String_Node_Str") DatabaseMetaData connectionMetadata=org.talend.utils.sql.ConnectionUtils.getConnectionMetadata(connection);
    if (connectionMetadata.getDriverName() != null && connectionMetadata.getDriverName().toLowerCase().startsWith(DatabaseConstant.ODBC_DRIVER_NAME)) {
      return false;
    }
    if ("String_Node_Str".equals(connection.getMetaData().getDatabaseProductName())) {
      return false;
    }
    if (ExtractMetaDataUtils.getInstance().isHiveConnection(connection)) {
      org.talend.core.model.metadata.builder.connection.Connection analysisDataProvider=getAnalysisDataProvider(cachedAnalysis);
      DatabaseConnection dbConn=((DatabaseConnection)analysisDataProvider);
      String hiveVersion=dbConn.getParameters().get(ConnParameterKeys.HIVE_SERVER_VERSION);
      if (HiveServerVersionInfo.HIVE_SERVER_1.getKey().equals(hiveVersion)) {
        return false;
      }
      return true;
    }
  }
 catch (  SQLException e) {
    log.warn(e,e);
  }
  return this.parallel;
}

Fixed version (ground truth):
/** 
 * DOC xqliu Comment method "canParallel".
 * @return
 */
private boolean canParallel(Connection connection){
  try {
    @SuppressWarnings("String_Node_Str") DatabaseMetaData connectionMetadata=org.talend.utils.sql.ConnectionUtils.getConnectionMetadata(connection);
    if (connectionMetadata.getDriverName() != null && connectionMetadata.getDriverName().toLowerCase().startsWith(DatabaseConstant.ODBC_DRIVER_NAME)) {
      return false;
    }
    if ("String_Node_Str".equals(connection.getMetaData().getDatabaseProductName())) {
      return false;
    }
    if (ExtractMetaDataUtils.getInstance().isHiveConnection(connection)) {
      org.talend.core.model.metadata.builder.connection.Connection analysisDataProvider=getAnalysisDataProvider(cachedAnalysis);
      DatabaseConnection dbConn=((DatabaseConnection)analysisDataProvider);
      String hiveVersion=dbConn.getParameters().get(ConnParameterKeys.HIVE_SERVER_VERSION);
      if (HiveServerVersionInfo.HIVE_SERVER_1.getKey().equals(hiveVersion)) {
        return false;
      }
      String jdbcProperties=dbConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_JDBC_PROPERTIES);
      List<Map<String,Object>> hiveJDBCPropertiesList=HadoopRepositoryUtil.getHadoopPropertiesList(jdbcProperties);
      if (!hiveJDBCPropertiesList.isEmpty()) {
        List keyList=new ArrayList();
        List valueList=new ArrayList();
        for (        Map<String,Object> propertyMap : hiveJDBCPropertiesList) {
          keyList.add(propertyMap.get("String_Node_Str"));
          valueList.add(propertyMap.get("String_Node_Str"));
        }
        if (keyList.contains("String_Node_Str") && valueList.contains("String_Node_Str")) {
          return false;
        }
      }
      return true;
    }
  }
 catch (  SQLException e) {
    log.warn(e,e);
  }
  return this.parallel;
}
Program: 136460
Project: 136460
Buggy source:
/** 
 * change ExecutionLanuage to Java.
 */
public void changeExecuteLanguageToJava(boolean isDisabled){
  if (this.execCombo == null) {
    return;
  }
  if (currentModelIsSqlEngin()) {
    int i=0;
    for (    ExecutionLanguage language : ExecutionLanguage.VALUES) {
      if (language.compareTo(ExecutionLanguage.JAVA) == 0 && this.execCombo.getSelectionIndex() != i) {
        this.execCombo.select(i);
        refreshEnginSection();
      }
 else {
        i++;
      }
    }
  }
  if (isDisabled) {
    execCombo.setEnabled(false);
  }
}

Fixed version (ground truth):
/** 
 * change ExecutionLanuage to Java.
 */
public void changeExecuteLanguageToJava(boolean isDisabled){
  if (this.execCombo == null) {
    return;
  }
  if (currentModelIsSqlEngine()) {
    int i=0;
    for (    ExecutionLanguage language : ExecutionLanguage.VALUES) {
      if (language.compareTo(ExecutionLanguage.JAVA) == 0 && this.execCombo.getSelectionIndex() != i) {
        this.execCombo.select(i);
        refreshEnginSection();
      }
 else {
        i++;
      }
    }
  }
  if (isDisabled) {
    execCombo.setEnabled(false);
  }
}
Program: 136461
Project: 136461
Buggy source:
/** 
 * DOC xqliu Comment method "changeExecuteLanguageToSql".
 * @param enabled
 */
public void changeExecuteLanguageToSql(boolean enabled){
  if (this.execCombo == null) {
    return;
  }
  if (!currentModelIsSqlEngin()) {
    int i=0;
    for (    ExecutionLanguage language : ExecutionLanguage.VALUES) {
      if (language.compareTo(ExecutionLanguage.SQL) == 0 && execCombo.getSelectionIndex() != i) {
        this.execCombo.select(i);
        refreshEnginSection();
      }
 else {
        i++;
      }
    }
  }
  execCombo.setEnabled(enabled);
}

Fixed version (ground truth):
/** 
 * DOC xqliu Comment method "changeExecuteLanguageToSql".
 * @param enabled
 */
public void changeExecuteLanguageToSql(boolean enabled){
  if (this.execCombo == null) {
    return;
  }
  if (!currentModelIsSqlEngine()) {
    int i=0;
    for (    ExecutionLanguage language : ExecutionLanguage.VALUES) {
      if (language.compareTo(ExecutionLanguage.SQL) == 0 && execCombo.getSelectionIndex() != i) {
        this.execCombo.select(i);
        refreshEnginSection();
      }
 else {
        i++;
      }
    }
  }
  execCombo.setEnabled(enabled);
}
Program: 136462
Project: 136462
Buggy source:
/** 
 * DOC zshen Comment method "createRunSampleDataButton".
 * @param buttonComposite
 */
protected void createRunSampleDataButton(Composite buttonComposite){
  runWithSampleBtn=toolkit.createButton(buttonComposite,DefaultMessagesImpl.getString("String_Node_Str"),SWT.CHECK);
  runWithSampleBtn.setToolTipText(DefaultMessagesImpl.getString("String_Node_Str"));
  runWithSampleBtn.setSelection(isRunWithSampleData);
  runWithSampleBtn.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      isRunWithSampleData=((Button)e.getSource()).getSelection();
      if (isRunWithSampleData && checkSqlEnginIndicatorExist()) {
        MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
        runWithSampleBtn.setSelection(!isRunWithSampleData);
        isRunWithSampleData=false;
        return;
      }
 else       if (includeJavaEnginIndicator()) {
        MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
        runWithSampleBtn.setSelection(!isRunWithSampleData);
        isRunWithSampleData=true;
        return;
      }
      doCheckOption();
      AbstractAnalysisMetadataPage.this.setDirty(true);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * DOC zshen Comment method "createRunSampleDataButton".
 * @param buttonComposite
 */
protected void createRunSampleDataButton(Composite buttonComposite){
  runWithSampleBtn=toolkit.createButton(buttonComposite,DefaultMessagesImpl.getString("String_Node_Str"),SWT.CHECK);
  runWithSampleBtn.setToolTipText(DefaultMessagesImpl.getString("String_Node_Str"));
  runWithSampleBtn.setSelection(isRunWithSampleData);
  runWithSampleBtn.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      Boolean isSqlSelected=TaggedValueHelper.getValueBoolean(TaggedValueHelper.IS_SQL_ENGIN_BEFORE_CHECK,getCurrentModelElement());
      isRunWithSampleData=((Button)e.getSource()).getSelection();
      if (isRunWithSampleData && checkSqlEngineIndicatorExist()) {
        MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
        runWithSampleBtn.setSelection(!isRunWithSampleData);
        isRunWithSampleData=false;
        return;
      }
 else       if (!isRunWithSampleData && isSqlSelected && includeJavaEngineIndicator()) {
        MessageUI.openWarning(getNonJavaIndicatorMessage());
        runWithSampleBtn.setSelection(!isRunWithSampleData);
        isRunWithSampleData=true;
        return;
      }
      doCheckOption();
      AbstractAnalysisMetadataPage.this.setDirty(true);
    }
  }
);
}
Program: 136463
Project: 136463
Buggy source:
@Override public void widgetSelected(SelectionEvent e){
  isRunWithSampleData=((Button)e.getSource()).getSelection();
  if (isRunWithSampleData && checkSqlEnginIndicatorExist()) {
    MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
    runWithSampleBtn.setSelection(!isRunWithSampleData);
    isRunWithSampleData=false;
    return;
  }
 else   if (includeJavaEnginIndicator()) {
    MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
    runWithSampleBtn.setSelection(!isRunWithSampleData);
    isRunWithSampleData=true;
    return;
  }
  doCheckOption();
  AbstractAnalysisMetadataPage.this.setDirty(true);
}

Fixed version (ground truth):
@Override public void widgetSelected(SelectionEvent e){
  Boolean isSqlSelected=TaggedValueHelper.getValueBoolean(TaggedValueHelper.IS_SQL_ENGIN_BEFORE_CHECK,getCurrentModelElement());
  isRunWithSampleData=((Button)e.getSource()).getSelection();
  if (isRunWithSampleData && checkSqlEngineIndicatorExist()) {
    MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
    runWithSampleBtn.setSelection(!isRunWithSampleData);
    isRunWithSampleData=false;
    return;
  }
 else   if (!isRunWithSampleData && isSqlSelected && includeJavaEngineIndicator()) {
    MessageUI.openWarning(getNonJavaIndicatorMessage());
    runWithSampleBtn.setSelection(!isRunWithSampleData);
    isRunWithSampleData=true;
    return;
  }
  doCheckOption();
  AbstractAnalysisMetadataPage.this.setDirty(true);
}
Program: 136464
Project: 136464
Buggy source:
@Override public void widgetSelected(SelectionEvent e){
  execLang=execCombo1.getText();
  ExecutionLanguage currentLanguage=ExecutionLanguage.get(execLang);
  if (ExecutionLanguage.SQL.equals(currentLanguage) && includeJavaEnginIndicator()) {
    MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
    changeExecuteLanguageToJava(false);
    execLang=execCombo1.getText();
    return;
  }
 else   if (ExecutionLanguage.JAVA.equals(currentLanguage) && checkSqlEnginIndicatorExist()) {
    if (isRunWithSampleData) {
      MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
    }
 else {
      MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
    }
    changeExecuteLanguageToSql(true);
    execLang=execCombo1.getText();
    return;
  }
  refreshEnginSection(javaEnginSection,currentLanguage);
}

Fixed version (ground truth):
@Override public void widgetSelected(SelectionEvent e){
  execLang=execCombo1.getText();
  ExecutionLanguage currentLanguage=ExecutionLanguage.get(execLang);
  if (ExecutionLanguage.SQL.equals(currentLanguage) && includeJavaEngineIndicator()) {
    MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
    changeExecuteLanguageToJava(false);
    execLang=execCombo1.getText();
    return;
  }
 else   if (ExecutionLanguage.JAVA.equals(currentLanguage) && checkSqlEngineIndicatorExist()) {
    if (isRunWithSampleData) {
      MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
    }
 else {
      MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
    }
    changeExecuteLanguageToSql(true);
    execLang=execCombo1.getText();
    return;
  }
  refreshEnginSection(javaEnginSection,currentLanguage);
}
Program: 136465
Project: 136465
Buggy source:
private void addListenerToExecuteEngine(final CCombo execCombo1,final Composite javaEnginSection){
  execCombo1.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      execLang=execCombo1.getText();
      ExecutionLanguage currentLanguage=ExecutionLanguage.get(execLang);
      if (ExecutionLanguage.SQL.equals(currentLanguage) && includeJavaEnginIndicator()) {
        MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
        changeExecuteLanguageToJava(false);
        execLang=execCombo1.getText();
        return;
      }
 else       if (ExecutionLanguage.JAVA.equals(currentLanguage) && checkSqlEnginIndicatorExist()) {
        if (isRunWithSampleData) {
          MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
        }
 else {
          MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
        }
        changeExecuteLanguageToSql(true);
        execLang=execCombo1.getText();
        return;
      }
      refreshEnginSection(javaEnginSection,currentLanguage);
    }
  }
);
}

Fixed version (ground truth):
private void addListenerToExecuteEngine(final CCombo execCombo1,final Composite javaEnginSection){
  execCombo1.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      execLang=execCombo1.getText();
      ExecutionLanguage currentLanguage=ExecutionLanguage.get(execLang);
      if (ExecutionLanguage.SQL.equals(currentLanguage) && includeJavaEngineIndicator()) {
        MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
        changeExecuteLanguageToJava(false);
        execLang=execCombo1.getText();
        return;
      }
 else       if (ExecutionLanguage.JAVA.equals(currentLanguage) && checkSqlEngineIndicatorExist()) {
        if (isRunWithSampleData) {
          MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
        }
 else {
          MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
        }
        changeExecuteLanguageToSql(true);
        execLang=execCombo1.getText();
        return;
      }
      refreshEnginSection(javaEnginSection,currentLanguage);
    }
  }
);
}
Program: 136466
Project: 136466
Buggy source:
@Override protected void doCheckOption(){
  Boolean isSqlSelected=TaggedValueHelper.getValueBoolean(TaggedValueHelper.IS_SQL_ENGIN_BEFORE_CHECK,getCurrentModelElement());
  if (isRunWithSampleData) {
    if (currentModelIsSqlEngin()) {
      changeExecuteLanguageToJava(false);
      if (!isSqlSelected) {
        TaggedValueHelper.setTaggedValue(getCurrentModelElement(),TaggedValueHelper.IS_SQL_ENGIN_BEFORE_CHECK,"String_Node_Str");
      }
    }
    execCombo.setEnabled(false);
  }
 else {
    if (isSqlSelected) {
      changeExecuteLanguageToSql(true);
      if (!isRunWithSampleData) {
        TaggedValueHelper.setTaggedValue(getCurrentModelElement(),TaggedValueHelper.IS_SQL_ENGIN_BEFORE_CHECK,"String_Node_Str");
      }
    }
    if (!isFileConnection()) {
      execCombo.setEnabled(true);
    }
  }
}

Fixed version (ground truth):
@Override protected void doCheckOption(){
  Boolean isSqlSelected=TaggedValueHelper.getValueBoolean(TaggedValueHelper.IS_SQL_ENGIN_BEFORE_CHECK,getCurrentModelElement());
  if (isRunWithSampleData) {
    if (currentModelIsSqlEngine()) {
      changeExecuteLanguageToJava(false);
      if (!isSqlSelected) {
        TaggedValueHelper.setTaggedValue(getCurrentModelElement(),TaggedValueHelper.IS_SQL_ENGIN_BEFORE_CHECK,"String_Node_Str");
      }
    }
    execCombo.setEnabled(false);
  }
 else {
    if (isSqlSelected) {
      changeExecuteLanguageToSql(true);
      if (!isRunWithSampleData) {
        TaggedValueHelper.setTaggedValue(getCurrentModelElement(),TaggedValueHelper.IS_SQL_ENGIN_BEFORE_CHECK,"String_Node_Str");
      }
    }
    if (!isFileConnection()) {
      execCombo.setEnabled(true);
    }
  }
}
Program: 136467
Project: 136467
Buggy source:
@Override protected void doCheckOption(){
  Boolean isSqlSelected=TaggedValueHelper.getValueBoolean(TaggedValueHelper.IS_SQL_ENGIN_BEFORE_CHECK,getCurrentModelElement());
  if (isRunWithSampleData) {
    if (currentModelIsSqlEngin()) {
      changeExecuteLanguageToJava(false);
      if (!isSqlSelected) {
        TaggedValueHelper.setTaggedValue(getCurrentModelElement(),TaggedValueHelper.IS_SQL_ENGIN_BEFORE_CHECK,"String_Node_Str");
      }
    }
    execCombo.setEnabled(false);
  }
 else {
    if (isSqlSelected) {
      changeExecuteLanguageToSql(true);
      if (!isRunWithSampleData) {
        TaggedValueHelper.setTaggedValue(getCurrentModelElement(),TaggedValueHelper.IS_SQL_ENGIN_BEFORE_CHECK,"String_Node_Str");
      }
    }
    if (!isFileConnection()) {
      execCombo.setEnabled(true);
    }
  }
}

Fixed version (ground truth):
@Override protected void doCheckOption(){
  Boolean isSqlSelected=TaggedValueHelper.getValueBoolean(TaggedValueHelper.IS_SQL_ENGIN_BEFORE_CHECK,getCurrentModelElement());
  if (isRunWithSampleData) {
    if (currentModelIsSqlEngine()) {
      changeExecuteLanguageToJava(false);
      if (!isSqlSelected) {
        TaggedValueHelper.setTaggedValue(getCurrentModelElement(),TaggedValueHelper.IS_SQL_ENGIN_BEFORE_CHECK,"String_Node_Str");
      }
    }
    execCombo.setEnabled(false);
  }
 else {
    if (isSqlSelected) {
      changeExecuteLanguageToSql(true);
      if (!isRunWithSampleData) {
        TaggedValueHelper.setTaggedValue(getCurrentModelElement(),TaggedValueHelper.IS_SQL_ENGIN_BEFORE_CHECK,"String_Node_Str");
      }
    }
    if (!isFileConnection()) {
      execCombo.setEnabled(true);
    }
  }
}
Program: 136468
Project: 136468
Buggy source:
@Override protected void eBasicSetContainer(InternalEObject newContainer,int newContainerFeatureID){
  super.eBasicSetContainer(newContainer,newContainerFeatureID);
  if (this.hasSet == false && newContainer instanceof FrequencyIndicator) {
    if (newContainer instanceof LowFrequencyIndicator) {
      this.setTopN(IndicatorDefaultValueServiceUtil.getIstance().getIndicatorDVService().getLowFrequencyLimitResult());
    }
 else {
      this.setTopN(IndicatorDefaultValueServiceUtil.getIstance().getIndicatorDVService().getFrequencyLimitResult());
    }
  }
}

Fixed version (ground truth):
@Override protected void eBasicSetContainer(InternalEObject newContainer,int newContainerFeatureID){
  super.eBasicSetContainer(newContainer,newContainerFeatureID);
  if (this.hasSet == false && newContainer instanceof FrequencyIndicator) {
    if (Platform.isRunning()) {
      if (newContainer instanceof LowFrequencyIndicator) {
        this.setTopN(IndicatorDefaultValueServiceUtil.getIstance().getIndicatorDVService().getLowFrequencyLimitResult());
      }
 else {
        this.setTopN(IndicatorDefaultValueServiceUtil.getIstance().getIndicatorDVService().getFrequencyLimitResult());
      }
    }
  }
}
Program: 136469
Project: 136469
Buggy source:
public IIndicatorDefaultValueService getIndicatorDVService(){
  if (indicatorDV == null) {
    BundleContext context=DataQualityPlugin.getDefault().getBundleContext();
    if (context != null) {
      ServiceReference serviceReference=context.getServiceReference(IIndicatorDefaultValueService.class.getName());
      if (serviceReference != null) {
        Object obj=context.getService(serviceReference);
        if (obj != null) {
          this.indicatorDV=(IIndicatorDefaultValueService)obj;
        }
      }
    }
  }
  return this.indicatorDV;
}

Fixed version (ground truth):
public IIndicatorDefaultValueService getIndicatorDVService(){
  DataQualityPlugin defaultDQPlugin=DataQualityPlugin.getDefault();
  if (indicatorDV == null && defaultDQPlugin != null) {
    BundleContext context=defaultDQPlugin.getBundleContext();
    if (context != null) {
      ServiceReference serviceReference=context.getServiceReference(IIndicatorDefaultValueService.class.getName());
      if (serviceReference != null) {
        Object obj=context.getService(serviceReference);
        if (obj != null) {
          this.indicatorDV=(IIndicatorDefaultValueService)obj;
        }
      }
    }
  }
  return this.indicatorDV;
}
Program: 136470
Project: 136470
Buggy source:
@Override public List<IRepositoryNode> getChildren(){
  afterGlobalFilter=new ArrayList<IRepositoryNode>();
  DatabaseConnection databaseConnection=getDatabaseConnection();
  EList<Package> dataPackage=databaseConnection.getDataPackage();
  if (dataPackage != null && dataPackage.size() > 0) {
    Package pack=dataPackage.get(0);
    String filterCharater=ConnectionHelper.getPackageFilter(databaseConnection);
    List<IRepositoryNode> afterPackageFilter=null;
    if (pack instanceof Schema) {
      afterGlobalFilter=filterResultsIfAny(createRepositoryNodeSchema(dataPackage));
      afterPackageFilter=filterPackages(filterCharater,afterGlobalFilter);
      return afterPackageFilter == null ? afterGlobalFilter : afterPackageFilter;
    }
 else     if (pack instanceof Catalog) {
      afterGlobalFilter=filterResultsIfAny(createRepositoryNodeCatalog(dataPackage));
      afterPackageFilter=filterPackages(filterCharater,afterGlobalFilter);
      return afterPackageFilter == null ? afterGlobalFilter : afterPackageFilter;
    }
  }
  return new ArrayList<IRepositoryNode>();
}

Fixed version (ground truth):
@Override public List<IRepositoryNode> getChildren(){
  afterGlobalFilter=new ArrayList<IRepositoryNode>();
  DatabaseConnection databaseConnection=getDatabaseConnection();
  if (databaseConnection != null) {
    EList<Package> dataPackage=databaseConnection.getDataPackage();
    if (dataPackage != null && dataPackage.size() > 0) {
      Package pack=dataPackage.get(0);
      String filterCharater=ConnectionHelper.getPackageFilter(databaseConnection);
      List<IRepositoryNode> afterPackageFilter=null;
      if (pack instanceof Schema) {
        afterGlobalFilter=filterResultsIfAny(createRepositoryNodeSchema(dataPackage));
        afterPackageFilter=filterPackages(filterCharater,afterGlobalFilter);
        return afterPackageFilter == null ? afterGlobalFilter : afterPackageFilter;
      }
 else       if (pack instanceof Catalog) {
        afterGlobalFilter=filterResultsIfAny(createRepositoryNodeCatalog(dataPackage));
        afterPackageFilter=filterPackages(filterCharater,afterGlobalFilter);
        return afterPackageFilter == null ? afterGlobalFilter : afterPackageFilter;
      }
    }
  }
  return new ArrayList<IRepositoryNode>();
}
Program: 136471
Project: 136471
Buggy source:
public DatabaseConnection getDatabaseConnection(){
  Property property=this.getObject().getProperty();
  if (property != null && property.getItem() != null) {
    return (DatabaseConnection)((ConnectionItem)property.getItem()).getConnection();
  }
  return null;
}

Fixed version (ground truth):
public DatabaseConnection getDatabaseConnection(){
  Property property=this.getObject().getProperty();
  if (property != null && property.getItem() != null && ((ConnectionItem)property.getItem()).getConnection() instanceof DatabaseConnection) {
    return (DatabaseConnection)((ConnectionItem)property.getItem()).getConnection();
  }
  return null;
}