Program: 18107
Project: 18107
Buggy source:
/** 
 * This method returns the parsed where condition corresponding to the filter input in the user query.
 * @param whereExpression
 * @return Parsed where condition String
 * @throws ODataException
 */
public static String parseToJPAWhereExpression(final CommonExpression whereExpression,String tableAlias) throws ODataException {
switch (whereExpression.getKind()) {
case UNARY:
    final UnaryExpression unaryExpression=(UnaryExpression)whereExpression;
  final String operand=parseToJPAWhereExpression(unaryExpression.getOperand(),tableAlias);
switch (unaryExpression.getOperator()) {
case NOT:
  return JPQLStatement.Operator.NOT + "String_Node_Str" + operand+ "String_Node_Str";
case MINUS:
if (operand.startsWith("String_Node_Str")) return operand.substring(1);
 else return "String_Node_Str" + operand;
default :
LOGGER.error("String_Node_Str");
throw new ODataNotImplementedException();
}
case FILTER:
return parseToJPAWhereExpression(((FilterExpression)whereExpression).getExpression(),tableAlias);
case BINARY:
final BinaryExpression binaryExpression=(BinaryExpression)whereExpression;
final String left=parseToJPAWhereExpression(binaryExpression.getLeftOperand(),tableAlias);
final String right=parseToJPAWhereExpression(binaryExpression.getRightOperand(),tableAlias);
switch (binaryExpression.getOperator()) {
case AND:
return left + SPACE + JPQLStatement.Operator.AND+ SPACE+ right;
case OR:
return left + SPACE + JPQLStatement.Operator.OR+ SPACE+ right;
case EQ:
return left + SPACE + JPQLStatement.Operator.EQ+ SPACE+ right;
case NE:
return left + SPACE + JPQLStatement.Operator.NE+ SPACE+ right;
case LT:
return left + SPACE + JPQLStatement.Operator.LT+ SPACE+ right;
case LE:
return left + SPACE + JPQLStatement.Operator.LE+ SPACE+ right;
case GT:
return left + SPACE + JPQLStatement.Operator.GT+ SPACE+ right;
case GE:
return left + SPACE + JPQLStatement.Operator.GE+ SPACE+ right;
case PROPERTY_ACCESS:
LOGGER.error("String_Node_Str");
throw new ODataNotImplementedException();
default :
LOGGER.error("String_Node_Str" + binaryExpression.getOperator().name() + "String_Node_Str");
throw new ODataNotImplementedException();
}
case PROPERTY:
String returnStr=tableAlias + DOT + ((PropertyExpression)whereExpression).getPropertyName();
return returnStr;
case MEMBER:
final MemberExpression memberExpression=(MemberExpression)whereExpression;
final PropertyExpression propertyExpressionPath=(PropertyExpression)memberExpression.getPath();
return tableAlias + DOT + propertyExpressionPath.getUriLiteral()+ DOT+ memberExpression.getProperty().getUriLiteral();
case LITERAL:
final LiteralExpression literal=(LiteralExpression)whereExpression;
final EdmSimpleType literalType=(EdmSimpleType)literal.getEdmType();
String value=literalType.valueToString(literalType.valueOfString(literal.getUriLiteral(),EdmLiteralKind.URI,null),EdmLiteralKind.DEFAULT,null);
return evaluateComparingExpression(value,literalType);
default :
LOGGER.error("String_Node_Str" + whereExpression.getKind().name() + "String_Node_Str");
throw new ODataNotImplementedException();
}
}

Fixed version (ground truth):
/** 
 * This method returns the parsed where condition corresponding to the filter input in the user query.
 * @param whereExpression
 * @return Parsed where condition String
 * @throws ODataException
 */
public static String parseToJPAWhereExpression(final CommonExpression whereExpression,String tableAlias) throws ODataException {
switch (whereExpression.getKind()) {
case UNARY:
    final UnaryExpression unaryExpression=(UnaryExpression)whereExpression;
  final String operand=parseToJPAWhereExpression(unaryExpression.getOperand(),tableAlias);
switch (unaryExpression.getOperator()) {
case NOT:
  return JPQLStatement.Operator.NOT + "String_Node_Str" + operand+ "String_Node_Str";
case MINUS:
if (operand.startsWith("String_Node_Str")) return operand.substring(1);
 else return "String_Node_Str" + operand;
default :
LOGGER.error("String_Node_Str");
throw new ODataNotImplementedException();
}
case FILTER:
return parseToJPAWhereExpression(((FilterExpression)whereExpression).getExpression(),tableAlias);
case BINARY:
final BinaryExpression binaryExpression=(BinaryExpression)whereExpression;
final String left=parseToJPAWhereExpression(binaryExpression.getLeftOperand(),tableAlias);
final String right=parseToJPAWhereExpression(binaryExpression.getRightOperand(),tableAlias);
switch (binaryExpression.getOperator()) {
case AND:
return left + SPACE + JPQLStatement.Operator.AND+ SPACE+ right;
case OR:
return left + SPACE + JPQLStatement.Operator.OR+ SPACE+ right;
case EQ:
return left + SPACE + JPQLStatement.Operator.EQ+ SPACE+ right;
case NE:
return left + SPACE + JPQLStatement.Operator.NE+ SPACE+ right;
case LT:
return left + SPACE + JPQLStatement.Operator.LT+ SPACE+ right;
case LE:
return left + SPACE + JPQLStatement.Operator.LE+ SPACE+ right;
case GT:
return left + SPACE + JPQLStatement.Operator.GT+ SPACE+ right;
case GE:
return left + SPACE + JPQLStatement.Operator.GE+ SPACE+ right;
case PROPERTY_ACCESS:
LOGGER.error("String_Node_Str");
throw new ODataNotImplementedException();
default :
LOGGER.error("String_Node_Str" + binaryExpression.getOperator().name() + "String_Node_Str");
throw new ODataNotImplementedException();
}
case PROPERTY:
String returnStr=tableAlias + DOT + ((PropertyExpression)whereExpression).getPropertyName();
return returnStr;
case MEMBER:
final MemberExpression memberExpression=(MemberExpression)whereExpression;
final PropertyExpression propertyExpressionPath=(PropertyExpression)memberExpression.getPath();
return tableAlias + DOT + propertyExpressionPath.getUriLiteral()+ DOT+ memberExpression.getProperty().getUriLiteral();
case LITERAL:
final LiteralExpression literal=(LiteralExpression)whereExpression;
final EdmSimpleType literalType=(EdmSimpleType)literal.getEdmType();
String value=literalType.valueToString(literalType.valueOfString(literal.getUriLiteral(),EdmLiteralKind.URI,null,null),EdmLiteralKind.DEFAULT,null);
return evaluateComparingExpression(value,literalType);
default :
LOGGER.error("String_Node_Str" + whereExpression.getKind().name() + "String_Node_Str");
throw new ODataNotImplementedException();
}
}