Program: 59386
Project: 59386
Buggy source:
/** 
 * Return an expression for   {@code entityPath.fieldName} with the{@code operator} or "equal" by default.<p/> Expr:  {@code entityPath.fieldName eq searchObj}
 * @param entityPath Full path to entity and associations. For example:{@code Pet} , {@code Pet.owner}
 * @param fieldName Property name in the given entity path. For example:{@code name} in {@code Pet} entity, {@code firstName} in{@code Pet.owner} entity.
 * @param searchObj the value to find, may be null
 * @param operator the operator to use into the expression. Supportedoperators: <ul> <li>For all types:  {@code eq},   {@code in},   {@code ne},  {@code notIn},   {@code isNull} and {@code isNotNull}.</li> <li> For strings and numbers:   {@code goe},   {@code gt},   {@code loe},  {@code lt} and {@code like}.</li> <li> For booleans:   {@code goe},  {@code gt},   {@code loe} and {@code lt}.</li> <li> For dates:  {@code goe},   {@code gt},   {@code before},   {@code loe},   {@code lt}and   {@code after}. </li> </ul>
 * @return BooleanExpression
 */
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public static <T>BooleanExpression createExpression(PathBuilder<T> entityPath,String fieldName,Object searchObj,String operator){
  if (searchObj == null) {
    return null;
  }
  if (StringUtils.isBlank(operator) || StringUtils.equalsIgnoreCase(operator,"String_Node_Str")) {
    return entityPath.get(fieldName).eq(searchObj);
  }
 else   if (StringUtils.equalsIgnoreCase(operator,"String_Node_Str")) {
    return entityPath.get(fieldName).in(searchObj);
  }
 else   if (StringUtils.equalsIgnoreCase(operator,"String_Node_Str")) {
    return entityPath.get(fieldName).ne(searchObj);
  }
 else   if (StringUtils.equalsIgnoreCase(operator,"String_Node_Str")) {
    return entityPath.get(fieldName).notIn(searchObj);
  }
 else   if (StringUtils.equalsIgnoreCase(operator,"String_Node_Str")) {
    return entityPath.get(fieldName).isNull();
  }
 else   if (StringUtils.equalsIgnoreCase(operator,"String_Node_Str")) {
    return entityPath.get(fieldName).isNotNull();
  }
  Class<?> fieldType=getFieldType(fieldName,entityPath);
  if (String.class == fieldType && String.class == searchObj.getClass()) {
    return createStringExpression(entityPath,fieldName,searchObj,operator);
  }
 else   if ((Boolean.class == fieldType || boolean.class == fieldType) && String.class == searchObj.getClass()) {
    return createBooleanExpression(entityPath,fieldName,searchObj,operator);
  }
 else   if ((Number.class.isAssignableFrom(fieldType) || NUMBER_PRIMITIVES.contains(fieldType)) && String.class == searchObj.getClass() && NumberUtils.isNumber((String)searchObj)) {
    return createNumericExpression(entityPath,fieldName,searchObj,operator,fieldType);
  }
 else   if ((Date.class.isAssignableFrom(fieldType) || Calendar.class.isAssignableFrom(fieldType)) && String.class == searchObj.getClass()) {
    return createDateExpression(entityPath,fieldName,searchObj,operator,fieldType);
  }
 else   if (fieldType.isEnum() && String.class == searchObj.getClass()) {
    return createEnumExpression(entityPath,fieldName,(String)searchObj,(Class<? extends Enum>)fieldType);
  }
  return entityPath.get(fieldName).eq(searchObj);
}

Fixed version (ground truth):
/** 
 * Utility for constructing where clause expressions.
 * @param entityPath Full path to entity and associations. For example:{@code Pet} , {@code Pet.owner}
 * @param fieldName Property name in the given entity path. For example:{@code name} in {@code Pet} entity, {@code firstName} in{@code Pet.owner} entity.
 * @param fieldType Property value {@code Class}
 * @param searchStr the value to find, may be null
 * @return Predicate
 */
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public static <T>Predicate createExpression(PathBuilder<T> entityPath,String fieldName,String searchStr,ConversionService conversionService,MessageSource messageSource){
  TypeDescriptor descriptor=getTypeDescriptor(fieldName,entityPath);
  if (descriptor == null) {
    throw new IllegalArgumentException(String.format("String_Node_Str",fieldName,entityPath.getType()));
  }
  Class<?> fieldType=descriptor.getType();
  if (String.class == fieldType) {
    return createStringExpressionWithOperators(entityPath,fieldName,searchStr,conversionService,messageSource);
  }
 else   if (Boolean.class == fieldType || boolean.class == fieldType) {
    return createBooleanExpressionWithOperators(entityPath,fieldName,searchStr,conversionService,messageSource);
  }
 else   if (Number.class.isAssignableFrom(fieldType) || NUMBER_PRIMITIVES.contains(fieldType)) {
    return createNumberExpressionGenericsWithOperators(entityPath,fieldName,descriptor,searchStr,conversionService,messageSource);
  }
 else   if (Date.class.isAssignableFrom(fieldType) || Calendar.class.isAssignableFrom(fieldType)) {
    String datePattern="String_Node_Str";
    if (messageSource != null) {
      datePattern=messageSource.getMessage("String_Node_Str",null,LocaleContextHolder.getLocale());
    }
    BooleanExpression expression=createDateExpressionWithOperators(entityPath,fieldName,(Class<Date>)fieldType,searchStr,conversionService,messageSource,datePattern);
    return expression;
  }
 else   if (fieldType.isEnum()) {
    return createEnumExpression(entityPath,fieldName,searchStr,(Class<? extends Enum>)fieldType);
  }
  return null;
}