nus-yam/ex-repair huggingface dataset:
Program: 140188
Project: 140188
Buggy source:
public Map<String,String> getQueryMap(){
  Map<String,String> map=new HashMap<String,String>();
switch (this.indicatorEnum) {
case RowCountIndicatorEnum:
case NullCountIndicatorEnum:
case BlankCountIndicatorEnum:
    map.put(MENU_VIEW_ROWS,getRowsStatement());
  break;
case UniqueIndicatorEnum:
map.put(MENU_VIEW_ROWS,getRowsStatementWithSubQuery());
map.put(MENU_VIEW_VALUES,getValuesStatement(this.columnName));
break;
case DistinctCountIndicatorEnum:
map.put(MENU_VIEW_VALUES,getDistinctValuesStatement(this.columnName));
break;
case DuplicateCountIndicatorEnum:
map.put(MENU_VIEW_ROWS,getRowsStatementWithSubQuery());
map.put(MENU_VIEW_VALUES,getValuesStatement("String_Node_Str"));
break;
default :
}
return map;
}

Fixed version (ground truth):
public Map<String,String> getQueryMap(){
  Map<String,String> map=new HashMap<String,String>();
switch (this.indicatorEnum) {
case RowCountIndicatorEnum:
case NullCountIndicatorEnum:
case BlankCountIndicatorEnum:
    map.put(MENU_VIEW_ROWS,getRowsStatement());
  break;
case UniqueIndicatorEnum:
map.put(MENU_VIEW_ROWS,getRowsStatementWithSubQuery());
map.put(MENU_VIEW_VALUES,getValuesStatement(this.columnName));
break;
case DistinctCountIndicatorEnum:
map.put(MENU_VIEW_VALUES,getDistinctValuesStatement(this.columnName));
break;
case DuplicateCountIndicatorEnum:
map.put(MENU_VIEW_ROWS,getRowsStatementWithSubQuery());
map.put(MENU_VIEW_VALUES,getValuesStatement(this.columnName));
break;
default :
}
return map;
}
Program: 140189
Project: 140189
Buggy source:
/** 
 * Method "quote".
 * @param sqlIdentifier the SQL identifier to quote
 * @return the sqlIdentifier quoted.
 */
public String quote(String sqlIdentifier){
  return dbQuoteString + sqlIdentifier + dbQuoteString;
}

Fixed version (ground truth):
/** 
 * Method "quote".
 * @param sqlIdentifier the SQL identifier to quote
 * @return the sqlIdentifier quoted.
 */
public String quote(String sqlIdentifier){
  String quotedSqlIdentifier=sqlIdentifier;
  if (!quotedSqlIdentifier.startsWith(dbQuoteString)) {
    quotedSqlIdentifier=dbQuoteString + quotedSqlIdentifier;
  }
  if (!quotedSqlIdentifier.endsWith(dbQuoteString)) {
    quotedSqlIdentifier=quotedSqlIdentifier + dbQuoteString;
  }
  return quotedSqlIdentifier;
}
Program: 140190
Project: 140190
Buggy source:
public String toQualifiedName(String catalog,String schema,String table){
  StringBuffer qualName=new StringBuffer();
  if (catalog != null && catalog.length() > 0) {
    qualName.append(catalog);
    qualName.append(DOT);
  }
  if (schema != null && schema.length() > 0) {
    qualName.append(schema);
    qualName.append(DOT);
  }
  qualName.append(table);
  if (log.isDebugEnabled()) {
    log.debug(String.format("String_Node_Str",catalog,schema,table,qualName));
  }
  return qualName.toString();
}

Fixed version (ground truth):
public String toQualifiedName(String catalog,String schema,String table){
  StringBuffer qualName=new StringBuffer();
  if (catalog != null && catalog.length() > 0) {
    qualName.append(this.quote(catalog));
    qualName.append(DOT);
  }
  if (schema != null && schema.length() > 0) {
    qualName.append(this.quote(schema));
    qualName.append(DOT);
  }
  qualName.append(this.quote(table));
  if (log.isDebugEnabled()) {
    log.debug(String.format("String_Node_Str",catalog,schema,table,qualName));
  }
  return qualName.toString();
}
Program: 140192
Project: 140192
Buggy source:
static JFreeChart createChart(EIndicatorChartType chartType,IDataEntity dataset){
  CategoryDataset cDataset=(CategoryDataset)dataset;
switch (chartType) {
case FREQUENCE_STATISTICS:
    return createBarChart(chartType.getLiteral(),cDataset);
case PATTERN_MATCHING:
case SQL_PATTERN_MATCHING:
  return createStacked3DBarChart(chartType.getLiteral(),cDataset);
case SUMMARY_STATISTICS:
if (dataset instanceof BoxAndWhiskerCategoryDataset) {
  BoxAndWhiskerCategoryDataset bDataset=(BoxAndWhiskerCategoryDataset)dataset;
  return createBoxAndWhiskerChart(chartType.getLiteral(),bDataset);
}
return create3DBarChart(chartType.getLiteral(),cDataset,false);
case SIMPLE_STATISTICS:
case TEXT_STATISTICS:
return create3DBarChart(chartType.getLiteral(),cDataset,true);
default :
return null;
}
}

Fixed version (ground truth):
static JFreeChart createChart(EIndicatorChartType chartType,IDataEntity dataset){
  CategoryDataset cDataset=(CategoryDataset)dataset;
switch (chartType) {
case FREQUENCE_STATISTICS:
case LOW_FREQUENCE_STATISTICS:
    return createBarChart(chartType.getLiteral(),cDataset);
case PATTERN_MATCHING:
case SQL_PATTERN_MATCHING:
  return createStacked3DBarChart(chartType.getLiteral(),cDataset);
case SUMMARY_STATISTICS:
if (dataset instanceof BoxAndWhiskerCategoryDataset) {
  BoxAndWhiskerCategoryDataset bDataset=(BoxAndWhiskerCategoryDataset)dataset;
  return createBoxAndWhiskerChart(chartType.getLiteral(),bDataset);
}
return create3DBarChart(chartType.getLiteral(),cDataset,false);
case SIMPLE_STATISTICS:
case TEXT_STATISTICS:
return create3DBarChart(chartType.getLiteral(),cDataset,true);
default :
return null;
}
}
Program: 140195
Project: 140195
Buggy source:
static ITableLabelProvider createLabelProvider(EIndicatorChartType chartType){
switch (chartType) {
case FREQUENCE_STATISTICS:
    return new FrequencyLabelProvider();
case MODE_INDICATOR:
  return new ModeLabelProvider();
case SQL_PATTERN_MATCHING:
case PATTERN_MATCHING:
return new PatternLabelProvider();
case TEXT_STATISTICS:
case SIMPLE_STATISTICS:
return new SimpleLabelProvider();
case SUMMARY_STATISTICS:
return new SummaryLabelProvider();
default :
return new BaseChartTableLabelProvider();
}
}

Fixed version (ground truth):
static ITableLabelProvider createLabelProvider(EIndicatorChartType chartType){
switch (chartType) {
case MODE_INDICATOR:
    return new ModeLabelProvider();
case SQL_PATTERN_MATCHING:
case PATTERN_MATCHING:
  return new PatternLabelProvider();
case SUMMARY_STATISTICS:
return new SummaryLabelProvider();
default :
return new BaseChartTableLabelProvider();
}
}
Program: 140197
Project: 140197
Buggy source:
/** 
 * Method "propagateDataThresholdsInChildren" will propage the data threshold to the indicator if the given indicator is a BoxIndicator (Otherwise, nothing is done).
 * @param indicator an instance of BoxIndicator
 */
public static void propagateDataThresholdsInChildren(Indicator indicator){
  if (IndicatorsPackage.eINSTANCE.getBoxIndicator().equals(indicator.eClass())) {
    BoxIndicator boxIndicator=(BoxIndicator)indicator;
    String[] dataThreshold=IndicatorHelper.getDataThreshold(boxIndicator);
    if (dataThreshold == null) {
      dataThreshold=new String[2];
    }
    RangeIndicator rangeIndicator=boxIndicator.getRangeIndicator();
    setDataThresholds(rangeIndicator,dataThreshold);
    IQRIndicator iqr=boxIndicator.getIQR();
    setDataThresholds(iqr,dataThreshold);
    setDataThreshold(boxIndicator.getMeanIndicator(),dataThreshold[0],dataThreshold[1]);
    setDataThreshold(boxIndicator.getMedianIndicator(),dataThreshold[0],dataThreshold[1]);
  }
}

Fixed version (ground truth):
/** 
 * Method "propagateDataThresholdsInChildren" will propage the data threshold to the indicator if the given indicator is a BoxIndicator (Otherwise, nothing is done).
 * @param indicator an instance of BoxIndicator
 */
public static void propagateDataThresholdsInChildren(Indicator indicator){
  if (IndicatorsPackage.eINSTANCE.getBoxIndicator().equals(indicator.eClass())) {
    BoxIndicator boxIndicator=(BoxIndicator)indicator;
    String[] dataThreshold=IndicatorHelper.getDataThreshold(boxIndicator);
    if (dataThreshold == null) {
      final EList<Indicator> allChildIndicators=boxIndicator.getAllChildIndicators();
      for (      Indicator ind : allChildIndicators) {
        clearDataThresholds(ind);
      }
      return;
    }
    RangeIndicator rangeIndicator=boxIndicator.getRangeIndicator();
    setDataThresholds(rangeIndicator,dataThreshold);
    IQRIndicator iqr=boxIndicator.getIQR();
    setDataThresholds(iqr,dataThreshold);
    setDataThreshold(boxIndicator.getMeanIndicator(),dataThreshold[0],dataThreshold[1]);
    setDataThreshold(boxIndicator.getMedianIndicator(),dataThreshold[0],dataThreshold[1]);
  }
}
Program: 140199
Project: 140199
Buggy source:
private static JFreeChart createStacked3DBarChart(String titile,CategoryDataset dataset){
  JFreeChart chart=ChartFactory.createStackedBarChart3D(null,null,"String_Node_Str",dataset,PlotOrientation.VERTICAL,true,false,false);
  CategoryPlot plot=chart.getCategoryPlot();
  BarRenderer renderer=(BarRenderer)plot.getRenderer();
  renderer.setSeriesPaint(0,Color.GREEN);
  renderer.setSeriesPaint(1,Color.RED);
  renderer.setBaseItemLabelsVisible(true);
  renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("String_Node_Str",NumberFormat.getIntegerInstance(),new DecimalFormat("String_Node_Str")));
  renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER,TextAnchor.CENTER));
  NumberAxis axis=(NumberAxis)plot.getRangeAxis();
  axis.setNumberFormatOverride(NumberFormat.getPercentInstance());
  axis.setUpperMargin(0.05f);
  axis.setLowerMargin(0.01f);
  return chart;
}

Fixed version (ground truth):
private static JFreeChart createStacked3DBarChart(String titile,CategoryDataset dataset){
  JFreeChart chart=ChartFactory.createStackedBarChart3D(null,null,"String_Node_Str",dataset,PlotOrientation.VERTICAL,true,false,false);
  CategoryPlot plot=chart.getCategoryPlot();
  StackedBarRenderer3D renderer=(StackedBarRenderer3D)plot.getRenderer();
  renderer.setSeriesPaint(0,Color.GREEN);
  renderer.setSeriesPaint(1,Color.RED);
  renderer.setBaseItemLabelsVisible(true);
  renderer.setRenderAsPercentages(true);
  renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("String_Node_Str",NumberFormat.getIntegerInstance(),new DecimalFormat("String_Node_Str")));
  renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER,TextAnchor.CENTER));
  NumberAxis axis=(NumberAxis)plot.getRangeAxis();
  axis.setNumberFormatOverride(NumberFormat.getPercentInstance());
  axis.setUpperMargin(0.05f);
  axis.setLowerMargin(0.01f);
  return chart;
}
Program: 140200
Project: 140200
Buggy source:
public String addWhereToSqlStringStatement(String completedSqlString,List<String> whereExpressions) throws ParseException {
  TypedReturnCode<String> trc=this.prepareQuery(completedSqlString);
  String query=trc.getObject();
  String where=this.buildWhereExpression(whereExpressions);
  if ((where != null && where.trim().length() != 0) || completedSqlString.contains(AND_WHERE_CLAUSE)) {
    query=this.addWhereToStatement(query,where);
  }
  this.finalizeQuery(query);
  return query;
}

Fixed version (ground truth):
public String addWhereToSqlStringStatement(String completedSqlString,List<String> whereExpressions) throws ParseException {
  TypedReturnCode<String> trc=this.prepareQuery(completedSqlString);
  String query=trc.getObject();
  String where=this.buildWhereExpression(whereExpressions);
  if ((where != null && where.trim().length() != 0) || completedSqlString.contains(AND_WHERE_CLAUSE)) {
    query=this.addWhereToStatement(query,where);
  }
  return this.finalizeQuery(query);
}
Program: 140201
Project: 140201
Buggy source:
public String getValidRowsStatement() throws TalendException {
  if (this.indicator == null || !(this.indicator instanceof PatternMatchingIndicator)) {
    throw new TalendException("String_Node_Str" + analysis.getName());
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString((PatternMatchingIndicator)this.indicator);
  String regexCmp=dbmsLanguage.regexLike(indicator.getAnalyzedElement().getName(),regexPatternString);
  return getRowsStatement(regexCmp);
}

Fixed version (ground truth):
public String getValidRowsStatement() throws TalendException {
  if (this.indicator == null || !(this.indicator instanceof PatternMatchingIndicator)) {
    throw new TalendException("String_Node_Str" + analysis.getName());
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString((PatternMatchingIndicator)this.indicator);
  final String columnName=dbmsLanguage.quote(indicator.getAnalyzedElement().getName());
  String regexCmp=dbmsLanguage.regexLike(columnName,regexPatternString);
  return getRowsStatement(regexCmp);
}
Program: 140202
Project: 140202
Buggy source:
public String getInvalidRowsStatement() throws TalendException {
  if (this.indicator == null || !(this.indicator instanceof PatternMatchingIndicator)) {
    throw new TalendException("String_Node_Str" + analysis.getName());
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString((PatternMatchingIndicator)this.indicator);
  String columnName=indicator.getAnalyzedElement().getName();
  String regexCmp=dbmsLanguage.regexNotLike(columnName,regexPatternString);
  String nullClause=dbmsLanguage.or() + columnName + dbmsLanguage.isNull();
  return getRowsStatement(regexCmp + nullClause);
}

Fixed version (ground truth):
public String getInvalidRowsStatement() throws TalendException {
  if (this.indicator == null || !(this.indicator instanceof PatternMatchingIndicator)) {
    throw new TalendException("String_Node_Str" + analysis.getName());
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString((PatternMatchingIndicator)this.indicator);
  String columnName=dbmsLanguage.quote(indicator.getAnalyzedElement().getName());
  String regexCmp=dbmsLanguage.regexNotLike(columnName,regexPatternString);
  String nullClause=dbmsLanguage.or() + columnName + dbmsLanguage.isNull();
  return getRowsStatement(regexCmp + nullClause);
}
Program: 140203
Project: 140203
Buggy source:
public String getValue(){
  return value;
}

Fixed version (ground truth):
public String getValue(){
  return StringFormatUtil.format(value,StringFormatUtil.NUMBER).toString();
}
Program: 140204
Project: 140204
Buggy source:
public String getPersent(){
  if (percent != null) {
    return percent;
  }
 else {
    Double d=Double.parseDouble(getValue()) / indicator.getCount().doubleValue();
    return String.valueOf(d);
  }
}

Fixed version (ground truth):
public String getPersent(){
  return StringFormatUtil.format(percent,StringFormatUtil.PERCENT).toString();
}
Program: 140205
Project: 140205
Buggy source:
public String getPerMatch(){
  Double match=Double.parseDouble(getNumMatch());
  return String.valueOf(match / getSum());
}

Fixed version (ground truth):
public String getPerMatch(){
  Double match=Double.parseDouble(getNumMatch());
  return StringFormatUtil.format(match / getSum(),StringFormatUtil.PERCENT).toString();
}
Program: 140206
Project: 140206
Buggy source:
public String getPerNoMatch(){
  Double nomatch=Double.parseDouble(getNumNoMatch());
  return String.valueOf(nomatch / getSum());
}

Fixed version (ground truth):
public String getPerNoMatch(){
  Double nomatch=Double.parseDouble(getNumNoMatch());
  return StringFormatUtil.format(nomatch / getSum(),StringFormatUtil.PERCENT).toString();
}
Program: 140207
Project: 140207
Buggy source:
/** 
 * DOC scorreia Comment method "getValueFields".
 * @param value2freq
 * @return
 */
private Object getValueFields(Object[] value2freq){
  int nbFields=value2freq.length;
  if (nbFields == 2) {
    return value2freq[0];
  }
  StringBuffer buf=new StringBuffer();
  if (nbFields == 3) {
    Object year=value2freq[0];
    buf.append(format4digit(year));
    Object quarter=value2freq[1];
    buf.append(String.valueOf(quarter));
    return buf.toString();
  }
  if (nbFields == 4) {
    buf.append(format4digit(value2freq[0]));
    buf.append(format2digit(value2freq[2]));
    return buf.toString();
  }
  if (nbFields == 5) {
    Object year=value2freq[0];
    buf.append(format4digit(year));
    Object month=String.valueOf(value2freq[2]);
    buf.append(format2digit(month));
    String week=String.valueOf(value2freq[3]);
    buf.append(format1digit(week));
    return buf.toString();
  }
  if (nbFields == 6) {
    Object year=value2freq[0];
    buf.append(format4digit(year));
    Object month=String.valueOf(value2freq[2]);
    buf.append(format2digit(month));
    String day=String.valueOf(value2freq[4]);
    buf.append(format2digit(day));
    return buf.toString();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * DOC scorreia Comment method "getValueFields".
 * @param value2freq
 * @return
 */
private Object getValueFields(Object[] value2freq){
  int nbFields=value2freq.length;
  if (nbFields == 2) {
    return value2freq[0];
  }
  StringBuffer buf=new StringBuffer();
  if (nbFields == 3) {
    Object year=value2freq[0];
    buf.append(format4digit(year));
    Object quarter=value2freq[1];
    buf.append(String.valueOf(quarter));
    return buf.toString();
  }
  if (nbFields == 4) {
    buf.append(format4digit(value2freq[0]));
    buf.append(format2digit(value2freq[2]));
    return buf.toString();
  }
  if (nbFields == 5) {
    Object year=value2freq[0];
    buf.append(format4digit(year));
    Object month=String.valueOf(value2freq[2]);
    buf.append(format2digit(month));
    String week=String.valueOf(value2freq[3]);
    buf.append(format2digit(week));
    return buf.toString();
  }
  if (nbFields == 6) {
    Object year=value2freq[0];
    buf.append(format4digit(year));
    Object month=String.valueOf(value2freq[2]);
    buf.append(format2digit(month));
    String day=String.valueOf(value2freq[4]);
    buf.append(format2digit(day));
    return buf.toString();
  }
  return null;
}
Program: 140208
Project: 140208
Buggy source:
public Map<String,String> getQueryMap();

Fixed version (ground truth):
/** 
 * DOC Zqin Comment method "getQueryMap".
 * @return
 */
public Map<String,String> getQueryMap();
Program: 140209
Project: 140209
Buggy source:
public void setEnitty(ChartDataEntity entity);

Fixed version (ground truth):
/** 
 * DOC Zqin Comment method "setEnitty".
 * @param entity
 */
public void setEnitty(ChartDataEntity entity);
Program: 140210
Project: 140210
Buggy source:
public static IIndicatorNode[] buildIndicatorCategory(){
  if (indicatorCategoryNodes != null) {
    return indicatorCategoryNodes;
  }
  IndicatorCategoryNode simpleCategoryNode=new IndicatorCategoryNode(IndicatorEnum.CountsIndicatorEnum);
  IndicatorCategoryNode textCategoryNode=new IndicatorCategoryNode(IndicatorEnum.TextIndicatorEnum);
  IndicatorCategoryNode boxCategoryNode=new IndicatorCategoryNode(IndicatorEnum.BoxIIndicatorEnum);
  IndicatorEnum[] advanceIndicatorEnums=new IndicatorEnum[]{IndicatorEnum.ModeIndicatorEnum,IndicatorEnum.FrequencyIndicatorEnum};
  IndicatorCategoryNode advanceCategoryNode=new IndicatorCategoryNode("String_Node_Str",advanceIndicatorEnums);
  indicatorCategoryNodes=new IndicatorCategoryNode[]{simpleCategoryNode,textCategoryNode,boxCategoryNode,advanceCategoryNode};
  return indicatorCategoryNodes;
}

Fixed version (ground truth):
public static IIndicatorNode[] buildIndicatorCategory(){
  if (indicatorCategoryNodes != null) {
    return indicatorCategoryNodes;
  }
  IndicatorCategoryNode simpleCategoryNode=new IndicatorCategoryNode(IndicatorEnum.CountsIndicatorEnum);
  IndicatorCategoryNode textCategoryNode=new IndicatorCategoryNode(IndicatorEnum.TextIndicatorEnum);
  IndicatorCategoryNode boxCategoryNode=new IndicatorCategoryNode(IndicatorEnum.BoxIIndicatorEnum);
  IndicatorEnum[] patternFinderEnums=new IndicatorEnum[]{IndicatorEnum.PatternFreqIndicatorEnum,IndicatorEnum.PatternLowFreqIndicatorEnum};
  IndicatorCategoryNode patternFinderCategoryNode=new IndicatorCategoryNode("String_Node_Str",patternFinderEnums);
  IndicatorEnum[] advanceIndicatorEnums=new IndicatorEnum[]{IndicatorEnum.ModeIndicatorEnum,IndicatorEnum.FrequencyIndicatorEnum,IndicatorEnum.LowFrequencyIndicatorEnum};
  IndicatorCategoryNode advanceCategoryNode=new IndicatorCategoryNode("String_Node_Str",advanceIndicatorEnums);
  indicatorCategoryNodes=new IndicatorCategoryNode[]{simpleCategoryNode,textCategoryNode,boxCategoryNode,patternFinderCategoryNode,advanceCategoryNode};
  return indicatorCategoryNodes;
}
Program: 140211
Project: 140211
Buggy source:
public static Object createSliceFormData(double min,double max,double numb){
  List<SliceEntity> returnList=new ArrayList<SliceEntity>();
  DecimalFormat format=(DecimalFormat)DecimalFormat.getNumberInstance();
  format.applyPattern("String_Node_Str");
  double mod=(max - min) / numb;
  for (int i=1; i < numb + 1; i++) {
    SliceEntity entity=new SliceEntity();
    entity.setLowValue(format.format(min));
    min=min + mod;
    entity.setHighValue(format.format(min));
    returnList.add(entity);
  }
  return returnList;
}

Fixed version (ground truth):
public static Object createSliceFormData(double min,double max,double numb){
  List<SliceEntity> returnList=new ArrayList<SliceEntity>();
  double mod=(max - min) / numb;
  for (int i=1; i < numb + 1; i++) {
    SliceEntity entity=new SliceEntity();
    entity.setLowValue(StringFormatUtil.format(min,StringFormatUtil.NUMBER).toString());
    min=min + mod;
    entity.setHighValue(StringFormatUtil.format(min,StringFormatUtil.NUMBER).toString());
    returnList.add(entity);
  }
  return returnList;
}
Program: 140217
Project: 140217
Buggy source:
public IndicatorUnit(IndicatorEnum type,Indicator indicator,ColumnIndicator parentColumn){
  this.type=type;
  this.indicator=indicator;
  this.indicatorName=type.getLabel();
  this.parentColumn=parentColumn;
}

Fixed version (ground truth):
public IndicatorUnit(IndicatorEnum type,Indicator indicator,ColumnIndicator parentColumn){
  this.type=type;
  this.indicator=indicator;
  this.indicatorName=indicator.getName();
  this.parentColumn=parentColumn;
}
Program: 140218
Project: 140218
Buggy source:
/** 
 * Getter for value.
 * @return the value
 */
public Object getValue(){
  return this.value;
}

Fixed version (ground truth):
/** 
 * Getter for value.
 * @return the value
 */
public Object getValue(){
  return StringFormatUtil.format(this.value,StringFormatUtil.NUMBER);
}
Program: 140220
Project: 140220
Buggy source:
public static MenuItemEntity[] generate(EIndicatorChartType chartTableType,Analysis analysis,ChartDataEntity entity){
  IDataExplorer explorer=null;
switch (chartTableType) {
case FREQUENCE_STATISTICS:
    explorer=new FrequencyStatisticsExplorer();
  break;
case SQL_PATTERN_MATCHING:
case PATTERN_MATCHING:
explorer=new PatternExplorer();
break;
case SIMPLE_STATISTICS:
explorer=new SimpleStatisticsExplorer();
break;
case TEXT_STATISTICS:
explorer=new TextStatisticsExplorer();
break;
case SUMMARY_STATISTICS:
explorer=new SummaryStastictisExplorer();
break;
default :
}
explorer.setAnalysis(analysis);
explorer.setEnitty(entity);
Map<String,String> queryMap=explorer.getQueryMap();
List<MenuItemEntity> retrunList=new ArrayList<MenuItemEntity>();
for (String key : queryMap.keySet()) {
MenuItemEntity itemEntity=new MenuItemEntity(key,null,queryMap.get(key));
retrunList.add(itemEntity);
}
return retrunList.toArray(new MenuItemEntity[queryMap.size()]);
}

Fixed version (ground truth):
public static MenuItemEntity[] generate(EIndicatorChartType chartTableType,Analysis analysis,ChartDataEntity entity){
  IDataExplorer explorer=null;
switch (chartTableType) {
case FREQUENCE_STATISTICS:
    explorer=new FrequencyStatisticsExplorer();
  break;
case SQL_PATTERN_MATCHING:
case PATTERN_MATCHING:
explorer=new PatternExplorer();
break;
case SIMPLE_STATISTICS:
explorer=new SimpleStatisticsExplorer();
break;
case TEXT_STATISTICS:
explorer=new TextStatisticsExplorer();
break;
case SUMMARY_STATISTICS:
explorer=new SummaryStastictisExplorer();
break;
default :
}
if (explorer != null) {
explorer.setAnalysis(analysis);
explorer.setEnitty(entity);
Map<String,String> queryMap=explorer.getQueryMap();
List<MenuItemEntity> retrunList=new ArrayList<MenuItemEntity>();
for (String key : queryMap.keySet()) {
MenuItemEntity itemEntity=new MenuItemEntity(key,null,queryMap.get(key));
retrunList.add(itemEntity);
}
return retrunList.toArray(new MenuItemEntity[queryMap.size()]);
}
 else {
return new MenuItemEntity[0];
}
}
Program: 140221
Project: 140221
Buggy source:
public void modify(Object element,String property,Object value){
  TableItem item=(TableItem)element;
  SliceEntity entity=(SliceEntity)item.getData();
  if (property.equals("String_Node_Str")) {
    entity.setLowValue(value.toString());
    parameter.setBinsData(tableViewer.getInput());
  }
 else   if (property.equals("String_Node_Str")) {
    entity.setHighValue(value.toString());
    parameter.setBinsData(tableViewer.getInput());
  }
  try {
    TextFormatFactory.createLocalFormatValue(value);
    updateStatus(IStatus.OK,MSG_OK);
  }
 catch (  Exception e) {
    updateStatus(IStatus.ERROR,MSG_ONLY_REAL_NUMBER);
  }
  tableViewer.refresh();
}

Fixed version (ground truth):
public void modify(Object element,String property,Object value){
  TableItem item=(TableItem)element;
  SliceEntity entity=(SliceEntity)item.getData();
  if (property.equals("String_Node_Str")) {
    entity.setLowValue(value.toString());
    parameter.setBinsData(tableViewer.getInput());
  }
 else   if (property.equals("String_Node_Str")) {
    entity.setHighValue(value.toString());
    parameter.setBinsData(tableViewer.getInput());
  }
  if (CheckValueUtils.isRealNumberValue(value.toString())) {
    updateStatus(IStatus.OK,MSG_OK);
  }
 else {
    updateStatus(IStatus.ERROR,MSG_ONLY_REAL_NUMBER);
  }
  tableViewer.refresh();
}
Program: 140222
Project: 140222
Buggy source:
@SuppressWarnings("String_Node_Str") public Domain getUserDomian(){
  if (getBinsData() != null) {
    List<SliceEntity> tableData=(List<SliceEntity>)getBinsData();
    Domain userDomain=DomainHelper.createDomain("String_Node_Str");
    for (    SliceEntity entity : tableData) {
      try {
        double min=TextFormatFactory.createLocalFormatValue(entity.getLowValue()).doubleValue();
        double max=TextFormatFactory.createLocalFormatValue(entity.getHighValue()).doubleValue();
        RangeRestriction rangeRestriction=DomainHelper.createRealRangeRestriction(min,max);
        userDomain.getRanges().add(rangeRestriction);
      }
 catch (      Exception e) {
        log.error(e,e);
      }
    }
    return userDomain;
  }
  return DomainHelper.createContiguousClosedBinsIntoDomain("String_Node_Str",getNumOfBins(),getMinValue(),getMaxValue());
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public Domain getUserDomian(){
  if (getBinsData() != null) {
    List<SliceEntity> tableData=(List<SliceEntity>)getBinsData();
    Domain userDomain=DomainHelper.createDomain("String_Node_Str");
    for (    SliceEntity entity : tableData) {
      try {
        double min=Double.valueOf(entity.getLowValue());
        double max=Double.valueOf(entity.getHighValue());
        RangeRestriction rangeRestriction=DomainHelper.createRealRangeRestriction(min,max);
        userDomain.getRanges().add(rangeRestriction);
      }
 catch (      Exception e) {
        log.error(e,e);
      }
    }
    return userDomain;
  }
  return DomainHelper.createContiguousClosedBinsIntoDomain("String_Node_Str",getNumOfBins(),getMinValue(),getMaxValue());
}
Program: 140223
Project: 140223
Buggy source:
public void run(){
  for (  ChartWithData chartData : IndicatorChartFactory.createChart(columnIndicator,isCreate)) {
    final JFreeChart chart=chartData.getChart();
    if (chart != null) {
      Composite frameComp=toolkit.createComposite(composite,SWT.EMBEDDED);
      frameComp.setLayout(new GridLayout());
      GridData gd=new GridData();
      gd.heightHint=230;
      gd.widthHint=460;
      if (chartData.getChartType() == EIndicatorChartType.SUMMARY_STATISTICS) {
        gd=new GridData();
        gd.heightHint=500;
        gd.widthHint=150;
      }
      frameComp.setLayoutData(gd);
      Frame frame=SWT_AWT.new_Frame(frameComp);
      frame.setLayout(new java.awt.GridLayout());
      frame.add(new ChartPanel(chart));
      frame.validate();
    }
  }
}

Fixed version (ground truth):
public void run(){
  for (  ChartWithData chartData : IndicatorChartFactory.createChart(columnIndicator,isCreate)) {
    final JFreeChart chart=chartData.getChart();
    if (chart != null) {
      Composite frameComp=toolkit.createComposite(comp,SWT.EMBEDDED);
      frameComp.setLayout(new GridLayout());
      GridData gd=new GridData();
      gd.heightHint=230;
      gd.widthHint=460;
      if (chartData.getChartType() == EIndicatorChartType.SUMMARY_STATISTICS && chartData.getEnity().length == 6) {
        gd=new GridData();
        gd.heightHint=400;
        gd.widthHint=150;
      }
      frameComp.setLayoutData(gd);
      Frame frame=SWT_AWT.new_Frame(frameComp);
      frame.setLayout(new java.awt.GridLayout());
      frame.add(new ChartPanel(chart));
      frame.validate();
    }
  }
}
Program: 140226
Project: 140226
Buggy source:
static JFreeChart createChart(EIndicatorChartType chartType,IDataEntity dataset){
  CategoryDataset cDataset=(CategoryDataset)dataset;
switch (chartType) {
case FREQUENCE_STATISTICS:
    return createBarChart(chartType.getLiteral(),cDataset);
case PATTERN_MATCHING:
case SQL_PATTERN_MATCHING:
  return createStacked3DBarChart(chartType.getLiteral(),cDataset);
case SUMMARY_STATISTICS:
if (dataset instanceof BoxAndWhiskerCategoryDataset) {
  BoxAndWhiskerCategoryDataset bDataset=(BoxAndWhiskerCategoryDataset)dataset;
  return createBoxAndWhiskerChart(chartType.getLiteral(),bDataset);
}
return create3DBarChart(chartType.getLiteral(),cDataset,true);
case SIMPLE_STATISTICS:
case TEXT_STATISTICS:
return create3DBarChart(chartType.getLiteral(),cDataset,true);
default :
return null;
}
}

Fixed version (ground truth):
static JFreeChart createChart(EIndicatorChartType chartType,IDataEntity dataset){
  CategoryDataset cDataset=(CategoryDataset)dataset;
switch (chartType) {
case FREQUENCE_STATISTICS:
    return createBarChart(chartType.getLiteral(),cDataset);
case PATTERN_MATCHING:
case SQL_PATTERN_MATCHING:
  return createStacked3DBarChart(chartType.getLiteral(),cDataset);
case SUMMARY_STATISTICS:
if (dataset instanceof BoxAndWhiskerCategoryDataset) {
  BoxAndWhiskerCategoryDataset bDataset=(BoxAndWhiskerCategoryDataset)dataset;
  return createBoxAndWhiskerChart(chartType.getLiteral(),bDataset);
}
return create3DBarChart(chartType.getLiteral(),cDataset,false);
case SIMPLE_STATISTICS:
case TEXT_STATISTICS:
return create3DBarChart(chartType.getLiteral(),cDataset,true);
default :
return null;
}
}
Program: 140230
Project: 140230
Buggy source:
/** 
 * DOC scorreia Comment method "getPatterns".
 * @param indicator
 * @return the patterns or null if none has been found
 */
private List<String> getPatterns(Indicator indicator){
  List<String> patternStrings=new ArrayList<String>();
  Domain dataValidDomain=indicator.getParameters().getDataValidDomain();
  if (dataValidDomain == null) {
    return patternStrings;
  }
  EList<Pattern> patterns=dataValidDomain.getPatterns();
  for (  Pattern pattern : patterns) {
    String regexp=this.dbmsLanguage.getRegexp(pattern);
    if (regexp != null) {
      patternStrings.add(regexp);
    }
  }
  return patternStrings;
}

Fixed version (ground truth):
/** 
 * DOC scorreia Comment method "getPatterns".
 * @param indicator
 * @return the patterns or null if none has been found
 */
private List<String> getPatterns(Indicator indicator){
  List<String> patternStrings=new ArrayList<String>();
  Domain dataValidDomain=indicator.getParameters().getDataValidDomain();
  if (dataValidDomain == null) {
    return patternStrings;
  }
  EList<Pattern> patterns=dataValidDomain.getPatterns();
  for (  Pattern pattern : patterns) {
    String regexp=this.dbms().getRegexp(pattern);
    if (regexp != null) {
      patternStrings.add(regexp);
    }
  }
  return patternStrings;
}
Program: 140231
Project: 140231
Buggy source:
/** 
 * DOC scorreia Comment method "getFinalSqlStringStatement".
 * @param dataFilterExpression
 * @param whereExpression
 * @param completedSqlString
 * @return
 * @throws ParseException
 */
private String addWhereToSqlStringStatement(List<String> whereExpressions,String completedSqlString) throws ParseException {
  TypedReturnCode<String> trc=dbms().prepareQuery(completedSqlString);
  String query=trc.getObject();
  String where=dbms().buildWhereExpression(whereExpressions);
  if (where != null && where.trim().length() != 0) {
    query=dbms().addWhereToStatement(query,where);
  }
  query=dbms().finalizeQuery(query);
  return query;
}

Fixed version (ground truth):
/** 
 * DOC scorreia Comment method "getFinalSqlStringStatement".
 * @param dataFilterExpression
 * @param whereExpression
 * @param completedSqlString
 * @return
 * @throws ParseException
 */
private String addWhereToSqlStringStatement(List<String> whereExpressions,String completedSqlString) throws ParseException {
  return dbms().addWhereToSqlStringStatement(completedSqlString,whereExpressions);
}
Program: 140232
Project: 140232
Buggy source:
/** 
 * DOC scorreia Comment method "getCompletedString".
 * @param indicator
 * @param sqlExpression
 * @param colName
 * @param table
 * @param whereExpression
 * @throws AnalysisExecutionException
 */
private String getCompletedStringForQuantiles(Indicator indicator,Expression sqlExpression,String colName,String table,List<String> whereExpression) throws AnalysisExecutionException {
  String catalogOrSchema=getCatalogOrSchemaName(indicator.getAnalyzedElement());
  long count=getCount(cachedAnalysis,colName,table,catalogOrSchema,whereExpression);
  if (count == -1) {
    throw new AnalysisExecutionException("String_Node_Str" + dbms().toQualifiedName(catalogOrSchema,null,colName));
  }
  Long midleCount=getLimitFirstArg(indicator,count);
  Integer nbRow=getNbReturnedRows(indicator,count);
  return MessageFormat.format(sqlExpression.getBody(),colName,table,String.valueOf(midleCount),String.valueOf(nbRow));
}

Fixed version (ground truth):
/** 
 * DOC scorreia Comment method "getCompletedString".
 * @param indicator
 * @param sqlExpression
 * @param colName
 * @param table
 * @param whereExpression
 * @throws AnalysisExecutionException
 */
private String getCompletedStringForQuantiles(Indicator indicator,Expression sqlExpression,String colName,String table,List<String> whereExpression) throws AnalysisExecutionException {
  String catalogOrSchema=getCatalogOrSchemaName(indicator.getAnalyzedElement());
  long count=getCount(cachedAnalysis,colName,table,catalogOrSchema,whereExpression);
  if (count == -1) {
    throw new AnalysisExecutionException("String_Node_Str" + dbms().toQualifiedName(catalogOrSchema,null,colName));
  }
  if (count == 0) {
    this.errorMessage="String_Node_Str" + dbms().toQualifiedName(catalogOrSchema,null,colName);
    throw new AnalysisExecutionException(errorMessage);
  }
  Long midleCount=getLimitFirstArg(indicator,count);
  Integer nbRow=getNbReturnedRows(indicator,count);
  long nPlusSkip=midleCount + nbRow;
  return MessageFormat.format(sqlExpression.getBody(),colName,table,String.valueOf(midleCount),String.valueOf(nbRow),nPlusSkip);
}
Program: 140233
Project: 140233
Buggy source:
public String addWhereToSqlStringStatement(String completedSqlString,List<String> whereExpressions) throws ParseException {
  TypedReturnCode<String> trc=this.prepareQuery(completedSqlString);
  String query=trc.getObject();
  String where=this.buildWhereExpression(whereExpressions);
  if (where != null && where.trim().length() != 0) {
    query=this.addWhereToStatement(query,where);
  }
  this.finalizeQuery(query);
  return query;
}

Fixed version (ground truth):
public String addWhereToSqlStringStatement(String completedSqlString,List<String> whereExpressions) throws ParseException {
  TypedReturnCode<String> trc=this.prepareQuery(completedSqlString);
  String query=trc.getObject();
  String where=this.buildWhereExpression(whereExpressions);
  if ((where != null && where.trim().length() != 0) || completedSqlString.contains(AND_WHERE_CLAUSE)) {
    query=this.addWhereToStatement(query,where);
  }
  this.finalizeQuery(query);
  return query;
}
Program: 140235
Project: 140235
Buggy source:
/** 
 * DOC scorreia Comment method "isTooComplexForZql".
 * @param statement
 * @return
 */
private boolean isTooComplexForZql(String statement){
  return statement.contains("String_Node_Str") && statement.contains("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * DOC scorreia Comment method "isTooComplexForZql".
 * @param statement
 * @return
 */
private boolean isTooComplexForZql(String statement){
  return statement.contains("String_Node_Str") && statement.contains("String_Node_Str") || statement.contains(AND_WHERE_CLAUSE);
}
Program: 140236
Project: 140236
Buggy source:
public String addWhereToSqlStringStatement(String completedSqlString,List<String> whereExpressions) throws ParseException {
  TypedReturnCode<String> trc=this.prepareQuery(completedSqlString);
  String query=trc.getObject();
  String where=this.buildWhereExpression(whereExpressions);
  if (where != null && where.trim().length() != 0) {
    query=this.addWhereToStatement(query,where);
  }
  return query;
}

Fixed version (ground truth):
public String addWhereToSqlStringStatement(String completedSqlString,List<String> whereExpressions) throws ParseException {
  TypedReturnCode<String> trc=this.prepareQuery(completedSqlString);
  String query=trc.getObject();
  String where=this.buildWhereExpression(whereExpressions);
  if (where != null && where.trim().length() != 0) {
    query=this.addWhereToStatement(query,where);
  }
  this.finalizeQuery(query);
  return query;
}
Program: 140238
Project: 140238
Buggy source:
@Override protected String replaceUnsupportedQuotes(String safeZqlString){
  return safeZqlString.replace("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Override protected String replaceUnsupportedQuotes(String safeZqlString){
  return safeZqlString.replace(MYSQL_IDENTIFIER_QUOTE,"String_Node_Str");
}
Program: 140239
Project: 140239
Buggy source:
/** 
 * DOC qzhang Comment method "doSetInput".
 */
public void doSetInput(){
  List<CatalogIndicator> indicatorList=null;
  if (this.connectionAnalysis.getResults().getIndicators().size() > 0) {
    ConnectionIndicator conIndicator=(ConnectionIndicator)connectionAnalysis.getResults().getIndicators().get(0);
    indicatorList=conIndicator.getCatalogIndicators();
  }
 else {
    indicatorList=new ArrayList<CatalogIndicator>();
  }
  statisticalViewer.setInput(indicatorList);
  refreshSumSection();
}

Fixed version (ground truth):
/** 
 * DOC qzhang Comment method "doSetInput".
 */
public void doSetInput(){
  List<CatalogIndicator> indicatorList=null;
  if (this.connectionAnalysis.getResults().getIndicators().size() > 0) {
    ConnectionIndicator conIndicator=(ConnectionIndicator)connectionAnalysis.getResults().getIndicators().get(0);
    indicatorList=conIndicator.getCatalogIndicators();
    if (indicatorList.size() == 0) {
      statisticalViewer.setInput(conIndicator.getSchemaIndicators());
    }
 else {
      List<SchemaIndicator> schemaIndicators=new ArrayList<SchemaIndicator>();
      schemaIndicators.addAll(conIndicator.getSchemaIndicators());
      schemaIndicators.addAll(indicatorList);
      statisticalViewer.setInput(schemaIndicators);
    }
  }
 else {
    indicatorList=new ArrayList<CatalogIndicator>();
  }
  refreshSumSection();
}
Program: 140241
Project: 140241
Buggy source:
/** 
 * Open a compare editor UI, will clear the information which hasn't relationship with current selected level first(For example: if we compare the catalog level, will clear it's table(view) from every catalog), then will compare current level object.
 * @param rightResource
 * @param oldDataProviderFile
 * @return
 * @throws ReloadCompareException
 */
private DiffModel openDiffCompareEditor(Resource leftResource,Resource rightResource,Map<String,Object> options) throws ReloadCompareException {
  MatchModel match=null;
  try {
    match=MatchService.doResourceMatch(leftResource,rightResource,options);
  }
 catch (  InterruptedException e) {
    throw new ReloadCompareException(e);
  }
  final DiffModel diff=DiffService.doDiff(match);
  final ModelInputSnapshot snapshot=DiffFactory.eINSTANCE.createModelInputSnapshot();
  snapshot.setDate(Calendar.getInstance().getTime());
  snapshot.setMatch(match);
  snapshot.setDiff(diff);
  IFile createDiffResourceFile=DQStructureComparer.getDiffResourceFile();
  try {
    ModelUtils.save(snapshot,createDiffResourceFile.getFullPath().toString());
  }
 catch (  IOException e) {
    throw new ReloadCompareException(e);
  }
  new ModelCompareEditorLauncher().open(createDiffResourceFile.getLocation());
  return diff;
}

Fixed version (ground truth):
/** 
 * Open a compare editor UI, will clear the information which hasn't relationship with current selected level first(For example: if we compare the catalog level, will clear it's table(view) from every catalog), then will compare current level object.
 * @param rightResource
 * @param oldDataProviderFile
 * @return
 * @throws ReloadCompareException
 */
private DiffModel openDiffCompareEditor(Resource leftResource,Resource rightResource,Map<String,Object> options) throws ReloadCompareException {
  MatchModel match=null;
  try {
    match=MatchService.doResourceMatch(leftResource,rightResource,options);
  }
 catch (  InterruptedException e) {
    throw new ReloadCompareException(e);
  }
  final DiffModel diff=DiffService.doDiff(match);
  final ModelInputSnapshot snapshot=DiffFactory.eINSTANCE.createModelInputSnapshot();
  snapshot.setDate(Calendar.getInstance().getTime());
  snapshot.setMatch(match);
  snapshot.setDiff(diff);
  IFile createDiffResourceFile=DQStructureComparer.getDiffResourceFile();
  try {
    final String fullPath=createDiffResourceFile.getLocation().toOSString();
    ModelUtils.save(snapshot,fullPath);
  }
 catch (  IOException e) {
    throw new ReloadCompareException(e);
  }
  new ModelCompareEditorLauncher().open(createDiffResourceFile.getLocation());
  return diff;
}
Program: 140242
Project: 140242
Buggy source:
/** 
 */
private void updateButtonState(){
  boolean complete=true;
  complete&=(this.connectionURL != null && this.connectionURL.trim().length() > 0 && this.userid != null && this.userid.trim().length() > 0);
  if (checkButton != null) {
    checkButton.setEnabled(complete);
  }
  setPageComplete(complete);
}

Fixed version (ground truth):
/** 
 */
private void updateButtonState(){
  boolean complete=true;
  complete&=(this.connectionURL != null && this.connectionURL.trim().length() > 0 && ((this.userid != null && this.userid.trim().length() > 0) || SupportDBUrlType.MSSQLDEFAULTURL.getDBKey().equals(SupportDBUrlStore.getInstance().getDBPameterProperties(connectionURL).getProperty(org.talend.dq.PluginConstant.DBTYPE_PROPERTY))));
  if (checkButton != null) {
    checkButton.setEnabled(complete);
  }
  setPageComplete(complete);
}
Program: 140243
Project: 140243
Buggy source:
/** 
 * DOC scorreia Comment method "getQualifiedName".
 * @param tdDataProvider
 * @return
 */
private String getTableQualifiedName(TdDataProvider tdDataProvider){
  DbmsLanguage dbmsLanguage=DbmsLanguageFactory.createDbmsLanguage(tdDataProvider);
  Package catalogOrSchema=ColumnSetHelper.getParentCatalogOrSchema(table);
  String schemaname=catalogOrSchema != null ? catalogOrSchema.getName() : null;
  return dbmsLanguage.toQualifiedName(null,schemaname,table.getName());
}

Fixed version (ground truth):
/** 
 * DOC scorreia Comment method "getQualifiedName".
 * @param tdDataProvider
 * @return
 */
private String getTableQualifiedName(TdDataProvider tdDataProvider){
  DbmsLanguage dbmsLanguage=DbmsLanguageFactory.createDbmsLanguage(tdDataProvider);
  Package catalogOrSchema=ColumnSetHelper.getParentCatalogOrSchema(table);
  if (catalogOrSchema == null) {
    return table.getName();
  }
  String catalogName=null;
  String schemaName=null;
  if (catalogOrSchema != null && RelationalPackage.eINSTANCE.getTdSchema().equals(catalogOrSchema.eClass())) {
    schemaName=catalogOrSchema.getName();
    TdCatalog parentCatalog=CatalogHelper.getParentCatalog(catalogOrSchema);
    if (parentCatalog != null) {
      catalogName=parentCatalog.getName();
    }
  }
 else {
    catalogName=catalogOrSchema.getName();
  }
  return dbmsLanguage.toQualifiedName(catalogName,schemaName,table.getName());
}
Program: 140244
Project: 140244
Buggy source:
@Override public void run(){
  ChangePerspectiveAction perspectiveAction=new ChangePerspectiveAction(PluginConstant.SE_ID);
  perspectiveAction.run();
  SQLExplorerPlugin default1=SQLExplorerPlugin.getDefault();
  Collection<Alias> aliases=default1.getAliasManager().getAliases();
  TdDataProvider tdDataProvider=DataProviderHelper.getDataProvider(table);
  TypedReturnCode<TdProviderConnection> tdPc=DataProviderHelper.getTdProviderConnection(tdDataProvider);
  TdProviderConnection providerConnection=tdPc.getObject();
  String url=providerConnection.getConnectionString();
  for (  Alias alias : aliases) {
    if (alias.getUrl().equals(url)) {
      String qualifiedName=getTableQualifiedName(tdDataProvider);
      String query="String_Node_Str" + qualifiedName;
      SQLEditorInput input=new SQLEditorInput("String_Node_Str" + SQLExplorerPlugin.getDefault().getEditorSerialNo() + "String_Node_Str");
      input.setUser(alias.getDefaultUser());
      try {
        IWorkbenchPage page=SQLExplorerPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
        SQLEditor editorPart=(SQLEditor)page.openEditor((IEditorInput)input,SQLEditor.class.getName());
        editorPart.setText(query);
        ExecSQLAction execSQLAction=new ExecSQLAction(editorPart);
        execSQLAction.run();
      }
 catch (      PartInitException e) {
        e.printStackTrace();
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  ChangePerspectiveAction perspectiveAction=new ChangePerspectiveAction(PluginConstant.SE_ID);
  perspectiveAction.run();
  SQLExplorerPlugin default1=SQLExplorerPlugin.getDefault();
  Collection<Alias> aliases=default1.getAliasManager().getAliases();
  TdDataProvider tdDataProvider=DataProviderHelper.getDataProvider(table);
  TypedReturnCode<TdProviderConnection> tdPc=DataProviderHelper.getTdProviderConnection(tdDataProvider);
  TdProviderConnection providerConnection=tdPc.getObject();
  String url=providerConnection.getConnectionString();
  for (  Alias alias : aliases) {
    if (alias.getUrl().equals(url)) {
      String qualifiedName=getTableQualifiedName(tdDataProvider);
      String query="String_Node_Str" + qualifiedName;
      SQLEditorInput input=new SQLEditorInput("String_Node_Str" + SQLExplorerPlugin.getDefault().getEditorSerialNo() + "String_Node_Str");
      input.setUser(alias.getDefaultUser());
      try {
        IWorkbenchPage page=SQLExplorerPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
        SQLEditor editorPart=(SQLEditor)page.openEditor((IEditorInput)input,SQLEditor.class.getName());
        editorPart.setText(query);
        ExecSQLAction execSQLAction=new ExecSQLAction(editorPart);
        execSQLAction.run();
      }
 catch (      PartInitException e) {
        log.error(e,e);
      }
    }
  }
}