Program: 18101
Project: 18101
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 :
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:
throw new ODataNotImplementedException();
default :
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 :
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 :
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 + JPQLStatement.DELIMITER.SPACE + JPQLStatement.Operator.AND+ JPQLStatement.DELIMITER.SPACE+ right;
case OR:
return left + JPQLStatement.DELIMITER.SPACE + JPQLStatement.Operator.OR+ JPQLStatement.DELIMITER.SPACE+ right;
case EQ:
return left + JPQLStatement.DELIMITER.SPACE + JPQLStatement.Operator.EQ+ JPQLStatement.DELIMITER.SPACE+ right;
case NE:
return left + JPQLStatement.DELIMITER.SPACE + JPQLStatement.Operator.NE+ JPQLStatement.DELIMITER.SPACE+ right;
case LT:
return left + JPQLStatement.DELIMITER.SPACE + JPQLStatement.Operator.LT+ JPQLStatement.DELIMITER.SPACE+ right;
case LE:
return left + JPQLStatement.DELIMITER.SPACE + JPQLStatement.Operator.LE+ JPQLStatement.DELIMITER.SPACE+ right;
case GT:
return left + JPQLStatement.DELIMITER.SPACE + JPQLStatement.Operator.GT+ JPQLStatement.DELIMITER.SPACE+ right;
case GE:
return left + JPQLStatement.DELIMITER.SPACE + JPQLStatement.Operator.GE+ JPQLStatement.DELIMITER.SPACE+ right;
case PROPERTY_ACCESS:
throw new ODataNotImplementedException();
default :
throw new ODataNotImplementedException();
}
case PROPERTY:
String returnStr=tableAlias + JPQLStatement.DELIMITER.PERIOD + ((EdmProperty)((PropertyExpression)whereExpression).getEdmProperty()).getMapping().getInternalName();
return returnStr;
case MEMBER:
String memberExpStr=EMPTY;
int i=0;
MemberExpression member=null;
CommonExpression tempExp=whereExpression;
while (tempExp != null && tempExp.getKind() == ExpressionKind.MEMBER) {
member=(MemberExpression)tempExp;
if (i > 0) {
memberExpStr=JPQLStatement.DELIMITER.PERIOD + memberExpStr;
}
i++;
memberExpStr=((EdmProperty)((PropertyExpression)member.getProperty()).getEdmProperty()).getMapping().getInternalName() + memberExpStr;
tempExp=member.getPath();
}
memberExpStr=((EdmProperty)((PropertyExpression)tempExp).getEdmProperty()).getMapping().getInternalName() + JPQLStatement.DELIMITER.PERIOD + memberExpStr;
return tableAlias + JPQLStatement.DELIMITER.PERIOD + memberExpStr;
case LITERAL:
final LiteralExpression literal=(LiteralExpression)whereExpression;
final EdmSimpleType literalType=(EdmSimpleType)literal.getEdmType();
String value=literalType.valueToString(literalType.valueOfString(literal.getUriLiteral(),EdmLiteralKind.URI,null,literalType.getDefaultType()),EdmLiteralKind.DEFAULT,null);
return evaluateComparingExpression(value,literalType);
default :
throw new ODataNotImplementedException();
}
}