nus-yam/ex-repair huggingface dataset:
Program: 139340
Project: 139340
Buggy source:
@Override protected ReturnCode executeSqlQuery(String sqlStatement) throws SQLException {
  ReturnCode ok=new ReturnCode(true);
  DataProvider dataProvider=this.getDataManager();
  if (this.elementToIndicators.values().isEmpty()) {
    String msg="String_Node_Str";
    log.error(msg);
    ok.setReturnCode(msg,false);
    return ok;
  }
  Indicator[] indics=this.getAllIndicators();
  if (indics.length == 0) {
    String msg="String_Node_Str" + dataProvider;
    log.error(msg);
    ok.setReturnCode(msg,false);
    return ok;
  }
  for (  Indicator indicator : indics) {
    SchemaIndicator schemaIndicator=DataqualitySwitchHelper.SCHEMA_SWITCH.doSwitch(indicator);
    if (schemaIndicator == null) {
      continue;
    }
    TdSchema schema=(TdSchema)schemaIndicator.getAnalyzedElement();
    String catName=schema.getName();
    TdCatalog catalog=SwitchHelpers.CATALOG_SWITCH.doSwitch(schema.eContainer());
    if (catalog != null) {
      catName=catalog.getName();
    }
    if (!checkSchema(catName)) {
      ok.setReturnCode(Messages.getString("String_Node_Str",catName),false);
      return ok;
    }
    connection.setCatalog(catName);
    evalSchemaIndicLow(null,schemaIndicator,null,schema,ok);
  }
  return ok;
}

Fixed version (ground truth):
@Override protected ReturnCode executeSqlQuery(String sqlStatement) throws SQLException {
  ReturnCode ok=new ReturnCode(true);
  DataProvider dataProvider=this.getDataManager();
  if (this.elementToIndicators.values().isEmpty()) {
    String msg="String_Node_Str";
    log.error(msg);
    ok.setReturnCode(msg,false);
    return ok;
  }
  Indicator[] indics=this.getAllIndicators();
  if (indics.length == 0) {
    String msg="String_Node_Str" + dataProvider;
    log.error(msg);
    ok.setReturnCode(msg,false);
    return ok;
  }
  for (  Indicator indicator : indics) {
    SchemaIndicator schemaIndicator=DataqualitySwitchHelper.SCHEMA_SWITCH.doSwitch(indicator);
    if (schemaIndicator == null) {
      continue;
    }
    TdSchema schema=(TdSchema)schemaIndicator.getAnalyzedElement();
    String catName=schema.getName();
    if (!checkSchema(schema)) {
      ok.setReturnCode(Messages.getString("String_Node_Str",catName),false);
      return ok;
    }
    TdCatalog catalog=SwitchHelpers.CATALOG_SWITCH.doSwitch(schema.eContainer());
    if (catalog != null) {
      catName=catalog.getName();
    }
    connection.setCatalog(catName);
    evalSchemaIndicLow(null,schemaIndicator,null,schema,ok);
  }
  return ok;
}
Program: 139342
Project: 139342
Buggy source:
@Override public void fillContextMenu(IMenuManager menu){
  TreeSelection treeSelection=((TreeSelection)this.getContext().getSelection());
  List<IFile> selectedFiles=new ArrayList<IFile>();
  if (treeSelection.size() == 1) {
    Object obj=treeSelection.getFirstElement();
    if (obj instanceof IFolder) {
      try {
        IFolder folder=(IFolder)obj;
        if (ResourceManager.isRulesSQLFolder(folder)) {
          menu.add(new CreateDQRulesAction(folder));
        }
      }
 catch (      Exception e) {
        log.error(e,e);
      }
    }
  }
  boolean isSelectFile=computeSelectedFiles(treeSelection,selectedFiles);
  if (!isSelectFile && !selectedFiles.isEmpty()) {
    menu.add(new DeleteDQRuleAction(selectedFiles));
  }
}

Fixed version (ground truth):
@Override public void fillContextMenu(IMenuManager menu){
  TreeSelection treeSelection=((TreeSelection)this.getContext().getSelection());
  List<IFile> selectedFiles=new ArrayList<IFile>();
  if (treeSelection.size() == 1) {
    Object obj=treeSelection.getFirstElement();
    if (obj instanceof IFolder) {
      try {
        IFolder folder=(IFolder)obj;
        if (ResourceService.isSubFolder(ResourceManager.getRulesSQLFolder(),folder)) {
          menu.add(new CreateDQRulesAction(folder));
        }
      }
 catch (      Exception e) {
        log.error(e,e);
      }
    }
  }
  boolean isSelectFile=computeSelectedFiles(treeSelection,selectedFiles);
  if (!isSelectFile && !selectedFiles.isEmpty()) {
    menu.add(new DeleteDQRuleAction(selectedFiles));
  }
}
Program: 139343
Project: 139343
Buggy source:
/** 
 * Adds a submenu to the given menu with the name "New Component".
 */
public void fillContextMenu(IMenuManager menu){
  Object obj=((TreeSelection)this.getContext().getSelection()).getFirstElement();
  if (obj instanceof IFolder) {
    IFolder folder=(IFolder)obj;
    if (ResourceManager.isAnalysisFolder(folder)) {
      CreateNewAnalysisAction createAnalysisAction=new CreateNewAnalysisAction(folder);
      menu.add(createAnalysisAction);
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds a submenu to the given menu with the name "New Component".
 */
public void fillContextMenu(IMenuManager menu){
  Object obj=((TreeSelection)this.getContext().getSelection()).getFirstElement();
  if (obj instanceof IFolder) {
    IFolder folder=(IFolder)obj;
    if (ResourceService.isSubFolder(ResourceManager.getAnalysisFolder(),folder)) {
      CreateNewAnalysisAction createAnalysisAction=new CreateNewAnalysisAction(folder);
      menu.add(createAnalysisAction);
    }
  }
}
Program: 139344
Project: 139344
Buggy source:
/** 
 * Adds a submenu to the given menu with the name "New Component".
 */
public void fillContextMenu(IMenuManager menu){
  Object obj=((TreeSelection)this.getContext().getSelection()).getFirstElement();
  if (obj instanceof IFolder) {
    IFolder folder=(IFolder)obj;
    if (ResourceManager.isConnectionFolder(folder) || ResourceManager.isMdmConnectionFolder(folder)) {
      CreateConnectionAction createConnectionAction=new CreateConnectionAction(folder);
      menu.add(createConnectionAction);
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds a submenu to the given menu with the name "New Component".
 */
public void fillContextMenu(IMenuManager menu){
  Object obj=((TreeSelection)this.getContext().getSelection()).getFirstElement();
  if (obj instanceof IFolder) {
    IFolder folder=(IFolder)obj;
    if (ResourceService.isSubFolder(ResourceManager.getConnectionFolder(),folder) || ResourceService.isSubFolder(ResourceManager.getMDMConnectionFolder(),folder)) {
      CreateConnectionAction createConnectionAction=new CreateConnectionAction(folder);
      menu.add(createConnectionAction);
    }
  }
}
Program: 139345
Project: 139345
Buggy source:
public void fillContextMenu(IMenuManager menu){
  TreeSelection treeSelection=((TreeSelection)this.getContext().getSelection());
  List<IFile> selectedFiles=new ArrayList<IFile>();
  if (treeSelection.size() == 1) {
    Object obj=treeSelection.getFirstElement();
    if (obj instanceof IFolder) {
      IPath fullPath=((IFolder)obj).getFullPath();
      IPath sourceFileFolderPath=ResourceManager.getSourceFileFolder().getFullPath();
      if (fullPath.equals(sourceFileFolderPath)) {
        menu.add(new AddSqlFileAction((IFolder)obj));
        if (fullPath.segmentCount() > sourceFileFolderPath.segmentCount()) {
          menu.add(new RenameFolderAction((IFolder)obj));
        }
      }
    }
 else     if (obj instanceof IFile) {
      IFile file=(IFile)obj;
      if ("String_Node_Str".equalsIgnoreCase(file.getFileExtension())) {
        menu.add(new RenameSqlFileAction((IFile)obj));
      }
    }
  }
  boolean isSelectFile=computeSelectedFiles(treeSelection,selectedFiles);
  if (!isSelectFile && !selectedFiles.isEmpty()) {
    menu.add(new OpenSqlFileAction(selectedFiles));
    menu.add(new DeleteSqlFileAction(selectedFiles));
  }
}

Fixed version (ground truth):
public void fillContextMenu(IMenuManager menu){
  TreeSelection treeSelection=((TreeSelection)this.getContext().getSelection());
  List<IFile> selectedFiles=new ArrayList<IFile>();
  if (treeSelection.size() == 1) {
    Object obj=treeSelection.getFirstElement();
    if (obj instanceof IFolder) {
      IFolder folder=(IFolder)obj;
      IFolder sourceFolder=ResourceManager.getSourceFileFolder();
      if (ResourceService.isSubFolder(sourceFolder,folder)) {
        menu.add(new AddSqlFileAction((IFolder)obj));
        if (folder.getFullPath().segmentCount() > sourceFolder.getFullPath().segmentCount()) {
          menu.add(new RenameFolderAction((IFolder)obj));
        }
      }
    }
 else     if (obj instanceof IFile) {
      IFile file=(IFile)obj;
      if ("String_Node_Str".equalsIgnoreCase(file.getFileExtension())) {
        menu.add(new RenameSqlFileAction((IFile)obj));
      }
    }
  }
  boolean isSelectFile=computeSelectedFiles(treeSelection,selectedFiles);
  if (!isSelectFile && !selectedFiles.isEmpty()) {
    menu.add(new OpenSqlFileAction(selectedFiles));
    menu.add(new DeleteSqlFileAction(selectedFiles));
  }
}
Program: 139346
Project: 139346
Buggy source:
public void fillContextMenu(IMenuManager menu){
  TreeSelection treeSelection=((TreeSelection)this.getContext().getSelection());
  List<IFile> selectedFiles=new ArrayList<IFile>();
  if (treeSelection.size() == 1) {
    Object obj=treeSelection.getFirstElement();
    if (obj instanceof IFolder) {
      try {
        IFolder folder=(IFolder)obj;
        ExpressionType type=null;
        if (ResourceManager.isPatternRegex(folder)) {
          type=ExpressionType.REGEXP;
        }
 else         if (ResourceManager.isPatternSQLFolder(folder)) {
          type=ExpressionType.SQL_LIKE;
        }
        if (type != null) {
          menu.add(new CreatePatternAction((IFolder)obj,type));
          menu.add(new ImportPatternsAction((IFolder)obj,type));
          menu.add(new ExportPatternsAction((IFolder)obj,false));
          menu.add(new ExportPatternsAction((IFolder)obj,true));
        }
      }
 catch (      Exception e) {
        log.error(e,e);
      }
    }
 else     if (obj instanceof IFile) {
      IFile file=(IFile)obj;
      if (EXTENSION_PATTERN.equalsIgnoreCase(file.getFileExtension())) {
      }
    }
  }
  boolean isSelectFile=computeSelectedFiles(treeSelection,selectedFiles);
  if (!isSelectFile && !selectedFiles.isEmpty()) {
  }
}

Fixed version (ground truth):
public void fillContextMenu(IMenuManager menu){
  TreeSelection treeSelection=((TreeSelection)this.getContext().getSelection());
  List<IFile> selectedFiles=new ArrayList<IFile>();
  if (treeSelection.size() == 1) {
    Object obj=treeSelection.getFirstElement();
    if (obj instanceof IFolder) {
      try {
        IFolder folder=(IFolder)obj;
        ExpressionType type=null;
        if (ResourceService.isSubFolder(ResourceManager.getPatternRegexFolder(),folder)) {
          type=ExpressionType.REGEXP;
        }
 else         if (ResourceService.isSubFolder(ResourceManager.getPatternSQLFolder(),folder)) {
          type=ExpressionType.SQL_LIKE;
        }
        if (type != null) {
          menu.add(new CreatePatternAction((IFolder)obj,type));
          menu.add(new ImportPatternsAction((IFolder)obj,type));
          menu.add(new ExportPatternsAction((IFolder)obj,false));
          menu.add(new ExportPatternsAction((IFolder)obj,true));
        }
      }
 catch (      Exception e) {
        log.error(e,e);
      }
    }
 else     if (obj instanceof IFile) {
      IFile file=(IFile)obj;
      if (EXTENSION_PATTERN.equalsIgnoreCase(file.getFileExtension())) {
      }
    }
  }
  boolean isSelectFile=computeSelectedFiles(treeSelection,selectedFiles);
  if (!isSelectFile && !selectedFiles.isEmpty()) {
  }
}
Program: 139347
Project: 139347
Buggy source:
@Override public void fillContextMenu(IMenuManager menu){
  TreeSelection treeSelection=((TreeSelection)this.getContext().getSelection());
  if (treeSelection.size() == 1) {
    Object obj=treeSelection.getFirstElement();
    if (obj instanceof IFolder) {
      try {
        IFolder folder=(IFolder)obj;
        if (ResourceManager.isUDIFolder(folder)) {
          menu.add(new CreateUDIAction(folder));
          menu.add(new ImportUDIAction(folder));
          menu.add(new ExportUDIAction(folder,false));
          menu.add(new ExportUDIAction(folder,true));
        }
      }
 catch (      Exception e) {
        log.error(e,e);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void fillContextMenu(IMenuManager menu){
  TreeSelection treeSelection=((TreeSelection)this.getContext().getSelection());
  if (treeSelection.size() == 1) {
    Object obj=treeSelection.getFirstElement();
    if (obj instanceof IFolder) {
      try {
        IFolder folder=(IFolder)obj;
        if (ResourceService.isSubFolder(ResourceManager.getUDIFolder(),folder)) {
          menu.add(new CreateUDIAction(folder));
          menu.add(new ImportUDIAction(folder));
          menu.add(new ExportUDIAction(folder,false));
          menu.add(new ExportUDIAction(folder,true));
        }
      }
 catch (      Exception e) {
        log.error(e,e);
      }
    }
  }
}
Program: 139349
Project: 139349
Buggy source:
protected String[] getDefinedRange(String inString){
  boolean flag=inString.indexOf('%') > 0;
  String[] threshold=IndicatorHelper.getDataThreshold(indicator);
  if (threshold == null) {
    if (flag) {
      threshold=IndicatorHelper.getIndicatorThresholdInPercent(indicator);
    }
 else {
      threshold=IndicatorHelper.getIndicatorThreshold(indicator);
    }
  }
  return threshold;
}

Fixed version (ground truth):
protected String[] getDefinedRange(String inString){
  isPercent=inString.indexOf('%') > 0;
  String[] threshold=IndicatorHelper.getDataThreshold(indicator);
  if (threshold == null) {
    if (isPercent) {
      threshold=IndicatorHelper.getIndicatorThresholdInPercent(indicator);
    }
 else {
      threshold=IndicatorHelper.getIndicatorThreshold(indicator);
    }
  }
  return threshold;
}
Program: 139350
Project: 139350
Buggy source:
public ICustomerDataset getCustomerDataset(){
  CustomerDefaultCategoryDataset customerdataset=new CustomerDefaultCategoryDataset();
  for (  TableIndicatorUnit unit : units) {
    String columnKey=unit.getIndicatorName();
    double value=Double.parseDouble(unit.getValue().toString());
    customerdataset.addValue(getRowCount() - value,ROW_KEY_NOT_PASS,columnKey);
    customerdataset.addValue(value,ROW_KEY_PASS,columnKey);
    WhereRuleChartDataEntity entity=new WhereRuleChartDataEntity();
    entity.setRowCount(getRowCount());
    entity.setIndicator(unit.getIndicator());
    entity.setLabel(columnKey);
    entity.setNumMatch(String.valueOf(value));
    entity.setNumNoMatch(String.valueOf(getRowCount() - value));
    customerdataset.addDataEntity(entity);
  }
  return customerdataset;
}

Fixed version (ground truth):
public ICustomerDataset getCustomerDataset(){
  CustomerDefaultCategoryDataset customerdataset=new CustomerDefaultCategoryDataset();
  for (  TableIndicatorUnit unit : units) {
    String columnKey=unit.getIndicatorName();
    double value=Double.parseDouble(unit.getValue().toString());
    customerdataset.addValue(getRowCount() - value,ROW_KEY_NOT_PASS,columnKey);
    customerdataset.addValue(value,ROW_KEY_PASS,columnKey);
    WhereRuleChartDataEntity entity=new WhereRuleChartDataEntity();
    entity.setIndicator(unit.getIndicator());
    entity.setLabel(columnKey);
    entity.setNumMatch(String.valueOf(value));
    entity.setNumNoMatch(String.valueOf(getRowCount() - value));
    customerdataset.addDataEntity(entity);
  }
  return customerdataset;
}
Program: 139351
Project: 139351
Buggy source:
@Override protected void initialize(){
  String[] indicatorThreshold=IndicatorHelper.getIndicatorThreshold(parameters);
  if (indicatorThreshold != null) {
    lowerText.setText(indicatorThreshold[0]);
    higherText.setText(indicatorThreshold[1]);
  }
  String[] indicatorPersentThreshold=IndicatorHelper.getIndicatorThresholdInPercent(parameters);
  if (indicatorPersentThreshold != null && isContainRowCount) {
    pLowerText.setText(indicatorPersentThreshold[0]);
    pHigherText.setText(indicatorPersentThreshold[1]);
  }
}

Fixed version (ground truth):
@Override protected void initialize(){
  String[] indicatorThreshold=IndicatorHelper.getIndicatorThreshold(parameters);
  if (indicatorThreshold != null) {
    lowerText.setText(indicatorThreshold[0] == null ? "String_Node_Str" : indicatorThreshold[0]);
    higherText.setText(indicatorThreshold[1] == null ? "String_Node_Str" : indicatorThreshold[1]);
  }
  String[] indicatorPersentThreshold=IndicatorHelper.getIndicatorThresholdInPercent(parameters);
  if (indicatorPersentThreshold != null && isContainRowCount) {
    if (StringUtils.isNotEmpty(indicatorPersentThreshold[0])) {
      Double min=StringFormatUtil.parseDouble(indicatorPersentThreshold[0]);
      pLowerText.setText(String.valueOf(min * 100));
    }
    if (StringUtils.isNotEmpty(indicatorPersentThreshold[1])) {
      Double max=StringFormatUtil.parseDouble(indicatorPersentThreshold[1]);
      pHigherText.setText(String.valueOf(max * 100));
    }
  }
}
Program: 139352
Project: 139352
Buggy source:
@Override public boolean performFinish(){
  boolean isMinEmpty=CheckValueUtils.isEmpty(lowerText.getText());
  boolean isMaxEmpty=CheckValueUtils.isEmpty(higherText.getText());
  if (isContainRowCount) {
    boolean isPerMinEmpty=CheckValueUtils.isEmpty(pLowerText.getText());
    boolean isPerMaxEmpty=CheckValueUtils.isEmpty(pHigherText.getText());
    if (isMinEmpty && isMaxEmpty && isPerMinEmpty&& isPerMaxEmpty) {
      parameters.setIndicatorValidDomain(null);
    }
 else {
      if (isMinEmpty && isMaxEmpty) {
        removeRange(VALUE_THRESHOLD);
      }
 else {
        IndicatorHelper.setIndicatorThreshold(parameters,lowerText.getText(),higherText.getText());
      }
      if (isPerMinEmpty && isPerMaxEmpty) {
        removeRange(PERCENTAGE_THRESHOLD);
      }
 else {
        IndicatorHelper.setIndicatorThresholdInPercent(parameters,pLowerText.getText(),pHigherText.getText());
      }
    }
  }
 else {
    if (isMinEmpty && isMaxEmpty) {
      parameters.setIndicatorValidDomain(null);
    }
 else {
      IndicatorHelper.setIndicatorThreshold(parameters,lowerText.getText(),higherText.getText());
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean performFinish(){
  boolean isMinEmpty=CheckValueUtils.isEmpty(lowerText.getText());
  boolean isMaxEmpty=CheckValueUtils.isEmpty(higherText.getText());
  if (isContainRowCount) {
    String plower=pLowerText.getText();
    String phigher=pHigherText.getText();
    boolean isPerMinEmpty=CheckValueUtils.isEmpty(plower);
    boolean isPerMaxEmpty=CheckValueUtils.isEmpty(phigher);
    if (isMinEmpty && isMaxEmpty && isPerMinEmpty&& isPerMaxEmpty) {
      parameters.setIndicatorValidDomain(null);
    }
 else {
      if (isMinEmpty && isMaxEmpty) {
        removeRange(VALUE_THRESHOLD);
      }
 else {
        IndicatorHelper.setIndicatorThreshold(parameters,lowerText.getText(),higherText.getText());
      }
      if (isPerMinEmpty && isPerMaxEmpty) {
        removeRange(PERCENTAGE_THRESHOLD);
      }
 else {
        String lower="String_Node_Str", higher="String_Node_Str";
        if (StringUtils.isNotEmpty(plower)) {
          lower=String.valueOf(Double.valueOf(plower) / 100);
        }
        if (StringUtils.isNotEmpty(phigher)) {
          higher=String.valueOf(Double.valueOf(phigher) / 100);
        }
        IndicatorHelper.setIndicatorThresholdInPercent(parameters,lower,higher);
      }
    }
  }
 else {
    if (isMinEmpty && isMaxEmpty) {
      parameters.setIndicatorValidDomain(null);
    }
 else {
      IndicatorHelper.setIndicatorThreshold(parameters,lowerText.getText(),higherText.getText());
    }
  }
  return true;
}
Program: 139353
Project: 139353
Buggy source:
@Override public String caseTextValue(TextValue object){
  return String.valueOf(object.getValue());
}

Fixed version (ground truth):
@Override public String caseTextValue(TextValue object){
  return object.getValue();
}
Program: 139355
Project: 139355
Buggy source:
@Override public String casePatternMatchingIndicator(PatternMatchingIndicator object){
  Long matchingValueCount=object.getMatchingValueCount();
  Long notMatchingValueCount=object.getNotMatchingValueCount();
  Double total=matchingValueCount.doubleValue() + notMatchingValueCount.doubleValue();
  return Double.valueOf(total > 0 ? matchingValueCount.doubleValue() * 100 / total : Double.NaN).toString();
}

Fixed version (ground truth):
@Override public String casePatternMatchingIndicator(PatternMatchingIndicator object){
  return String.valueOf(object.getMatchingValueCount());
}
Program: 139356
Project: 139356
Buggy source:
/** 
 * DOC yyi Comment method "runTableAnalysis".
 * @param tableName
 */
protected void runTableAnalysis(String tableName){
  Package parentPack=(Package)currentSelectionSchemaIndicator.getAnalyzedElement();
  try {
    TdCatalog catalogObj=SwitchHelpers.CATALOG_SWITCH.doSwitch(parentPack);
    List<TdTable> tdTables=DqRepositoryViewService.getTables(tdDataProvider,catalogObj,tableName,true);
    if (!tdTables.isEmpty()) {
      CatalogHelper.addTables(tdTables,catalogObj);
      TdTable table=tdTables.get(0);
      TableAnalysisWizard taw=(TableAnalysisWizard)WizardFactory.createAnalysisWizard(AnalysisType.TABLE,null);
      taw.setTdDataProvider(tdDataProvider);
      taw.setNamedColumnSet(new TdTable[]{table});
      taw.setShowTableSelectPage(false);
      WizardDialog dialog=new WizardDialog(null,taw);
      dialog.setPageSize(500,340);
      dialog.open();
    }
 else {
      MessageUI.openWarning("String_Node_Str" + tableName + "String_Node_Str");
    }
  }
 catch (  TalendException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * DOC yyi Comment method "runTableAnalysis".
 * @param tableName
 */
protected void runTableAnalysis(String tableName){
  Package parentPack=(Package)currentSelectionSchemaIndicator.getAnalyzedElement();
  TdCatalog catalogObj=SwitchHelpers.CATALOG_SWITCH.doSwitch(parentPack);
  try {
    List<TdTable> tdTables=DqRepositoryViewService.getTables(tdDataProvider,catalogObj,tableName,true);
    if (!tdTables.isEmpty()) {
      TdTable table=tdTables.get(0);
      if (!CatalogHelper.getTables(catalogObj).contains(table)) {
        CatalogHelper.addTables(tdTables,catalogObj);
      }
      List<TdColumn> columns=DqRepositoryViewService.getColumns(tdDataProvider,table,null,true);
      new AnalyzeColumnSetAction(columns.toArray(new TdColumn[columns.size()])).run();
    }
 else {
      MessageUI.openWarning("String_Node_Str" + tableName + "String_Node_Str");
    }
  }
 catch (  TalendException e) {
    e.printStackTrace();
  }
}
Program: 139357
Project: 139357
Buggy source:
/** 
 * DOC bZhou DQStructureManager constructor comment.
 */
private DQStructureManager(){
  ResourceManager.refreshStructure();
}

Fixed version (ground truth):
/** 
 * DOC bZhou DQStructureManager constructor comment.
 */
private DQStructureManager(){
  ResourceService.refreshStructure();
}
Program: 139358
Project: 139358
Buggy source:
/** 
 * Method "isNeedCreateStructure" created by bzhou@talend.com.
 * @return true if need to create new resource structure.
 */
public boolean isNeedCreateStructure(){
  if (isSecludedVersion()) {
    return !ResourceManager.checkSecludedResource();
  }
  return !ResourceManager.checkResource();
}

Fixed version (ground truth):
/** 
 * Method "isNeedCreateStructure" created by bzhou@talend.com.
 * @return true if need to create new resource structure.
 */
public boolean isNeedCreateStructure(){
  if (isSecludedVersion()) {
    return !ResourceService.checkSecludedResource();
  }
  return !ResourceService.checkResource();
}
Program: 139359
Project: 139359
Buggy source:
public boolean execute(){
  try {
    DQStructureManager manager=DQStructureManager.getInstance();
    IFolder folder=manager.createNewFolder(ResourceManager.getLibrariesFolder(),EResourceConstant.INDICATORS.getName());
    ResourceManager.setNoSubFolderProperty(folder);
    folder=manager.createNewFolder(folder,EResourceConstant.USER_DEFINED_INDICATORS.getName());
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
    return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean execute(){
  try {
    DQStructureManager manager=DQStructureManager.getInstance();
    IFolder folder=manager.createNewFolder(ResourceManager.getLibrariesFolder(),EResourceConstant.INDICATORS.getName());
    ResourceService.setNoSubFolderProperty(folder);
    folder=manager.createNewFolder(folder,EResourceConstant.USER_DEFINED_INDICATORS.getName());
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
    return false;
  }
  return true;
}
Program: 139360
Project: 139360
Buggy source:
public boolean execute(){
  IFolder libraryFolder=ResourceManager.getLibrariesFolder();
  try {
    IFolder patternFolder=ResourceManager.getPatternFolder();
    IFolder newRegexSubfolder=createSubfolder(patternFolder,EResourceConstant.PATTERN_REGEX.getName());
    moveItems(patternFolder,newRegexSubfolder);
    IFolder oldSqlPatternsFolder=libraryFolder.getFolder(SQL_PATTERNS);
    IFolder newSqlSubfolder=createSubfolder(patternFolder,EResourceConstant.PATTERN_SQL.getName());
    moveItems(oldSqlPatternsFolder,newSqlSubfolder);
    oldSqlPatternsFolder.delete(true,null);
    IFolder oldDqRulesFolder=libraryFolder.getFolder(DQ_RULES);
    IFolder newRulesFolder=createSubfolder(libraryFolder,EResourceConstant.RULES.getName());
    IFolder newRulesSQLSubfolder=createSubfolder(newRulesFolder,EResourceConstant.RULES_SQL.getName());
    moveItems(oldDqRulesFolder,newRulesSQLSubfolder);
    oldDqRulesFolder.delete(true,null);
    IFolder oldJrxmlFolder=libraryFolder.getFolder(JRXML_REPORTS);
    IFolder newJrxmlFolder=createSubfolder(libraryFolder,EResourceConstant.JRXML_TEMPLATE.getName());
    moveItems(oldJrxmlFolder,newJrxmlFolder);
    oldJrxmlFolder.delete(true,null);
    ResourceManager.refreshStructure();
  }
 catch (  CoreException e) {
    log.error(e.getMessage(),e);
  }
  return true;
}

Fixed version (ground truth):
public boolean execute(){
  IFolder libraryFolder=ResourceManager.getLibrariesFolder();
  try {
    IFolder patternFolder=ResourceManager.getPatternFolder();
    IFolder newRegexSubfolder=createSubfolder(patternFolder,EResourceConstant.PATTERN_REGEX.getName());
    moveItems(patternFolder,newRegexSubfolder);
    IFolder oldSqlPatternsFolder=libraryFolder.getFolder(SQL_PATTERNS);
    IFolder newSqlSubfolder=createSubfolder(patternFolder,EResourceConstant.PATTERN_SQL.getName());
    moveItems(oldSqlPatternsFolder,newSqlSubfolder);
    oldSqlPatternsFolder.delete(true,null);
    IFolder oldDqRulesFolder=libraryFolder.getFolder(DQ_RULES);
    IFolder newRulesFolder=createSubfolder(libraryFolder,EResourceConstant.RULES.getName());
    IFolder newRulesSQLSubfolder=createSubfolder(newRulesFolder,EResourceConstant.RULES_SQL.getName());
    moveItems(oldDqRulesFolder,newRulesSQLSubfolder);
    oldDqRulesFolder.delete(true,null);
    IFolder oldJrxmlFolder=libraryFolder.getFolder(JRXML_REPORTS);
    IFolder newJrxmlFolder=createSubfolder(libraryFolder,EResourceConstant.JRXML_TEMPLATE.getName());
    moveItems(oldJrxmlFolder,newJrxmlFolder);
    oldJrxmlFolder.delete(true,null);
    ResourceService.refreshStructure();
  }
 catch (  CoreException e) {
    log.error(e.getMessage(),e);
  }
  return true;
}
Program: 139361
Project: 139361
Buggy source:
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  if (element instanceof IFile) {
    IFile file=(IFile)element;
    if (FactoriesUtil.PATTERN.equals(file.getFileExtension())) {
      return true;
    }
  }
 else   if (element instanceof IFolder) {
    IFolder folder=(IFolder)element;
    return ResourceManager.isSubFolder(ResourceManager.getPatternFolder(),folder);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  if (element instanceof IFile) {
    IFile file=(IFile)element;
    if (FactoriesUtil.PATTERN.equals(file.getFileExtension())) {
      return true;
    }
  }
 else   if (element instanceof IFolder) {
    IFolder folder=(IFolder)element;
    return ResourceService.isSubFolder(ResourceManager.getPatternFolder(),folder);
  }
  return false;
}
Program: 139363
Project: 139363
Buggy source:
/** 
 * Adds a submenu to the given menu with the name "New Component".
 */
public void fillContextMenu(IMenuManager menu){
  Object obj=((TreeSelection)this.getContext().getSelection()).getFirstElement();
  if (obj instanceof IFolder) {
    currentSelection=(IFolder)obj;
    if (!ResourceManager.isNoSubFolder(currentSelection)) {
      CreateUserFolderAction createSubFolderAction=new CreateUserFolderAction();
      menu.add(createSubFolderAction);
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds a submenu to the given menu with the name "New Component".
 */
public void fillContextMenu(IMenuManager menu){
  Object obj=((TreeSelection)this.getContext().getSelection()).getFirstElement();
  if (obj instanceof IFolder) {
    currentSelection=(IFolder)obj;
    if (!ResourceService.isNoSubFolder(currentSelection)) {
      CreateUserFolderAction createSubFolderAction=new CreateUserFolderAction();
      menu.add(createSubFolderAction);
    }
  }
}
Program: 139364
Project: 139364
Buggy source:
/** 
 * Adds a submenu to the given menu with the name "New Component".
 */
public void fillContextMenu(IMenuManager menu){
  Object obj=((TreeSelection)this.getContext().getSelection()).getFirstElement();
  if (obj instanceof IFolder) {
    currentSelection=(IFolder)obj;
    if (!ResourceManager.isReadOnlyFolder(currentSelection)) {
      DeleteFolderAction createSubFolderAction=new DeleteFolderAction(currentSelection);
      menu.add(createSubFolderAction);
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds a submenu to the given menu with the name "New Component".
 */
public void fillContextMenu(IMenuManager menu){
  Object obj=((TreeSelection)this.getContext().getSelection()).getFirstElement();
  if (obj instanceof IFolder) {
    currentSelection=(IFolder)obj;
    if (!ResourceService.isReadOnlyFolder(currentSelection)) {
      DeleteFolderAction createSubFolderAction=new DeleteFolderAction(currentSelection);
      menu.add(createSubFolderAction);
    }
  }
}
Program: 139365
Project: 139365
Buggy source:
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  if (element instanceof IFile) {
    IFile file=(IFile)element;
    if (FactoriesUtil.DQRULE.equals(file.getFileExtension())) {
      return true;
    }
  }
 else   if (element instanceof IFolder) {
    IFolder folder=(IFolder)element;
    return ResourceManager.isSubFolder(ResourceManager.getRulesFolder(),folder);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  if (element instanceof IFile) {
    IFile file=(IFile)element;
    if (FactoriesUtil.DQRULE.equals(file.getFileExtension())) {
      return true;
    }
  }
 else   if (element instanceof IFolder) {
    IFolder folder=(IFolder)element;
    return ResourceService.isSubFolder(ResourceManager.getRulesFolder(),folder);
  }
  return false;
}
Program: 139367
Project: 139367
Buggy source:
/** 
 * DOC bZhou Comment method "initWorkspace".
 */
private void initWorkspace(){
  ResourceManager.initResourcePersistence();
  SQLExplorerPlugin.getDefault().initAllDrivers();
  List<TdDataProvider> providers=PrvResourceFileHelper.getInstance().getAllDataProviders();
  for (  DataProvider provider : providers) {
    CorePlugin.getDefault().addConnetionAliasToSQLPlugin(provider);
  }
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "initWorkspace".
 */
private void initWorkspace(){
  ResourceService.initResourcePersistence();
  SQLExplorerPlugin.getDefault().initAllDrivers();
  List<TdDataProvider> providers=PrvResourceFileHelper.getInstance().getAllDataProviders();
  for (  DataProvider provider : providers) {
    CorePlugin.getDefault().addConnetionAliasToSQLPlugin(provider);
  }
}
Program: 139368
Project: 139368
Buggy source:
@Override public IStatus validateDrop(Object target,int operation,TransferData transferType){
  if (!(target instanceof IResource)) {
    return Status.CANCEL_STATUS;
  }
  IResource targetRes=(IResource)target;
  for (  IResource res : getSelectedResources()) {
    if (res.getType() == IResource.FILE) {
      if ((targetRes.getType() == IResource.FOLDER)) {
        IFolder targetFolder=(IFolder)targetRes;
        IFolder sourceFolder=(IFolder)res.getParent();
        if (ResourceManager.isSubFolder(targetFolder,sourceFolder)) {
          return Status.OK_STATUS;
        }
        if (ResourceManager.isSubFolder(sourceFolder,targetFolder) && !ResourceManager.isNoSubFolder(sourceFolder)) {
          return Status.OK_STATUS;
        }
      }
 else       if ((targetRes.getType() == IResource.FILE) && FactoriesUtil.isAnalysisFile((IFile)res)) {
        IFile tfile=(IFile)targetRes;
        if (FactoriesUtil.isReportFile(tfile)) {
          return Status.OK_STATUS;
        }
      }
    }
  }
  return Status.CANCEL_STATUS;
}

Fixed version (ground truth):
@Override public IStatus validateDrop(Object target,int operation,TransferData transferType){
  if (!(target instanceof IResource)) {
    return Status.CANCEL_STATUS;
  }
  IResource targetRes=(IResource)target;
  for (  IResource res : getSelectedResources()) {
    if (res.getType() == IResource.FILE) {
      IFile sourceFile=(IFile)res;
switch (targetRes.getType()) {
case IResource.FOLDER:
        IFolder targetFolder=(IFolder)targetRes;
      if (ResourceService.allowDND(sourceFile,targetFolder)) {
        return Status.OK_STATUS;
      }
    break;
case IResource.FILE:
  IFile targetFile=(IFile)targetRes;
if (FactoriesUtil.isAnalysisFile(sourceFile) && FactoriesUtil.isReportFile(targetFile)) {
  return Status.OK_STATUS;
}
break;
default :
break;
}
}
}
return Status.CANCEL_STATUS;
}
Program: 139369
Project: 139369
Buggy source:
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  if (element instanceof IFile) {
    IFile file=(IFile)element;
    if (FactoriesUtil.DQRULE.equals(file.getFileExtension())) {
      return true;
    }
  }
 else   if (element instanceof IFolder) {
    IFolder folder=(IFolder)element;
    return ResourceManager.isSubFolder(ResourceManager.getRulesFolder(),folder);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  if (element instanceof IFile) {
    IFile file=(IFile)element;
    if (FactoriesUtil.DQRULE.equals(file.getFileExtension())) {
      return true;
    }
  }
 else   if (element instanceof IFolder) {
    IFolder folder=(IFolder)element;
    return ResourceService.isSubFolder(ResourceManager.getRulesFolder(),folder);
  }
  return false;
}
Program: 139370
Project: 139370
Buggy source:
public void createControl(Composite parent){
  Composite container=new Composite(parent,SWT.NONE);
  FillLayout layout=new FillLayout();
  container.setLayout(layout);
  cViewer=new ContainerCheckedTreeViewer(container,SWT.NONE);
  cViewer.setLabelProvider(new DQRuleLabelProvider());
  cViewer.setContentProvider(new WorkbenchContentProvider());
  cViewer.setInput(ResourceManager.getLibrariesFolder());
  cViewer.addFilter(new DQFolderFliter(true));
  cViewer.addFilter(new ViewerFilter(){
    @Override public boolean select(    Viewer viewer,    Object parentElement,    Object element){
      if (element instanceof IFile) {
        IFile file=(IFile)element;
        if (FactoriesUtil.DQRULE.equals(file.getFileExtension())) {
          return true;
        }
      }
 else       if (element instanceof IFolder) {
        IFolder folder=(IFolder)element;
        return ResourceManager.isSubFolder(ResourceManager.getRulesFolder(),folder);
      }
      return false;
    }
  }
);
  setControl(container);
}

Fixed version (ground truth):
public void createControl(Composite parent){
  Composite container=new Composite(parent,SWT.NONE);
  FillLayout layout=new FillLayout();
  container.setLayout(layout);
  cViewer=new ContainerCheckedTreeViewer(container,SWT.NONE);
  cViewer.setLabelProvider(new DQRuleLabelProvider());
  cViewer.setContentProvider(new WorkbenchContentProvider());
  cViewer.setInput(ResourceManager.getLibrariesFolder());
  cViewer.addFilter(new DQFolderFliter(true));
  cViewer.addFilter(new ViewerFilter(){
    @Override public boolean select(    Viewer viewer,    Object parentElement,    Object element){
      if (element instanceof IFile) {
        IFile file=(IFile)element;
        if (FactoriesUtil.DQRULE.equals(file.getFileExtension())) {
          return true;
        }
      }
 else       if (element instanceof IFolder) {
        IFolder folder=(IFolder)element;
        return ResourceService.isSubFolder(ResourceManager.getRulesFolder(),folder);
      }
      return false;
    }
  }
);
  setControl(container);
}
Program: 139372
Project: 139372
Buggy source:
public static TdSqlDataType createDataType(ResultSet columns) throws SQLException {
  TdSqlDataType sqlDataType=RelationalFactory.eINSTANCE.createTdSqlDataType();
  try {
    sqlDataType.setName(columns.getString(GetColumn.TYPE_NAME.name()));
  }
 catch (  Exception e1) {
    log.warn(e1,e1);
  }
  try {
    sqlDataType.setJavaDataType(columns.getInt(GetColumn.DATA_TYPE.name()));
  }
 catch (  Exception e1) {
    log.warn(e1,e1);
  }
  try {
    sqlDataType.setNumericPrecision(columns.getInt(GetColumn.DECIMAL_DIGITS.name()));
    sqlDataType.setNumericPrecisionRadix(columns.getInt(GetColumn.NUM_PREC_RADIX.name()));
  }
 catch (  Exception e) {
    log.warn(e);
  }
  return sqlDataType;
}

Fixed version (ground truth):
/** 
 * DOC xqliu Comment method "createDataType".
 * @param dataType
 * @param typeName
 * @param decimalDigits
 * @param numPrecRadix
 * @return
 */
public static TdSqlDataType createDataType(int dataType,String typeName,int decimalDigits,int numPrecRadix){
  TdSqlDataType sqlDataType=RelationalFactory.eINSTANCE.createTdSqlDataType();
  sqlDataType.setName(typeName);
  sqlDataType.setJavaDataType(dataType);
  sqlDataType.setNumericPrecision(decimalDigits);
  sqlDataType.setNumericPrecisionRadix(numPrecRadix);
  return sqlDataType;
}
Program: 139374
Project: 139374
Buggy source:
/** 
 * Method "changeCatalog".
 * @param catalogName unquoted catalog's name
 * @param connection
 * @throws SQLException
 */
protected boolean changeCatalog(String catalogName,Connection connection){
  try {
    connection.setCatalog(catalogName);
    return true;
  }
 catch (  RuntimeException e) {
    return traceError("String_Node_Str" + catalogName + "String_Node_Str"+ e.getMessage());
  }
catch (  SQLException e) {
    return traceError("String_Node_Str" + catalogName + "String_Node_Str"+ e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Method "changeCatalog".
 * @param catalogName unquoted catalog's name
 * @param connection
 * @throws SQLException
 */
protected boolean changeCatalog(String catalogName,Connection connection){
  try {
    if (!ConnectionUtils.isOdbcMssql(connection)) {
      connection.setCatalog(catalogName);
    }
    return true;
  }
 catch (  RuntimeException e) {
    return traceError("String_Node_Str" + catalogName + "String_Node_Str"+ e.getMessage());
  }
catch (  SQLException e) {
    return traceError("String_Node_Str" + catalogName + "String_Node_Str"+ e.getMessage());
  }
}
Program: 139375
Project: 139375
Buggy source:
/** 
 * DOC xqliu Comment method "getVersion".
 * @return
 */
public static ProductVersion getVersion(){
  Connection connection=null;
  try {
    connection=ConnectionUtils.createConnection(url,driver,props);
    if (connection != null) {
      Statement stat=connection.createStatement();
      ResultSet result=stat.executeQuery("String_Node_Str" + dbName + "String_Node_Str");
      result.next();
      String versionStr=result.getString(1);
      return ProductVersion.fromString(versionStr);
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
 finally {
    if (connection != null) {
      try {
        connection.close();
      }
 catch (      SQLException e) {
        e.printStackTrace();
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "getVersion".
 * @param url
 * @param driver
 * @param props
 * @return
 */
public static ProductVersion getVersion(String url,String driver,Properties props){
  Connection connection=null;
  try {
    connection=ConnectionUtils.createConnection(url,driver,props);
    if (connection != null) {
      Statement stat=connection.createStatement();
      ResultSet result=stat.executeQuery("String_Node_Str" + dbName + "String_Node_Str");
      result.next();
      String versionStr=result.getString(1);
      return ProductVersion.fromString(versionStr);
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
 finally {
    if (connection != null) {
      try {
        connection.close();
      }
 catch (      SQLException e) {
        e.printStackTrace();
      }
    }
  }
  return null;
}
Program: 139376
Project: 139376
Buggy source:
/** 
 * DOC bZhou Comment method "updateVersionInDB".
 * @param url
 * @param driver
 * @param props
 * @return
 */
public static boolean updateVersionInDB(String url,String driver,Properties props){
  Connection connection=null;
  try {
    connection=ConnectionUtils.createConnection(url,driver,props);
    if (connection != null) {
      Statement stat=connection.createStatement();
      ProductVersion curVersion=WorkspaceVersionHelper.getVesion();
      return stat.execute("String_Node_Str" + curVersion + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
 finally {
    if (connection != null) {
      try {
        connection.close();
      }
 catch (      SQLException e) {
        e.printStackTrace();
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "updateVersionInDB".
 * @param url
 * @param driver
 * @param props
 * @return
 */
public static boolean updateVersionInDB(String url,String driver,Properties props){
  Connection connection=null;
  ProductVersion curVersion=CorePlugin.getDefault().getProductVersion();
  String sql="String_Node_Str" + curVersion + "String_Node_Str";
  try {
    connection=ConnectionUtils.createConnection(url,driver,props);
    if (connection != null) {
      Statement stat=connection.createStatement();
      return stat.executeUpdate(sql) > 0;
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
 finally {
    if (connection != null) {
      try {
        connection.close();
      }
 catch (      SQLException e) {
        e.printStackTrace();
      }
    }
  }
  return false;
}
Program: 139377
Project: 139377
Buggy source:
protected String getFullyQualifiedTableName(NamedColumnSet set){
  String catalogName=CatalogHelper.getParentCatalog(set) == null ? null : CatalogHelper.getParentCatalog(set).getName();
  String schemaName=SchemaHelper.getParentSchema(set) == null ? null : SchemaHelper.getParentSchema(set).getName();
  return dbmsLanguage.toQualifiedName(catalogName,schemaName,set.getName());
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "getFullyQualifiedTableName".
 * @param set
 * @return
 */
protected String getFullyQualifiedTableName(ColumnSet set){
  TdSchema parentSchema=SchemaHelper.getParentSchema(set);
  TdCatalog parentCatalog=CatalogHelper.getParentCatalog(set);
  if (parentSchema != null) {
    parentCatalog=CatalogHelper.getParentCatalog(parentSchema);
  }
  String schemaName=parentSchema == null ? null : parentSchema.getName();
  String catalogName=parentCatalog == null ? null : parentCatalog.getName();
  return dbmsLanguage.toQualifiedName(catalogName,schemaName,set.getName());
}
Program: 139378
Project: 139378
Buggy source:
/** 
 * DOC bZhou Comment method "openInSqlEditor".
 * @param tdDataProvider
 * @param query
 * @param editorName
 * @return the specified sql editor.
 */
public SQLEditor openInSqlEditor(TdDataProvider tdDataProvider,String query,String editorName){
  if (editorName == null) {
    editorName=String.valueOf(SQLExplorerPlugin.getDefault().getEditorSerialNo());
  }
  SQLExplorerPlugin sqlPlugin=SQLExplorerPlugin.getDefault();
  AliasManager aliasManager=sqlPlugin.getAliasManager();
  Alias alias=aliasManager.getAlias(tdDataProvider.getName());
  if (alias == null) {
    List<TdDataProvider> allDataProviders=PrvResourceFileHelper.getInstance().getAllDataProviders(ResourceManager.getMetadataFolder());
    for (    TdDataProvider dataProvider : allDataProviders) {
      if (dataProvider == tdDataProvider) {
        addConnetionAliasToSQLPlugin(dataProvider);
        openInSqlEditor(tdDataProvider,query,editorName);
      }
    }
  }
 else {
    try {
      SQLEditorInput input=new SQLEditorInput("String_Node_Str" + editorName + "String_Node_Str");
      input.setUser(alias.getDefaultUser());
      IWorkbenchPage page=SQLExplorerPlugin.getDefault().getActivePage();
      SQLEditor editorPart=(SQLEditor)page.openEditor((IEditorInput)input,SQLEditor.class.getName());
      editorPart.setText(query);
      return editorPart;
    }
 catch (    PartInitException e) {
      log.error(e,e);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "openInSqlEditor".
 * @param tdDataProvider
 * @param query
 * @param editorName
 * @return the specified sql editor.
 */
public SQLEditor openInSqlEditor(TdDataProvider tdDataProvider,String query,String editorName){
  if (editorName == null) {
    editorName=String.valueOf(SQLExplorerPlugin.getDefault().getEditorSerialNo());
  }
  SQLExplorerPlugin sqlPlugin=SQLExplorerPlugin.getDefault();
  AliasManager aliasManager=sqlPlugin.getAliasManager();
  Alias alias=aliasManager.getAlias(tdDataProvider.getName());
  if (alias == null) {
    List<TdDataProvider> allDataProviders=PrvResourceFileHelper.getInstance().getAllDataProviders(ResourceManager.getMetadataFolder());
    for (    TdDataProvider dataProvider : allDataProviders) {
      if (dataProvider == tdDataProvider) {
        addConnetionAliasToSQLPlugin(dataProvider);
        openInSqlEditor(tdDataProvider,query,editorName);
      }
    }
  }
 else {
    try {
      TdProviderConnection connection=DataProviderHelper.getTdProviderConnection(tdDataProvider).getObject();
      if (connection != null) {
        String userName=DataProviderHelper.getUser(connection);
        SQLEditorInput input=new SQLEditorInput("String_Node_Str" + alias.getName() + "String_Node_Str"+ editorName+ "String_Node_Str");
        input.setUser(alias.getUser(userName));
        IWorkbenchPage page=SQLExplorerPlugin.getDefault().getActivePage();
        SQLEditor editorPart=(SQLEditor)page.openEditor((IEditorInput)input,SQLEditor.class.getName());
        editorPart.setText(query);
        return editorPart;
      }
    }
 catch (    PartInitException e) {
      log.error(e,e);
    }
  }
  return null;
}
Program: 139379
Project: 139379
Buggy source:
/** 
 * DOC yyi Comment method "runTableAnalysis".
 * @param tableName
 */
protected void runTableAnalysis(String tableName){
  Package parentPack=(Package)currentSelectionSchemaIndicator.getAnalyzedElement();
  try {
    TdCatalog catalogObj=SwitchHelpers.CATALOG_SWITCH.doSwitch(parentPack);
    List<TdTable> tableList=DqRepositoryViewService.getTables(tdDataProvider,catalogObj,tableName,false);
    for (    TdTable table : tableList) {
      if (table.getName().equals(tableName)) {
        TableAnalysisWizard taw=(TableAnalysisWizard)WizardFactory.createAnalysisWizard(AnalysisType.TABLE,null);
        taw.setTdDataProvider(tdDataProvider);
        taw.setNamedColumnSet(new TdTable[]{table});
        taw.setShowTableSelectPage(false);
        WizardDialog dialog=new WizardDialog(null,taw);
        dialog.setPageSize(500,340);
        dialog.open();
        break;
      }
    }
  }
 catch (  TalendException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * DOC yyi Comment method "runTableAnalysis".
 * @param tableName
 */
protected void runTableAnalysis(String tableName){
  Package parentPack=(Package)currentSelectionSchemaIndicator.getAnalyzedElement();
  try {
    TdCatalog catalogObj=SwitchHelpers.CATALOG_SWITCH.doSwitch(parentPack);
    List<TdTable> tdTables=DqRepositoryViewService.getTables(tdDataProvider,catalogObj,tableName,true);
    if (!tdTables.isEmpty()) {
      CatalogHelper.addTables(tdTables,catalogObj);
      TdTable table=tdTables.get(0);
      TableAnalysisWizard taw=(TableAnalysisWizard)WizardFactory.createAnalysisWizard(AnalysisType.TABLE,null);
      taw.setTdDataProvider(tdDataProvider);
      taw.setNamedColumnSet(new TdTable[]{table});
      taw.setShowTableSelectPage(false);
      WizardDialog dialog=new WizardDialog(null,taw);
      dialog.setPageSize(500,340);
      dialog.open();
    }
 else {
      MessageUI.openWarning("String_Node_Str" + tableName + "String_Node_Str");
    }
  }
 catch (  TalendException e) {
    e.printStackTrace();
  }
}