Program: 138039
Project: 138039
Buggy source:
public static boolean patternRule(IndicatorEnum indicatorType,ModelElement me,ExecutionLanguage language){
  int javaType=0;
  boolean isDeliFileColumn=!(me instanceof TdColumn) && me instanceof MetadataColumn;
  if (me instanceof TdColumn) {
    javaType=((TdColumn)me).getSqlDataType().getJavaDataType();
  }
 else   if (me instanceof TdXmlElementType) {
    javaType=XSDDataTypeConvertor.convertToJDBCType(((TdXmlElementType)me).getJavaType());
  }
 else   if (isDeliFileColumn) {
    javaType=TalendTypeConvert.convertToJDBCType(((MetadataColumn)me).getTalendType());
  }
  DataminingType dataminingType=MetadataHelper.getDataminingType(me);
  if (dataminingType == null || isDeliFileColumn) {
    dataminingType=MetadataHelper.getDefaultDataminingType(javaType);
  }
  if (javaType == Types.LONGVARCHAR && ExecutionLanguage.SQL.equals(language)) {
    return enableLongVarchar(indicatorType,dataminingType,me);
  }
switch (indicatorType) {
case CountsIndicatorEnum:
case RowCountIndicatorEnum:
case NullCountIndicatorEnum:
case DistinctCountIndicatorEnum:
case UniqueIndicatorEnum:
case DuplicateCountIndicatorEnum:
    return true;
case DefValueCountIndicatorEnum:
  Expression initialValue=null;
if (me instanceof TdColumn) {
  initialValue=((TdColumn)me).getInitialValue();
}
if (initialValue != null && initialValue.getBody() != null) {
return initialValue.getBody().length() != 0 || Java2SqlType.isTextInSQL(javaType);
}
break;
case BlankCountIndicatorEnum:
if (me instanceof TdXmlElementType || !Java2SqlType.isTextInSQL(javaType)) {
return false;
}
 else {
return true;
}
case TextIndicatorEnum:
case MinLengthIndicatorEnum:
case MinLengthWithNullIndicatorEnum:
case MinLengthWithBlankIndicatorEnum:
case MinLengthWithBlankNullIndicatorEnum:
case MaxLengthIndicatorEnum:
case MaxLengthWithNullIndicatorEnum:
case MaxLengthWithBlankIndicatorEnum:
case MaxLengthWithBlankNullIndicatorEnum:
case AverageLengthIndicatorEnum:
case AverageLengthWithNullIndicatorEnum:
case AverageLengthWithBlankIndicatorEnum:
case AverageLengthWithNullBlankIndicatorEnum:
if (Java2SqlType.isTextInSQL(javaType)) {
if (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.UNSTRUCTURED_TEXT) {
return true;
}
}
break;
case ModeIndicatorEnum:
if (Java2SqlType.isTimeSQL(javaType)) {
return true;
}
case FrequencyIndicatorEnum:
case LowFrequencyIndicatorEnum:
if (Java2SqlType.isTimeSQL(javaType)) {
return false;
}
case PatternFreqIndicatorEnum:
case PatternLowFreqIndicatorEnum:
if (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.INTERVAL) {
return true;
}
break;
case DatePatternFreqIndicatorEnum:
if (ExecutionLanguage.JAVA.equals(language) && (Java2SqlType.isDateInSQL(javaType) || Java2SqlType.isTextInSQL(javaType))) {
return true;
}
break;
case SoundexIndicatorEnum:
case SoundexLowIndicatorEnum:
if (!Java2SqlType.isDateInSQL(javaType) && !Java2SqlType.isNumbericInSQL(javaType) && (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.INTERVAL)) {
return true;
}
break;
case MeanIndicatorEnum:
case MedianIndicatorEnum:
case IQRIndicatorEnum:
case LowerQuartileIndicatorEnum:
case UpperQuartileIndicatorEnum:
if (Java2SqlType.isNumbericInSQL(javaType)) {
if (dataminingType == DataminingType.INTERVAL) {
return true;
}
}
break;
case BoxIIndicatorEnum:
case RangeIndicatorEnum:
case MinValueIndicatorEnum:
case MaxValueIndicatorEnum:
if (Java2SqlType.isNumbericInSQL(javaType) || Java2SqlType.isDateInSQL(javaType)) {
if (dataminingType == DataminingType.INTERVAL) {
return true;
}
}
break;
case DateFrequencyIndicatorEnum:
case WeekFrequencyIndicatorEnum:
case MonthFrequencyIndicatorEnum:
case QuarterFrequencyIndicatorEnum:
case YearFrequencyIndicatorEnum:
case DateLowFrequencyIndicatorEnum:
case WeekLowFrequencyIndicatorEnum:
case MonthLowFrequencyIndicatorEnum:
case QuarterLowFrequencyIndicatorEnum:
case YearLowFrequencyIndicatorEnum:
if (Java2SqlType.isDateInSQL(javaType) && !Java2SqlType.isTimeSQL(javaType) && (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.INTERVAL)) {
return true;
}
break;
case BinFrequencyIndicatorEnum:
case BinLowFrequencyIndicatorEnum:
if (Java2SqlType.isNumbericInSQL(javaType) && (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.INTERVAL)) {
return true;
}
break;
case ValidPhoneCountIndicatorEnum:
case PossiblePhoneCountIndicatorEnum:
case ValidRegCodeCountIndicatorEnum:
case InvalidRegCodeCountIndicatorEnum:
case WellFormE164PhoneCountIndicatorEnum:
case WellFormIntePhoneCountIndicatorEnum:
case WellFormNationalPhoneCountIndicatorEnum:
case PhoneNumbStatisticsIndicatorEnum:
case FormatFreqPieIndictorEnum:
if (ExecutionLanguage.JAVA.equals(language) && (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.INTERVAL)) {
return true;
}
break;
default :
return false;
}
return false;
}

Fixed version (ground truth):
public static boolean patternRule(IndicatorEnum indicatorType,ModelElement me,ExecutionLanguage language){
  int javaType=0;
  boolean isDeliFileColumn=!(me instanceof TdColumn) && me instanceof MetadataColumn;
  if (me instanceof TdColumn) {
    javaType=((TdColumn)me).getSqlDataType().getJavaDataType();
  }
 else   if (me instanceof TdXmlElementType) {
    javaType=XSDDataTypeConvertor.convertToJDBCType(((TdXmlElementType)me).getJavaType());
  }
 else   if (isDeliFileColumn) {
    javaType=TalendTypeConvert.convertToJDBCType(((MetadataColumn)me).getTalendType());
  }
  DataminingType dataminingType=MetadataHelper.getDataminingType(me);
  if (dataminingType == null || isDeliFileColumn) {
    dataminingType=MetadataHelper.getDefaultDataminingType(javaType);
  }
  if (javaType == Types.LONGVARCHAR && ExecutionLanguage.SQL.equals(language)) {
    return enableLongVarchar(indicatorType,dataminingType,me);
  }
switch (indicatorType) {
case CountsIndicatorEnum:
case RowCountIndicatorEnum:
case NullCountIndicatorEnum:
case DistinctCountIndicatorEnum:
case UniqueIndicatorEnum:
case DuplicateCountIndicatorEnum:
    return true;
case DefValueCountIndicatorEnum:
  Expression initialValue=null;
if (me instanceof TdColumn) {
  initialValue=((TdColumn)me).getInitialValue();
}
if (initialValue != null && initialValue.getBody() != null) {
return initialValue.getBody().length() != 0 || Java2SqlType.isTextInSQL(javaType);
}
break;
case BlankCountIndicatorEnum:
if (me instanceof TdXmlElementType || !Java2SqlType.isTextInSQL(javaType)) {
return false;
}
 else {
return true;
}
case TextIndicatorEnum:
case MinLengthIndicatorEnum:
case MinLengthWithNullIndicatorEnum:
case MinLengthWithBlankIndicatorEnum:
case MinLengthWithBlankNullIndicatorEnum:
case MaxLengthIndicatorEnum:
case MaxLengthWithNullIndicatorEnum:
case MaxLengthWithBlankIndicatorEnum:
case MaxLengthWithBlankNullIndicatorEnum:
case AverageLengthIndicatorEnum:
case AverageLengthWithNullIndicatorEnum:
case AverageLengthWithBlankIndicatorEnum:
case AverageLengthWithNullBlankIndicatorEnum:
if (Java2SqlType.isTextInSQL(javaType)) {
if (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.UNSTRUCTURED_TEXT) {
return true;
}
}
break;
case ModeIndicatorEnum:
if (Java2SqlType.isTimeSQL(javaType)) {
return true;
}
case FrequencyIndicatorEnum:
case LowFrequencyIndicatorEnum:
case PatternFreqIndicatorEnum:
case PatternLowFreqIndicatorEnum:
if (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.INTERVAL) {
return true;
}
break;
case DatePatternFreqIndicatorEnum:
if (ExecutionLanguage.JAVA.equals(language) && (Java2SqlType.isDateInSQL(javaType) || Java2SqlType.isTextInSQL(javaType))) {
return true;
}
break;
case SoundexIndicatorEnum:
case SoundexLowIndicatorEnum:
if (!Java2SqlType.isDateInSQL(javaType) && !Java2SqlType.isNumbericInSQL(javaType) && (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.INTERVAL)) {
return true;
}
break;
case MeanIndicatorEnum:
case MedianIndicatorEnum:
case IQRIndicatorEnum:
case LowerQuartileIndicatorEnum:
case UpperQuartileIndicatorEnum:
if (Java2SqlType.isNumbericInSQL(javaType)) {
if (dataminingType == DataminingType.INTERVAL) {
return true;
}
}
break;
case BoxIIndicatorEnum:
case RangeIndicatorEnum:
case MinValueIndicatorEnum:
case MaxValueIndicatorEnum:
if (Java2SqlType.isNumbericInSQL(javaType) || Java2SqlType.isDateInSQL(javaType)) {
if (dataminingType == DataminingType.INTERVAL) {
return true;
}
}
break;
case DateFrequencyIndicatorEnum:
case WeekFrequencyIndicatorEnum:
case MonthFrequencyIndicatorEnum:
case QuarterFrequencyIndicatorEnum:
case YearFrequencyIndicatorEnum:
case DateLowFrequencyIndicatorEnum:
case WeekLowFrequencyIndicatorEnum:
case MonthLowFrequencyIndicatorEnum:
case QuarterLowFrequencyIndicatorEnum:
case YearLowFrequencyIndicatorEnum:
if (Java2SqlType.isDateInSQL(javaType) && !Java2SqlType.isTimeSQL(javaType) && (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.INTERVAL)) {
return true;
}
break;
case BinFrequencyIndicatorEnum:
case BinLowFrequencyIndicatorEnum:
if (Java2SqlType.isNumbericInSQL(javaType) && (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.INTERVAL)) {
return true;
}
break;
case ValidPhoneCountIndicatorEnum:
case PossiblePhoneCountIndicatorEnum:
case ValidRegCodeCountIndicatorEnum:
case InvalidRegCodeCountIndicatorEnum:
case WellFormE164PhoneCountIndicatorEnum:
case WellFormIntePhoneCountIndicatorEnum:
case WellFormNationalPhoneCountIndicatorEnum:
case PhoneNumbStatisticsIndicatorEnum:
case FormatFreqPieIndictorEnum:
if (ExecutionLanguage.JAVA.equals(language) && (dataminingType == DataminingType.NOMINAL || dataminingType == DataminingType.INTERVAL)) {
return true;
}
break;
default :
return false;
}
return false;
}