Program: 78552
Project: 78552
Buggy source:
/** 
 * Evaluates a conditional expression. A conditional expression comprises of a Javascript expression, an operator, and up to 2 operands (which are Javascript expressions themselves).<br> Both op1 and op2 will be encapsulated to ExprTextAndValue type to show specific message in case anything goes wrong, they are assumed not to be null as well. <p> The basic rule for comparison: obj will always be considered as the default data type,i.e. obj, op1 and op2 will be formatted to the superset of obj (or Double if obj is numeric)on the condition they are comparable.<br> e.g.<br> obj: Integer=>obj, op1 and op2 will be formatted to Double.<br> obj: Timestamp=>obj, op1 and op2 will be formatted to Date.<br> obj: Boolean=>obj and op1 will be formatted to Boolean.<br> obj: String=>obj, op1 and op2 will remain the same
 * @param obj
 * @param operator
 * @param op1
 * @param op2
 * @return A Boolean result
 * @throws DataException
 */
public static Object evalConditionalExpr(Object obj,int operator,ExprTextAndValue op1,ExprTextAndValue op2) throws DataException {
  Object resultObject=obj;
  Object resultOp1=op1.value;
  Object resultOp2=op2.value;
  Object[] obArray=MiscUtil.isComparable(obj,operator,op1,op2);
  if (obArray != null) {
    resultObject=obArray[0];
    resultOp1=obArray[1];
    resultOp2=obArray[2];
  }
  if (logger.isLoggable(Level.FINER))   logger.entering(ScriptEvalUtil.class.getName(),"String_Node_Str","String_Node_Str" + LogUtil.toString(resultObject) + "String_Node_Str"+ operator+ (resultOp1 == null ? null : ("String_Node_Str" + LogUtil.toString(resultOp1)))+ (resultOp2 == null ? null : ("String_Node_Str" + LogUtil.toString(resultOp2))));
  boolean result=false;
switch (operator) {
case IConditionalExpression.OP_EQ:
    result=compare(resultObject,resultOp1) == 0;
  break;
case IConditionalExpression.OP_NE:
result=compare(resultObject,resultOp1) != 0;
break;
case IConditionalExpression.OP_LT:
result=compare(resultObject,resultOp1) < 0;
break;
case IConditionalExpression.OP_LE:
result=compare(resultObject,resultOp1) <= 0;
break;
case IConditionalExpression.OP_GE:
result=compare(resultObject,resultOp1) >= 0;
break;
case IConditionalExpression.OP_GT:
result=compare(resultObject,resultOp1) > 0;
break;
case IConditionalExpression.OP_BETWEEN:
result=between(resultObject,resultOp1,resultOp2);
break;
case IConditionalExpression.OP_NOT_BETWEEN:
result=!(between(resultObject,resultOp1,resultOp2));
break;
case IConditionalExpression.OP_NULL:
result=resultObject == null;
break;
case IConditionalExpression.OP_NOT_NULL:
result=resultObject != null;
break;
case IConditionalExpression.OP_TRUE:
result=isTrueOrFalse(resultObject,Boolean.TRUE);
break;
case IConditionalExpression.OP_FALSE:
result=isTrueOrFalse(resultObject,Boolean.FALSE);
break;
case IConditionalExpression.OP_LIKE:
result=like(resultObject,resultOp1);
break;
case IConditionalExpression.OP_TOP_N:
result=isTopN(resultObject,resultOp1);
break;
case IConditionalExpression.OP_BOTTOM_N:
result=isBottomN(resultObject,resultOp1);
break;
case IConditionalExpression.OP_TOP_PERCENT:
result=isTopPercent(resultObject,resultOp1);
break;
case IConditionalExpression.OP_BOTTOM_PERCENT:
result=isBottomPercent(resultObject,resultOp1);
break;
case IConditionalExpression.OP_ANY:
throw new DataException(ResourceConstants.UNSUPPORTTED_COND_OPERATOR,"String_Node_Str");
case IConditionalExpression.OP_MATCH:
result=match(resultObject,resultOp1);
break;
default :
throw new DataException(ResourceConstants.UNSUPPORTTED_COND_OPERATOR,new Integer(operator));
}
logger.exiting(ScriptEvalUtil.class.getName(),"String_Node_Str",new Boolean(result));
return new Boolean(result);
}

Fixed version (ground truth):
/** 
 * Evaluates a conditional expression. A conditional expression comprises of a Javascript expression, an operator, and up to 2 operands (which are Javascript expressions themselves).<br> Both op1 and op2 will be encapsulated to ExprTextAndValue type to show specific message in case anything goes wrong, they are assumed not to be null as well. <p> The basic rule for comparison: obj will always be considered as the default data type,i.e. obj, op1 and op2 will be formatted to the superset of obj (or Double if obj is numeric)on the condition they are comparable.<br> e.g.<br> obj: Integer=>obj, op1 and op2 will be formatted to Double.<br> obj: Timestamp=>obj, op1 and op2 will be formatted to Date.<br> obj: Boolean=>obj and op1 will be formatted to Boolean.<br> obj: String=>obj, op1 and op2 will remain the same
 * @param obj
 * @param operator
 * @param op1
 * @param op2
 * @return A Boolean result
 * @throws DataException
 */
public static Object evalConditionalExpr(Object obj,int operator,ExprTextAndValue op1,ExprTextAndValue op2) throws DataException {
  Object resultObject=obj;
  Object resultOp1=op1.value;
  Object resultOp2=op2.value;
  Object[] obArray=MiscUtil.isComparable(obj,operator,op1,op2);
  if (obArray != null) {
    resultObject=obArray[0];
    resultOp1=obArray[1];
    resultOp2=obArray[2];
  }
  if (logger.isLoggable(Level.FINER))   logger.entering(ScriptEvalUtil.class.getName(),"String_Node_Str","String_Node_Str" + LogUtil.toString(resultObject) + "String_Node_Str"+ operator+ (resultOp1 == null ? null : ("String_Node_Str" + LogUtil.toString(resultOp1)))+ (resultOp2 == null ? null : ("String_Node_Str" + LogUtil.toString(resultOp2))));
  boolean result=false;
switch (operator) {
case IConditionalExpression.OP_EQ:
    result=compare(resultObject,resultOp1) == 0;
  break;
case IConditionalExpression.OP_NE:
result=compare(resultObject,resultOp1) != 0;
break;
case IConditionalExpression.OP_LT:
result=compare(resultObject,resultOp1) < 0;
break;
case IConditionalExpression.OP_LE:
result=compare(resultObject,resultOp1) <= 0;
break;
case IConditionalExpression.OP_GE:
result=compare(resultObject,resultOp1) >= 0;
break;
case IConditionalExpression.OP_GT:
result=compare(resultObject,resultOp1) > 0;
break;
case IConditionalExpression.OP_BETWEEN:
result=between(resultObject,resultOp1,resultOp2);
break;
case IConditionalExpression.OP_NOT_BETWEEN:
result=!(between(resultObject,resultOp1,resultOp2));
break;
case IConditionalExpression.OP_NULL:
result=resultObject == null;
break;
case IConditionalExpression.OP_NOT_NULL:
result=resultObject != null;
break;
case IConditionalExpression.OP_TRUE:
result=isTrueOrFalse(resultObject,Boolean.TRUE);
break;
case IConditionalExpression.OP_FALSE:
result=isTrueOrFalse(resultObject,Boolean.FALSE);
break;
case IConditionalExpression.OP_LIKE:
result=like(resultObject,resultOp1);
break;
case IConditionalExpression.OP_TOP_N:
case IConditionalExpression.OP_BOTTOM_N:
case IConditionalExpression.OP_TOP_PERCENT:
case IConditionalExpression.OP_BOTTOM_PERCENT:
throw new DataException(ResourceConstants.UNSUPPORTTED_COND_OPERATOR,"String_Node_Str");
case IConditionalExpression.OP_ANY:
throw new DataException(ResourceConstants.UNSUPPORTTED_COND_OPERATOR,"String_Node_Str");
case IConditionalExpression.OP_MATCH:
result=match(resultObject,resultOp1);
break;
default :
throw new DataException(ResourceConstants.UNSUPPORTTED_COND_OPERATOR,new Integer(operator));
}
logger.exiting(ScriptEvalUtil.class.getName(),"String_Node_Str",new Boolean(result));
return new Boolean(result);
}