nus-yam/ex-repair huggingface dataset:
Program: 140245
Project: 140245
Buggy source:
/** 
 * DOC qzhang Comment method "getClassDriver".
 * @param driverClassName
 * @return
 * @throws IllegalAccessException
 * @throws InstantiationException
 * @throws ClassNotFoundException
 */
public static Driver getClassDriver(String driverClassName) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
  SQLExplorerPlugin sqlExplorerPlugin=SQLExplorerPlugin.getDefault();
  Driver driver=null;
  if (sqlExplorerPlugin != null) {
    net.sourceforge.sqlexplorer.dbproduct.DriverManager driverModel=sqlExplorerPlugin.getDriverModel();
    try {
      Collection<ManagedDriver> drivers=driverModel.getDrivers();
      for (      ManagedDriver managedDriver : drivers) {
        LinkedList<String> jars=managedDriver.getJars();
        for (        String string : jars) {
          File file=new File(string);
          if (file.exists()) {
            MyURLClassLoader cl;
            cl=new MyURLClassLoader(file.toURL());
            try {
              Class clazz=cl.findClass(driverClassName);
              if (clazz != null) {
                driver=(Driver)clazz.newInstance();
                break;
              }
            }
 catch (            ClassNotFoundException e) {
            }
          }
        }
      }
    }
 catch (    MalformedURLException e) {
    }
  }
  if (driver == null) {
    driver=(Driver)Class.forName(driverClassName).newInstance();
  }
  return driver;
}

Fixed version (ground truth):
/** 
 * DOC qzhang Comment method "getClassDriver".
 * @param driverClassName
 * @return
 * @throws IllegalAccessException
 * @throws InstantiationException
 * @throws ClassNotFoundException
 */
public static Driver getClassDriver(String driverClassName) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
  SQLExplorerPlugin sqlExplorerPlugin=SQLExplorerPlugin.getDefault();
  Driver driver=null;
  if (sqlExplorerPlugin != null) {
    net.sourceforge.sqlexplorer.dbproduct.DriverManager driverModel=sqlExplorerPlugin.getDriverModel();
    try {
      Collection<ManagedDriver> drivers=driverModel.getDrivers();
      for (      ManagedDriver managedDriver : drivers) {
        LinkedList<String> jars=managedDriver.getJars();
        List<URL> urls=new ArrayList<URL>();
        for (int i=0; i < jars.size(); i++) {
          File file=new File(jars.get(i));
          if (file.exists()) {
            urls.add(file.toURL());
          }
        }
        if (!urls.isEmpty()) {
          try {
            MyURLClassLoader cl;
            cl=new MyURLClassLoader(urls.toArray(new URL[0]));
            Class clazz=cl.findClass(driverClassName);
            if (clazz != null) {
              driver=(Driver)clazz.newInstance();
              return driver;
            }
          }
 catch (          ClassNotFoundException e) {
          }
        }
      }
    }
 catch (    MalformedURLException e) {
    }
  }
  if (driver == null) {
    driver=(Driver)Class.forName(driverClassName).newInstance();
  }
  return driver;
}
Program: 140246
Project: 140246
Buggy source:
private String extract(DateGrain dateGrain,String colName){
  if (is(MYSQL)) {
    return dateGrain.getName() + surroundWith('(',colName,')');
  }
  if (is(ORACLE)) {
    String toNumberToChar="String_Node_Str";
switch (dateGrain.getValue()) {
case DateGrain.DAY_VALUE:
      return toNumberToChar + colName + "String_Node_Str";
case DateGrain.WEEK_VALUE:
    return toNumberToChar + colName + "String_Node_Str";
case DateGrain.MONTH_VALUE:
  return toNumberToChar + colName + "String_Node_Str";
case DateGrain.QUARTER_VALUE:
return toNumberToChar + colName + "String_Node_Str";
case DateGrain.YEAR_VALUE:
return toNumberToChar + colName + "String_Node_Str";
default :
}
}
if (is(MSSQL)) {
return "String_Node_Str" + dateGrain.getName() + "String_Node_Str"+ colName+ "String_Node_Str";
}
if (is(POSTGRESQL)) {
return "String_Node_Str" + dateGrain + from()+ colName+ "String_Node_Str";
}
return "String_Node_Str" + dateGrain + from()+ colName+ "String_Node_Str";
}

Fixed version (ground truth):
private String extract(DateGrain dateGrain,String colName){
  if (is(MYSQL) || is(DB2)) {
    return dateGrain.getName() + surroundWith('(',colName,')');
  }
  if (is(ORACLE)) {
    String toNumberToChar="String_Node_Str";
switch (dateGrain.getValue()) {
case DateGrain.DAY_VALUE:
      return toNumberToChar + colName + "String_Node_Str";
case DateGrain.WEEK_VALUE:
    return toNumberToChar + colName + "String_Node_Str";
case DateGrain.MONTH_VALUE:
  return toNumberToChar + colName + "String_Node_Str";
case DateGrain.QUARTER_VALUE:
return toNumberToChar + colName + "String_Node_Str";
case DateGrain.YEAR_VALUE:
return toNumberToChar + colName + "String_Node_Str";
default :
}
}
if (is(MSSQL)) {
return "String_Node_Str" + dateGrain.getName() + "String_Node_Str"+ colName+ "String_Node_Str";
}
if (is(POSTGRESQL)) {
return "String_Node_Str" + dateGrain + from()+ colName+ "String_Node_Str";
}
return "String_Node_Str" + dateGrain + from()+ colName+ "String_Node_Str";
}
Program: 140247
Project: 140247
Buggy source:
private static String getToolTipMsg(Indicator indicator,String currentValue){
  IndicatorEnum indicatorEnum=IndicatorEnum.findIndicatorEnum(indicator.eClass());
  StringBuilder msg=new StringBuilder();
switch (indicatorEnum) {
case ModeIndicatorEnum:
    String expectedValue=IndicatorHelper.getExpectedValue(indicator);
  Boolean ignoreCaseOption=IndicatorHelper.ignoreCaseOption(indicator) == null ? false : IndicatorHelper.ignoreCaseOption(indicator);
boolean areSame=StringUtils.equals(currentValue,expectedValue) || (ignoreCaseOption && StringUtils.equalsIgnoreCase(currentValue,expectedValue));
if (!areSame) {
msg.append("String_Node_Str" + expectedValue + "String_Node_Str");
}
break;
default :
String[] dataThreshold=IndicatorHelper.getDataThreshold(indicator);
if (dataThreshold != null) {
String range=getRange(currentValue,dataThreshold);
if (range != null) {
msg.append("String_Node_Str" + range);
}
}
String[] indicatorThreshold=IndicatorHelper.getIndicatorThreshold(indicator);
if (indicatorThreshold != null) {
if (msg.length() != 0) {
msg.append('\n');
}
String range=getRange(currentValue,indicatorThreshold);
if (range != null) {
msg.append("String_Node_Str" + range);
}
}
break;
}
return msg.length() == 0 ? null : msg.toString();
}

Fixed version (ground truth):
private static String getToolTipMsg(Indicator indicator,String currentValue){
  IndicatorEnum indicatorEnum=IndicatorEnum.findIndicatorEnum(indicator.eClass());
  StringBuilder msg=new StringBuilder();
switch (indicatorEnum) {
case ModeIndicatorEnum:
    String expectedValue=IndicatorHelper.getExpectedValue(indicator);
  if (expectedValue != null) {
    Boolean ignoreCaseOption=IndicatorHelper.ignoreCaseOption(indicator) == null ? false : IndicatorHelper.ignoreCaseOption(indicator);
    boolean areSame=StringUtils.equals(currentValue,expectedValue) || (ignoreCaseOption && StringUtils.equalsIgnoreCase(currentValue,expectedValue));
    if (!areSame) {
      msg.append("String_Node_Str" + expectedValue + "String_Node_Str");
    }
  }
break;
default :
String[] dataThreshold=IndicatorHelper.getDataThreshold(indicator);
if (dataThreshold != null) {
String range=getRange(currentValue,dataThreshold);
if (range != null) {
msg.append("String_Node_Str" + range);
}
}
String[] indicatorThreshold=IndicatorHelper.getIndicatorThreshold(indicator);
if (indicatorThreshold != null) {
if (msg.length() != 0) {
msg.append('\n');
}
String range=getRange(currentValue,indicatorThreshold);
if (range != null) {
msg.append("String_Node_Str" + range);
}
}
break;
}
return msg.length() == 0 ? null : msg.toString();
}
Program: 140249
Project: 140249
Buggy source:
/** 
 * Method "parseQuery".
 * @param queryString
 * @return the parsed query. When boolean isOk() is true, this means that the finalizeQuery must called (for examplefor handling the MySQL LIMIT clause). When false, calling finalizeQuery() is not needed (but it won't hurt to call it).
 * @throws ParseException
 */
private ZQuery parseQuery(final String queryString) throws ParseException {
  String safeZqlString=queryString;
  safeZqlString=closeStatement(safeZqlString);
  ByteArrayInputStream byteArrayInputStream=new ByteArrayInputStream(safeZqlString.getBytes());
  ZqlParser parser=getZqlParser();
  parser.initParser(byteArrayInputStream);
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + safeZqlString);
  }
  ZQuery zQuery=(ZQuery)parser.readStatement();
  return zQuery;
}

Fixed version (ground truth):
/** 
 * Method "parseQuery".
 * @param queryString
 * @return the parsed query. When boolean isOk() is true, this means that the finalizeQuery must called (for examplefor handling the MySQL LIMIT clause). When false, calling finalizeQuery() is not needed (but it won't hurt to call it).
 * @throws ParseException
 */
private ZQuery parseQuery(final String queryString) throws ParseException {
  invalidZqlQualifiedTableName=get2dotTableName(queryString);
  String safeZqlString=invalidZqlQualifiedTableName != null ? queryString.replace(invalidZqlQualifiedTableName,TMP_TABLE_NAME) : queryString;
  safeZqlString=replaceUnsupportedQuotes(safeZqlString);
  safeZqlString=closeStatement(safeZqlString);
  ByteArrayInputStream byteArrayInputStream=new ByteArrayInputStream(safeZqlString.getBytes());
  ZqlParser parser=getZqlParser();
  parser.initParser(byteArrayInputStream);
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + safeZqlString);
  }
  ZQuery zQuery=(ZQuery)parser.readStatement();
  return zQuery;
}
Program: 140250
Project: 140250
Buggy source:
/** 
 * Method "quote".
 * @param sqlIdentifier the SQL identifier to quote
 * @return the sqlIdentifier quoted.
 */
public String quote(String sqlIdentifier){
  if (is(MYSQL)) {
    return 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){
  return dbQuoteString + sqlIdentifier + dbQuoteString;
}
Program: 140251
Project: 140251
Buggy source:
public String toQualifiedName(String catalog,String schema,String table){
  if (is(MSSQL)) {
    catalog="String_Node_Str";
  }
  if (is(SYBASE_ASE)) {
    catalog="String_Node_Str";
  }
  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){
  if (is(MSSQL)) {
    schema=quote("String_Node_Str");
  }
  if (is(SYBASE_ASE)) {
    schema=quote("String_Node_Str");
  }
  StringBuffer qualName=new StringBuffer();
  if (catalog != null && catalog.length() > 0 && !is(POSTGRESQL)) {
    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();
}
Program: 140252
Project: 140252
Buggy source:
public String getDbQuoteString(){
  return this.dbQuoteString;
}

Fixed version (ground truth):
/** 
 * Method "getDbQuoteString".
 * @return the quote identifier string set in this object.
 */
public String getDbQuoteString(){
  return this.dbQuoteString;
}
Program: 140253
Project: 140253
Buggy source:
/** 
 * Method "finalizeQuery" must be called after prepareQuery().
 * @param query the query to finalize
 * @return the final query.
 */
public String finalizeQuery(String query){
  StringBuffer buf=new StringBuffer();
  buf.append(query.toString());
  if (containsLimitClause) {
    buf.append("String_Node_Str" + withoutLimit[1]);
  }
  containsLimitClause=false;
  return buf.toString();
}

Fixed version (ground truth):
/** 
 * Method "finalizeQuery" must be called after prepareQuery().
 * @param query the query to finalize
 * @return the final query.
 */
public String finalizeQuery(String query){
  StringBuffer buf=new StringBuffer();
  buf.append(query.toString());
  if (containsLimitClause) {
    buf.append("String_Node_Str" + withoutLimit[1]);
  }
  containsLimitClause=false;
  String fquery=buf.toString();
  if (invalidZqlQualifiedTableName != null) {
    return fquery.replace(TMP_TABLE_NAME,this.invalidZqlQualifiedTableName);
  }
  return fquery;
}
Program: 140254
Project: 140254
Buggy source:
/** 
 * Method "getQuoteIdentifier".
 * @return hard coded quote identifier string.
 */
public String getQuoteIdentifier(){
  if (is(MYSQL)) {
    return "String_Node_Str";
  }
  if (is(ORACLE)) {
    return "String_Node_Str";
  }
  if (is(POSTGRESQL)) {
    return "String_Node_Str";
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Method "getQuoteIdentifier" returns the hard coded quote identifier string. You should call  {@link #getDbQuoteString()} instead.
 * @return hard coded quote identifier string.
 */
public String getQuoteIdentifier(){
  if (is(MYSQL)) {
    return "String_Node_Str";
  }
  if (is(ORACLE)) {
    return "String_Node_Str";
  }
  if (is(POSTGRESQL)) {
    return "String_Node_Str";
  }
  return "String_Node_Str";
}
Program: 140255
Project: 140255
Buggy source:
public Properties getDBPameterProperties(String connectionStr){
  Properties paramProperties=new Properties();
  String matchSubStr=connectionStr.substring(0,8);
  Set<Object> s=PROP.keySet();
  Iterator<Object> it=s.iterator();
  while (it.hasNext()) {
    String id=(String)it.next();
    String value=PROP.getProperty(id);
    if (value.contains(matchSubStr)) {
      paramProperties.setProperty(PluginConstant.DBTYPE_PROPERTY,id);
      MessageFormat mf=new MessageFormat(value);
      Object[] parseResult=mf.parse(connectionStr,new ParsePosition(0));
      paramProperties.setProperty(PluginConstant.HOSTNAME_PROPERTY,(String)parseResult[0]);
      paramProperties.setProperty(PluginConstant.PORT_PROPERTY,(String)parseResult[1]);
      break;
    }
  }
  return paramProperties;
}

Fixed version (ground truth):
public Properties getDBPameterProperties(String connectionStr){
  Properties paramProperties=new Properties();
  String matchSubStr=connectionStr.substring(0,8);
  Set<Object> s=PROP.keySet();
  Iterator<Object> it=s.iterator();
  while (it.hasNext()) {
    String id=(String)it.next();
    String value=PROP.getProperty(id);
    if (value.contains(matchSubStr)) {
      paramProperties.setProperty(PluginConstant.DBTYPE_PROPERTY,id);
      MessageFormat mf=new MessageFormat(value);
      Object[] parseResult=mf.parse(connectionStr,new ParsePosition(0));
      if (parseResult != null) {
        paramProperties.setProperty(PluginConstant.HOSTNAME_PROPERTY,(String)parseResult[0]);
        paramProperties.setProperty(PluginConstant.PORT_PROPERTY,(String)parseResult[1]);
        break;
      }
    }
  }
  return paramProperties;
}
Program: 140258
Project: 140258
Buggy source:
public String isNotBlank(String colName){
  if (is(MSSQL)) {
    return "String_Node_Str" + colName + "String_Node_Str"+ notEqual()+ "String_Node_Str";
  }
  if (is(ORACLE)) {
    return "String_Node_Str" + colName + "String_Node_Str"+ isNull();
  }
  return "String_Node_Str" + colName + "String_Node_Str"+ notEqual()+ "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Method "isNotBlank".
 * @param colName a column name
 * @return the expression saying that the given column is not blank.
 */
public String isNotBlank(String colName){
  if (is(MSSQL)) {
    return "String_Node_Str" + colName + "String_Node_Str"+ notEqual()+ "String_Node_Str";
  }
  if (is(ORACLE)) {
    return "String_Node_Str" + colName + "String_Node_Str"+ isNotNull();
  }
  return "String_Node_Str" + colName + "String_Node_Str"+ notEqual()+ "String_Node_Str";
}
Program: 140259
Project: 140259
Buggy source:
/** 
 * Method "addWhereToStatement".
 * @param statement a statement already prepared for parsing
 * @param whereClause
 * @return the new statement
 */
public String addWhereToStatement(String statement,String whereClause){
  try {
    ZQuery query=this.parseQuery(statement);
    if (whereClause != null) {
      if (StringUtils.isNotBlank(whereClause)) {
        ZqlParser filterParser=new ZqlParser();
        filterParser.initParser(new ByteArrayInputStream(whereClause.getBytes()));
        ZExp currentWhere=query.getWhere();
        ZExp whereExpression=filterParser.readExpression();
        if (currentWhere != null && whereExpression != null) {
          ZExpression finalWhereExpression=new ZExpression(and(),currentWhere,whereExpression);
          query.addWhere(finalWhereExpression);
        }
 else {
          if (whereExpression != null) {
            query.addWhere(whereExpression);
          }
        }
      }
    }
    return query.toString();
  }
 catch (  ParseException e) {
    log.error(e,e);
  }
  String finalQuery=statement + where() + whereClause;
  log.error("String_Node_Str" + finalQuery);
  return finalQuery;
}

Fixed version (ground truth):
/** 
 * Method "addWhereToStatement".
 * @param statement a statement already prepared for parsing
 * @param whereClause
 * @return the new statement
 */
public String addWhereToStatement(String statement,String whereClause){
  try {
    ZQuery query=this.parseQuery(statement);
    if (whereClause != null) {
      if (StringUtils.isNotBlank(whereClause)) {
        ZqlParser filterParser=new ZqlParser();
        filterParser.initParser(new ByteArrayInputStream(whereClause.getBytes()));
        ZExp currentWhere=query.getWhere();
        ZExp whereExpression=filterParser.readExpression();
        if (currentWhere != null && whereExpression != null) {
          ZExpression finalWhereExpression=new ZExpression(and(),currentWhere,whereExpression);
          query.addWhere(finalWhereExpression);
        }
 else {
          if (whereExpression != null) {
            query.addWhere(whereExpression);
          }
        }
      }
    }
    return query.toString();
  }
 catch (  ParseException e) {
    log.warn(e,e);
  }
  String op=statement.toUpperCase().contains(where()) ? and() : where();
  String finalQuery=statement + op + whereClause;
  log.warn("String_Node_Str" + finalQuery);
  return finalQuery;
}
Program: 140261
Project: 140261
Buggy source:
private static String getToolTipMsg(Indicator indicator,String currentValue){
  IndicatorEnum indicatorEnum=IndicatorEnum.findIndicatorEnum(indicator.eClass());
  StringBuilder msg=new StringBuilder();
switch (indicatorEnum) {
case ModeIndicatorEnum:
    String expectedValue=IndicatorHelper.getExpectedValue(indicator);
  boolean areSame=StringUtils.equals(currentValue,expectedValue) || (IndicatorHelper.ignoreCaseOption(indicator) && StringUtils.equalsIgnoreCase(currentValue,expectedValue));
if (!areSame) {
  msg.append("String_Node_Str" + expectedValue + "String_Node_Str");
}
break;
default :
String[] dataThreshold=IndicatorHelper.getDataThreshold(indicator);
if (dataThreshold != null) {
String range=getRange(currentValue,dataThreshold);
if (range != null) {
msg.append("String_Node_Str" + range);
}
}
String[] indicatorThreshold=IndicatorHelper.getIndicatorThreshold(indicator);
if (indicatorThreshold != null) {
if (msg.length() != 0) {
msg.append('\n');
}
String range=getRange(currentValue,indicatorThreshold);
if (range != null) {
msg.append("String_Node_Str" + range);
}
}
break;
}
return msg.length() == 0 ? null : msg.toString();
}

Fixed version (ground truth):
private static String getToolTipMsg(Indicator indicator,String currentValue){
  IndicatorEnum indicatorEnum=IndicatorEnum.findIndicatorEnum(indicator.eClass());
  StringBuilder msg=new StringBuilder();
switch (indicatorEnum) {
case ModeIndicatorEnum:
    String expectedValue=IndicatorHelper.getExpectedValue(indicator);
  Boolean ignoreCaseOption=IndicatorHelper.ignoreCaseOption(indicator) == null ? false : IndicatorHelper.ignoreCaseOption(indicator);
boolean areSame=StringUtils.equals(currentValue,expectedValue) || (ignoreCaseOption && StringUtils.equalsIgnoreCase(currentValue,expectedValue));
if (!areSame) {
msg.append("String_Node_Str" + expectedValue + "String_Node_Str");
}
break;
default :
String[] dataThreshold=IndicatorHelper.getDataThreshold(indicator);
if (dataThreshold != null) {
String range=getRange(currentValue,dataThreshold);
if (range != null) {
msg.append("String_Node_Str" + range);
}
}
String[] indicatorThreshold=IndicatorHelper.getIndicatorThreshold(indicator);
if (indicatorThreshold != null) {
if (msg.length() != 0) {
msg.append('\n');
}
String range=getRange(currentValue,indicatorThreshold);
if (range != null) {
msg.append("String_Node_Str" + range);
}
}
break;
}
return msg.length() == 0 ? null : msg.toString();
}
Program: 140262
Project: 140262
Buggy source:
private static void removeReportComponent(ImpactNode[] impactNodes){
  ReportsSwitch<TdReport> mySwitch=new ReportsSwitch<TdReport>(){
    public TdReport caseTdReport(    TdReport object){
      return object;
    }
  }
;
  TdReport report=null;
  for (  ImpactNode node : impactNodes) {
    report=mySwitch.doSwitch(node.getNodeElement());
    if (report != null && node.getChildren().length > 0) {
      List<Analysis> anaList=new ArrayList<Analysis>();
      for (      ModelElement element : node.getChildren()) {
        anaList.add((Analysis)element);
      }
      ReportHelper.removeAnalyses(report,anaList);
    }
  }
}

Fixed version (ground truth):
private static void removeReportComponent(ImpactNode[] impactNodes){
  ReportsSwitch<TdReport> mySwitch=new ReportsSwitch<TdReport>(){
    public TdReport caseTdReport(    TdReport object){
      return object;
    }
  }
;
  TdReport report=null;
  for (  ImpactNode node : impactNodes) {
    report=mySwitch.doSwitch(node.getNodeElement());
    if (report != null && node.getChildren().length > 0) {
      List<Analysis> anaList=new ArrayList<Analysis>();
      for (      ModelElement element : node.getChildren()) {
        anaList.add((Analysis)element);
      }
      ReportHelper.removeAnalyses(report,anaList);
      DependenciesHandler.getInstance().removeDependenciesBetweenModels(report,anaList);
    }
  }
}
Program: 140263
Project: 140263
Buggy source:
/** 
 * Method "supportNonIntegerConstantInGroupBy".
 * @return true if expression like "GROUP BY 'toto'" are supported
 */
public boolean supportNonIntegerConstantInGroupBy(){
  if (is(POSTGRESQL)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Method "supportNonIntegerConstantInGroupBy".
 * @return true if expression like "GROUP BY 'toto'" are supported
 */
public boolean supportNonIntegerConstantInGroupBy(){
  if (is(POSTGRESQL) || is(MSSQL)) {
    return false;
  }
  return true;
}
Program: 140264
Project: 140264
Buggy source:
private String getAlias(String colName,DateGrain dateAggregationType){
  return "String_Node_Str" + unquote(colName) + dateAggregationType.getName()+ "String_Node_Str";
}

Fixed version (ground truth):
private String getAlias(String colName,DateGrain dateAggregationType){
  if (dbms().supportAliasesInGroupBy()) {
    return "String_Node_Str" + unquote(colName) + dateAggregationType.getName()+ "String_Node_Str";
  }
 else {
    return "String_Node_Str";
  }
}
Program: 140265
Project: 140265
Buggy source:
/** 
 * DOC scorreia Comment method "getCompletedSingleSelect".
 * @param indicator
 * @param sqlExpression
 * @param colName
 * @param table
 * @param whereExpression
 * @param range
 * @return
 * @throws ParseException
 */
private String getCompletedSingleSelect(Indicator indicator,String sqlGenericExpression,String colName,String table,List<String> whereExpression,String range) throws ParseException {
  String completedRange=replaceVariables(range,colName,table);
  String rangeColumn="String_Node_Str" + completedRange + "String_Node_Str";
  String rangeColumnInGroupBy=dbms().supportNonIntegerConstantInGroupBy() ? rangeColumn : "String_Node_Str";
  String completedSqlString=replaceVariablesLow(sqlGenericExpression,rangeColumn,table,rangeColumnInGroupBy);
  List<String> allWheresForSingleSelect=new ArrayList<String>(whereExpression);
  completedSqlString=addWhereToSqlStringStatement(allWheresForSingleSelect,completedSqlString);
  completedSqlString=replaceCountByZeroCount(completedSqlString,completedRange);
  return completedSqlString;
}

Fixed version (ground truth):
/** 
 * DOC scorreia Comment method "getCompletedSingleSelect".
 * @param indicator
 * @param sqlExpression
 * @param colName
 * @param table
 * @param whereExpression
 * @param range
 * @return
 * @throws ParseException
 */
private String getCompletedSingleSelect(Indicator indicator,String sqlGenericExpression,String colName,String table,List<String> whereExpression,String range) throws ParseException {
  String completedRange=replaceVariables(range,colName,table);
  String rangeColumn="String_Node_Str" + completedRange + "String_Node_Str";
  String singleQuery=removeGroupBy(sqlGenericExpression);
  String completedSqlString=replaceVariablesLow(singleQuery,rangeColumn,table);
  List<String> allWheresForSingleSelect=new ArrayList<String>(whereExpression);
  completedSqlString=addWhereToSqlStringStatement(allWheresForSingleSelect,completedSqlString);
  completedSqlString=replaceCountByZeroCount(completedSqlString,completedRange);
  return completedSqlString;
}
Program: 140268
Project: 140268
Buggy source:
/** 
 * Method "addWhereToStatement".
 * @param statement a statement already prepared for parsing
 * @param whereClause
 * @return the new statement
 */
public String addWhereToStatement(String statement,String whereClause){
  try {
    ZQuery query=this.parseQuery(statement);
    if (whereClause != null) {
      if (StringUtils.isNotBlank(whereClause)) {
        ZqlParser filterParser=new ZqlParser();
        filterParser.initParser(new ByteArrayInputStream(whereClause.getBytes()));
        ZExp currentWhere=query.getWhere();
        ZExp whereExpression=filterParser.readExpression();
        if (currentWhere != null && whereExpression != null) {
          ZExpression finalWhereExpression=new ZExpression(and(),currentWhere,whereExpression);
          query.addWhere(finalWhereExpression);
        }
 else {
          if (whereExpression != null) {
            query.addWhere(whereExpression);
          }
        }
      }
    }
    return query.toString();
  }
 catch (  ParseException e) {
    log.warn(e,e);
  }
  String op=statement.toUpperCase().contains(where()) ? and() : where();
  String finalQuery=statement + op + whereClause;
  log.warn("String_Node_Str" + finalQuery);
  return finalQuery;
}

Fixed version (ground truth):
/** 
 * Method "addWhereToStatement".
 * @param statement a statement already prepared for parsing
 * @param whereClause
 * @return the new statement
 */
public String addWhereToStatement(String statement,String whereClause){
  if (!isTooComplexForZql(statement)) {
    try {
      ZQuery query=this.parseQuery(statement);
      if (whereClause != null) {
        if (StringUtils.isNotBlank(whereClause)) {
          ZqlParser filterParser=new ZqlParser();
          filterParser.initParser(new ByteArrayInputStream(whereClause.getBytes()));
          ZExp currentWhere=query.getWhere();
          ZExp whereExpression=filterParser.readExpression();
          if (currentWhere != null && whereExpression != null) {
            ZExpression finalWhereExpression=new ZExpression(and(),currentWhere,whereExpression);
            query.addWhere(finalWhereExpression);
          }
 else {
            if (whereExpression != null) {
              query.addWhere(whereExpression);
            }
          }
        }
      }
      return query.toString();
    }
 catch (    ParseException e) {
      log.warn("String_Node_Str" + statement + "String_Node_Str"+ e,e);
    }
  }
  if (statement.contains("String_Node_Str") && statement.contains("String_Node_Str")) {
    int insertIdx=statement.indexOf("String_Node_Str");
    StringBuilder finalQuery=new StringBuilder().append(statement.substring(0,insertIdx)).append(where()).append(surroundWithSpaces(whereClause)).append(statement.substring(insertIdx));
    return finalQuery.toString();
  }
  String op=statement.toUpperCase().contains(where()) ? and() : where();
  String finalQuery=statement + op + whereClause;
  log.warn("String_Node_Str" + finalQuery);
  return finalQuery;
}
Program: 140270
Project: 140270
Buggy source:
/** 
 * Method "removeAnalyses".
 * @param report
 * @param analyses analyses to remove from the report
 * @return true if the analyses list of the report changed as a result of the call.
 */
public static boolean removeAnalyses(TdReport report,Collection<Analysis> analyses){
  return report.getComponent().removeAll(analyses);
}

Fixed version (ground truth):
/** 
 * Method "removeAnalyses".
 * @param report
 * @param analyses analyses to remove from the report
 * @return true if the analyses list of the report changed as a result of the call.
 */
public static boolean removeAnalyses(TdReport report,Collection<Analysis> analyses){
  boolean removed=true;
  for (  Analysis analysis : analyses) {
    if (!report.removeAnalysis(analysis)) {
      removed=false;
    }
  }
  return removed;
}
Program: 140271
Project: 140271
Buggy source:
/** 
 * Method "addAnalyses".
 * @param analyses a collection of analyses.
 * @param report a report (must not be null)
 * @return true if the analysis list changed as a result of the call.
 */
public static boolean addAnalyses(Collection<Analysis> analyses,TdReport report){
  return report.getComponent().addAll(analyses);
}

Fixed version (ground truth):
/** 
 * Method "addAnalyses".
 * @param analyses a collection of analyses.
 * @param report a report (must not be null)
 * @return true if the analysis list changed as a result of the call.
 */
public static boolean addAnalyses(Collection<Analysis> analyses,TdReport report){
  boolean added=true;
  for (  Analysis analysis : analyses) {
    if (!report.addAnalysis(analysis)) {
      added=false;
    }
  }
  return added;
}
Program: 140273
Project: 140273
Buggy source:
@Override protected EObject getSavedReloadObject() throws ReloadCompareException {
  Package selectedPackage=(Package)selectedObj;
  List<TdCatalog> tdCatalogs=DataProviderHelper.getTdCatalogs(this.tempReloadProvider);
  for (  TdCatalog catalog : tdCatalogs) {
    if (selectedPackage.getName().equals(catalog.getName())) {
      return catalog;
    }
  }
  List<TdSchema> tdSchemas=DataProviderHelper.getTdSchema(this.tempReloadProvider);
  for (  TdSchema schema : tdSchemas) {
    if (selectedPackage.getName().equals(schema.getName())) {
      return schema;
    }
  }
  throw new ReloadCompareException("String_Node_Str" + selectedPackage.getName());
}

Fixed version (ground truth):
@Override protected EObject getSavedReloadObject() throws ReloadCompareException {
  Package selectedPackage=(Package)selectedObj;
  return findMatchPackage(selectedPackage);
}
Program: 140274
Project: 140274
Buggy source:
@Override protected EObject getSavedReloadObject() throws ReloadCompareException {
  ColumnSet selectedColumnSet=(ColumnSet)selectedObj;
  Package parentCatalogOrSchema=ColumnSetHelper.getParentCatalogOrSchema((ColumnSet)selectedObj);
  TdCatalog oldCatalog=SwitchHelpers.CATALOG_SWITCH.doSwitch(parentCatalogOrSchema);
  Package toReloadPackage=null;
  if (oldCatalog != null) {
    List<TdCatalog> tdCatalogs=DataProviderHelper.getTdCatalogs(this.tempReloadProvider);
    for (    TdCatalog catalog : tdCatalogs) {
      if (parentCatalogOrSchema.getName().equals(catalog.getName())) {
        toReloadPackage=catalog;
      }
    }
  }
 else {
    List<TdSchema> tdSchemas=DataProviderHelper.getTdSchema(this.tempReloadProvider);
    for (    TdSchema schema : tdSchemas) {
      if (parentCatalogOrSchema.getName().equals(schema.getName())) {
        toReloadPackage=schema;
      }
    }
  }
  if (toReloadPackage == null) {
    throw new ReloadCompareException("String_Node_Str" + selectedColumnSet.getName());
  }
  TdTable oldTable=SwitchHelpers.TABLE_SWITCH.doSwitch(selectedColumnSet);
  if (oldTable != null) {
    List<TdTable> tables=PackageHelper.getTables(toReloadPackage);
    for (    TdTable table : tables) {
      if (oldTable.getName().equals(table.getName())) {
        return table;
      }
    }
  }
 else {
    List<TdView> views=PackageHelper.getViews(toReloadPackage);
    for (    TdView view : views) {
      if (selectedColumnSet.getName().equals(view.getName())) {
        return view;
      }
    }
  }
  throw new ReloadCompareException("String_Node_Str" + selectedColumnSet.getName());
}

Fixed version (ground truth):
@Override protected EObject getSavedReloadObject() throws ReloadCompareException {
  ColumnSet selectedColumnSet=(ColumnSet)selectedObj;
  Package parentCatalogOrSchema=ColumnSetHelper.getParentCatalogOrSchema((ColumnSet)selectedObj);
  Package toReloadPackage=findMatchPackage(parentCatalogOrSchema);
  TdTable oldTable=SwitchHelpers.TABLE_SWITCH.doSwitch(selectedColumnSet);
  if (oldTable != null) {
    List<TdTable> tables=PackageHelper.getTables(toReloadPackage);
    for (    TdTable table : tables) {
      if (oldTable.getName().equals(table.getName())) {
        return table;
      }
    }
  }
 else {
    List<TdView> views=PackageHelper.getViews(toReloadPackage);
    for (    TdView view : views) {
      if (selectedColumnSet.getName().equals(view.getName())) {
        return view;
      }
    }
  }
  throw new ReloadCompareException("String_Node_Str" + selectedColumnSet.getName());
}
Program: 140275
Project: 140275
Buggy source:
public void run(IProgressMonitor monitor) throws InvocationTargetException {
  IComparisonLevel creatComparisonLevel=ComparisonLevelFactory.creatComparisonLevel(selectedObject);
  try {
    creatComparisonLevel.reloadCurrentLevelElement();
  }
 catch (  ReloadCompareException e) {
    throw new InvocationTargetException(e);
  }
}

Fixed version (ground truth):
public void run(){
  try {
    creatComparisonLevel.reloadCurrentLevelElement();
  }
 catch (  ReloadCompareException e) {
    e.printStackTrace();
  }
}
Program: 140276
Project: 140276
Buggy source:
/** 
 * Method "getTopNQuery".
 * @param query
 * @param n
 * @return the n first row of the given query
 */
public String getTopNQuery(String query,int n){
  if (is(ORACLE)) {
    return "String_Node_Str" + query + "String_Node_Str"+ n;
  }
  if (is(MYSQL)) {
    return query + "String_Node_Str" + n;
  }
  if (is(DB2)) {
    return query + "String_Node_Str" + n+ "String_Node_Str";
  }
  return query;
}

Fixed version (ground truth):
/** 
 * Method "getTopNQuery".
 * @param query
 * @param n
 * @return the n first row of the given query
 */
public String getTopNQuery(String query,int n){
  if (is(ORACLE)) {
    return "String_Node_Str" + query + "String_Node_Str"+ n;
  }
  if (is(MYSQL) || is(POSTGRESQL)) {
    return query + "String_Node_Str" + n;
  }
  if (is(DB2)) {
    return query + "String_Node_Str" + n+ "String_Node_Str";
  }
  return query;
}
Program: 140278
Project: 140278
Buggy source:
private String getAlias(String colName,DateGrain dateAggregationType){
  if (dbms().supportAliasesInGroupBy()) {
    return "String_Node_Str" + unquote(colName) + dateAggregationType.getName()+ "String_Node_Str";
  }
 else {
    return "String_Node_Str";
  }
}

Fixed version (ground truth):
private String getAlias(String colName,DateGrain dateAggregationType){
  return "String_Node_Str" + unquote(colName) + dateAggregationType.getName()+ "String_Node_Str";
}
Program: 140279
Project: 140279
Buggy source:
/** 
 * DOC scorreia Comment method "getCompletedSingleSelect".
 * @param indicator
 * @param sqlExpression
 * @param colName
 * @param table
 * @param whereExpression
 * @param range
 * @return
 * @throws ParseException
 */
private String getCompletedSingleSelect(Indicator indicator,String sqlGenericExpression,String colName,String table,List<String> whereExpression,String range) throws ParseException {
  String completedRange=replaceVariables(range,colName,table);
  String rangeColumn="String_Node_Str" + completedRange + "String_Node_Str";
  String completedSqlString=replaceVariablesLow(sqlGenericExpression,rangeColumn,table,rangeColumn);
  List<String> allWheresForSingleSelect=new ArrayList<String>(whereExpression);
  completedSqlString=addWhereToSqlStringStatement(allWheresForSingleSelect,completedSqlString);
  completedSqlString=replaceCountByZeroCount(completedSqlString,completedRange);
  return completedSqlString;
}

Fixed version (ground truth):
/** 
 * DOC scorreia Comment method "getCompletedSingleSelect".
 * @param indicator
 * @param sqlExpression
 * @param colName
 * @param table
 * @param whereExpression
 * @param range
 * @return
 * @throws ParseException
 */
private String getCompletedSingleSelect(Indicator indicator,String sqlGenericExpression,String colName,String table,List<String> whereExpression,String range) throws ParseException {
  String completedRange=replaceVariables(range,colName,table);
  String rangeColumn="String_Node_Str" + completedRange + "String_Node_Str";
  String rangeColumnInGroupBy=dbms().supportNonIntegerConstantInGroupBy() ? rangeColumn : "String_Node_Str";
  String completedSqlString=replaceVariablesLow(sqlGenericExpression,rangeColumn,table,rangeColumnInGroupBy);
  List<String> allWheresForSingleSelect=new ArrayList<String>(whereExpression);
  completedSqlString=addWhereToSqlStringStatement(allWheresForSingleSelect,completedSqlString);
  completedSqlString=replaceCountByZeroCount(completedSqlString,completedRange);
  return completedSqlString;
}
Program: 140280
Project: 140280
Buggy source:
public static boolean patternRule(IndicatorEnum indicatorType,TdColumn column){
  int javaType=column.getJavaType();
  DataminingType dataminingType=MetadataHelper.getDataminingType(column);
  if (dataminingType == null) {
    dataminingType=MetadataHelper.getDefaultDataminingType(javaType);
  }
switch (indicatorType) {
case CountsIndicatorEnum:
case RowCountIndicatorEnum:
    return true;
case NullCountIndicatorEnum:
  return true;
case DistinctCountIndicatorEnum:
case UniqueIndicatorEnum:
case DuplicateCountIndicatorEnum:
return true;
case BlankCountIndicatorEnum:
case TextIndicatorEnum:
case MinLengthIndicatorEnum:
case MaxLengthIndicatorEnum:
case AverageLengthIndicatorEnum:
if (Java2SqlType.isTextInSQL(javaType)) {
if (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.UNSTRUCTURED_TEXT) {
  return true;
}
}
break;
case ModeIndicatorEnum:
case FrequencyIndicatorEnum:
if (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.INTERVAL) {
return true;
}
break;
case MeanIndicatorEnum:
case MedianIndicatorEnum:
case BoxIIndicatorEnum:
case IQRIndicatorEnum:
case LowerQuartileIndicatorEnum:
case UpperQuartileIndicatorEnum:
case RangeIndicatorEnum:
if (Java2SqlType.isNumbericInSQL(javaType)) {
if (dataminingType == DataminingType.INTERVAL) {
return true;
}
}
break;
case MinValueIndicatorEnum:
case MaxValueIndicatorEnum:
if (dataminingType == DataminingType.INTERVAL) {
return true;
}
break;
default :
return false;
}
return false;
}

Fixed version (ground truth):
public static boolean patternRule(IndicatorEnum indicatorType,TdColumn column){
  int javaType=column.getJavaType();
  DataminingType dataminingType=MetadataHelper.getDataminingType(column);
  if (dataminingType == null) {
    dataminingType=MetadataHelper.getDefaultDataminingType(javaType);
  }
switch (indicatorType) {
case CountsIndicatorEnum:
case RowCountIndicatorEnum:
    return true;
case NullCountIndicatorEnum:
  return true;
case DistinctCountIndicatorEnum:
case UniqueIndicatorEnum:
case DuplicateCountIndicatorEnum:
return true;
case BlankCountIndicatorEnum:
case TextIndicatorEnum:
case MinLengthIndicatorEnum:
case MaxLengthIndicatorEnum:
case AverageLengthIndicatorEnum:
if (Java2SqlType.isTextInSQL(javaType)) {
if (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.UNSTRUCTURED_TEXT) {
  return true;
}
}
break;
case ModeIndicatorEnum:
case FrequencyIndicatorEnum:
if (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.INTERVAL) {
return true;
}
break;
case MeanIndicatorEnum:
case MedianIndicatorEnum:
case BoxIIndicatorEnum:
case IQRIndicatorEnum:
case LowerQuartileIndicatorEnum:
case UpperQuartileIndicatorEnum:
case RangeIndicatorEnum:
if (Java2SqlType.isNumbericInSQL(javaType)) {
if (dataminingType == DataminingType.INTERVAL) {
return true;
}
}
break;
case MinValueIndicatorEnum:
case MaxValueIndicatorEnum:
if (!Java2SqlType.isDateInSQL(javaType)) {
if (dataminingType == DataminingType.INTERVAL) {
return true;
}
}
break;
default :
return false;
}
return false;
}
Program: 140281
Project: 140281
Buggy source:
private String extract(DateGrain dateGrain,String colName){
  if (is(MYSQL)) {
    return dateGrain.getName() + surroundWith('(',colName,')');
  }
  if (is(ORACLE)) {
    String toNumberToChar="String_Node_Str";
switch (dateGrain.getValue()) {
case DateGrain.DAY_VALUE:
      return toNumberToChar + colName + "String_Node_Str";
case DateGrain.WEEK_VALUE:
    return toNumberToChar + colName + "String_Node_Str";
case DateGrain.MONTH_VALUE:
  return toNumberToChar + colName + "String_Node_Str";
case DateGrain.QUARTER_VALUE:
return toNumberToChar + colName + "String_Node_Str";
case DateGrain.YEAR_VALUE:
return toNumberToChar + colName + "String_Node_Str";
default :
}
}
if (is(MSSQL)) {
return "String_Node_Str" + dateGrain.getName() + "String_Node_Str"+ colName+ "String_Node_Str";
}
return "String_Node_Str" + dateGrain + from()+ colName+ "String_Node_Str";
}

Fixed version (ground truth):
private String extract(DateGrain dateGrain,String colName){
  if (is(MYSQL)) {
    return dateGrain.getName() + surroundWith('(',colName,')');
  }
  if (is(ORACLE)) {
    String toNumberToChar="String_Node_Str";
switch (dateGrain.getValue()) {
case DateGrain.DAY_VALUE:
      return toNumberToChar + colName + "String_Node_Str";
case DateGrain.WEEK_VALUE:
    return toNumberToChar + colName + "String_Node_Str";
case DateGrain.MONTH_VALUE:
  return toNumberToChar + colName + "String_Node_Str";
case DateGrain.QUARTER_VALUE:
return toNumberToChar + colName + "String_Node_Str";
case DateGrain.YEAR_VALUE:
return toNumberToChar + colName + "String_Node_Str";
default :
}
}
if (is(MSSQL)) {
return "String_Node_Str" + dateGrain.getName() + "String_Node_Str"+ colName+ "String_Node_Str";
}
if (is(POSTGRESQL)) {
return "String_Node_Str" + dateGrain + from()+ colName+ "String_Node_Str";
}
return "String_Node_Str" + dateGrain + from()+ colName+ "String_Node_Str";
}
Program: 140282
Project: 140282
Buggy source:
@Override public boolean checkFieldsValue(){
  if (nameText.getText() == "String_Node_Str") {
    updateStatus(IStatus.ERROR,MSG_EMPTY);
    return false;
  }
  if (!CheckValueUtils.isPatternValue(nameText.getText())) {
    if (type != null) {
switch (type) {
case SQL_LIKE:
        updateStatus(IStatus.ERROR,SQLERROR_MESSAGE);
default :
      updateStatus(IStatus.ERROR,ERROR_MESSAGE);
  }
}
 else {
  updateStatus(IStatus.ERROR,ERROR_MESSAGE);
}
return false;
}
updateStatus(IStatus.OK,MSG_OK);
return true;
}

Fixed version (ground truth):
@Override public boolean checkFieldsValue(){
  if (nameText.getText() == "String_Node_Str") {
    updateStatus(IStatus.ERROR,MSG_EMPTY);
    return false;
  }
  if (!CheckValueUtils.isPatternValue(nameText.getText())) {
    if (type != null) {
switch (type) {
case SQL_LIKE:
        updateStatus(IStatus.ERROR,SQLERROR_MESSAGE);
      break;
default :
    updateStatus(IStatus.ERROR,ERROR_MESSAGE);
}
}
 else {
updateStatus(IStatus.ERROR,ERROR_MESSAGE);
}
return false;
}
updateStatus(IStatus.OK,MSG_OK);
return true;
}
Program: 140283
Project: 140283
Buggy source:
private void fillDbUrlMap(){
  supportDBUrlMap.put(SupportDBUrlType.MYSQLDEFAULTURL.getDBKey(),SupportDBUrlType.MYSQLDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.ORACLEDEFAULTURL.getDBKey(),SupportDBUrlType.ORACLEDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.MSSQLDEFAULTURL.getDBKey(),SupportDBUrlType.MSSQLDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.DB2DEFAULTURL.getDBKey(),SupportDBUrlType.DB2DEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.POSTGRESQLEFAULTURL.getDBKey(),SupportDBUrlType.POSTGRESQLEFAULTURL);
}

Fixed version (ground truth):
private void fillDbUrlMap(){
  supportDBUrlMap.put(SupportDBUrlType.MYSQLDEFAULTURL.getDBKey(),SupportDBUrlType.MYSQLDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.ORACLEWITHSIDDEFAULTURL.getDBKey(),SupportDBUrlType.ORACLEWITHSIDDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.ORACLEWITHSERVICENAMEDEFAULTURL.getDBKey(),SupportDBUrlType.ORACLEWITHSERVICENAMEDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.MSSQLDEFAULTURL.getDBKey(),SupportDBUrlType.MSSQLDEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.DB2DEFAULTURL.getDBKey(),SupportDBUrlType.DB2DEFAULTURL);
  supportDBUrlMap.put(SupportDBUrlType.POSTGRESQLEFAULTURL.getDBKey(),SupportDBUrlType.POSTGRESQLEFAULTURL);
}
Program: 140284
Project: 140284
Buggy source:
public static boolean patternRule(IndicatorEnum indicatorType,TdColumn column){
  int javaType=column.getJavaType();
  DataminingType dataminingType=MetadataHelper.getDataminingType(column);
  if (dataminingType == null) {
    dataminingType=MetadataHelper.getDefaultDataminingType(javaType);
  }
switch (indicatorType) {
case CountsIndicatorEnum:
case RowCountIndicatorEnum:
    return true;
case NullCountIndicatorEnum:
  return true;
case DistinctCountIndicatorEnum:
case UniqueIndicatorEnum:
case DuplicateCountIndicatorEnum:
return true;
case BlankCountIndicatorEnum:
case TextIndicatorEnum:
case MinLengthIndicatorEnum:
case MaxLengthIndicatorEnum:
case AverageLengthIndicatorEnum:
if (Java2SqlType.isTextInSQL(javaType)) {
if (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.UNSTRUCTURED_TEXT) {
  return true;
}
}
break;
case ModeIndicatorEnum:
case FrequencyIndicatorEnum:
if (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.INTERVAL) {
return true;
}
break;
case MeanIndicatorEnum:
case MedianIndicatorEnum:
case BoxIIndicatorEnum:
case IQRIndicatorEnum:
case LowerQuartileIndicatorEnum:
case UpperQuartileIndicatorEnum:
case RangeIndicatorEnum:
if (Java2SqlType.isNumbericInSQL(javaType) || Java2SqlType.isDateInSQL(javaType)) {
if (dataminingType == DataminingType.INTERVAL) {
return true;
}
}
break;
case MinValueIndicatorEnum:
case MaxValueIndicatorEnum:
if (dataminingType == DataminingType.INTERVAL) {
return true;
}
break;
default :
return false;
}
return false;
}

Fixed version (ground truth):
public static boolean patternRule(IndicatorEnum indicatorType,TdColumn column){
  int javaType=column.getJavaType();
  DataminingType dataminingType=MetadataHelper.getDataminingType(column);
  if (dataminingType == null) {
    dataminingType=MetadataHelper.getDefaultDataminingType(javaType);
  }
switch (indicatorType) {
case CountsIndicatorEnum:
case RowCountIndicatorEnum:
    return true;
case NullCountIndicatorEnum:
  return true;
case DistinctCountIndicatorEnum:
case UniqueIndicatorEnum:
case DuplicateCountIndicatorEnum:
return true;
case BlankCountIndicatorEnum:
case TextIndicatorEnum:
case MinLengthIndicatorEnum:
case MaxLengthIndicatorEnum:
case AverageLengthIndicatorEnum:
if (Java2SqlType.isTextInSQL(javaType)) {
if (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.UNSTRUCTURED_TEXT) {
  return true;
}
}
break;
case ModeIndicatorEnum:
case FrequencyIndicatorEnum:
if (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.INTERVAL) {
return true;
}
break;
case MeanIndicatorEnum:
case MedianIndicatorEnum:
case BoxIIndicatorEnum:
case IQRIndicatorEnum:
case LowerQuartileIndicatorEnum:
case UpperQuartileIndicatorEnum:
case RangeIndicatorEnum:
if (Java2SqlType.isNumbericInSQL(javaType)) {
if (dataminingType == DataminingType.INTERVAL) {
return true;
}
}
break;
case MinValueIndicatorEnum:
case MaxValueIndicatorEnum:
if (dataminingType == DataminingType.INTERVAL) {
return true;
}
break;
default :
return false;
}
return false;
}