Program: 78104
Project: 78104
Buggy source:
/** 
 * @param dataExpr
 * @param odiResult
 * @param scope
 * @param logger
 * @return
 * @throws BirtException
 */
public static Object evaluateExpression(IBaseExpression dataExpr,IResultIterator odiResult,Scriptable scope,Logger logger) throws BirtException {
  Object exprValue=null;
  if (dataExpr == null)   throw new DataException(ResourceConstants.BAD_DATA_EXPRESSION);
  Object handle=dataExpr.getHandle();
  if (handle instanceof CompiledExpression) {
    CompiledExpression expr=(CompiledExpression)handle;
    Object value=evaluateCompiledExpression(expr,odiResult,scope);
    try {
      exprValue=DataTypeUtil.convert(value,dataExpr.getDataType());
    }
 catch (    BirtException e) {
      throw new DataException(ResourceConstants.INCONVERTIBLE_DATATYPE,new Object[]{value,value.getClass(),DataType.getClass(dataExpr.getDataType())});
    }
  }
 else   if (handle instanceof ConditionalExpression) {
    ConditionalExpression ce=(ConditionalExpression)handle;
    Object resultExpr=evaluateExpression(ce.getExpression(),odiResult,scope,logger);
    Object resultOp1=ce.getOperand1() != null ? evaluateExpression(ce.getOperand1(),odiResult,scope,logger) : null;
    Object resultOp2=ce.getOperand2() != null ? evaluateExpression(ce.getOperand2(),odiResult,scope,logger) : null;
    String op1Text=ce.getOperand1() != null ? ce.getOperand1().getText() : null;
    String op2Text=ce.getOperand2() != null ? ce.getOperand2().getText() : null;
    exprValue=ScriptEvalUtil.evalConditionalExpr(resultExpr,ce.getOperator(),ScriptEvalUtil.newExprInfo(op1Text,resultOp1),ScriptEvalUtil.newExprInfo(op2Text,resultOp2));
  }
 else {
    DataException e=new DataException(ResourceConstants.INVALID_EXPR_HANDLE);
    logger.logp(Level.FINE,ResultIterator.class.getName(),"String_Node_Str","String_Node_Str",e);
    throw e;
  }
  if (exprValue instanceof DataExceptionMocker) {
    throw ((DataExceptionMocker)exprValue).getCause();
  }
  return exprValue;
}

Fixed version (ground truth):
/** 
 * @param dataExpr
 * @param odiResult
 * @param scope
 * @param logger
 * @return
 * @throws BirtException
 */
public static Object evaluateExpression(IBaseExpression dataExpr,IResultIterator odiResult,Scriptable scope) throws BirtException {
  Object exprValue=null;
  if (dataExpr == null)   throw new DataException(ResourceConstants.BAD_DATA_EXPRESSION);
  Object handle=dataExpr.getHandle();
  if (handle instanceof CompiledExpression) {
    CompiledExpression expr=(CompiledExpression)handle;
    Object value=evaluateCompiledExpression(expr,odiResult,scope);
    try {
      exprValue=DataTypeUtil.convert(value,dataExpr.getDataType());
    }
 catch (    BirtException e) {
      throw new DataException(ResourceConstants.INCONVERTIBLE_DATATYPE,new Object[]{value,value.getClass(),DataType.getClass(dataExpr.getDataType())});
    }
  }
 else   if (handle instanceof ConditionalExpression) {
    ConditionalExpression ce=(ConditionalExpression)handle;
    Object resultExpr=evaluateExpression(ce.getExpression(),odiResult,scope);
    Object resultOp1=ce.getOperand1() != null ? evaluateExpression(ce.getOperand1(),odiResult,scope) : null;
    Object resultOp2=ce.getOperand2() != null ? evaluateExpression(ce.getOperand2(),odiResult,scope) : null;
    String op1Text=ce.getOperand1() != null ? ce.getOperand1().getText() : null;
    String op2Text=ce.getOperand2() != null ? ce.getOperand2().getText() : null;
    exprValue=ScriptEvalUtil.evalConditionalExpr(resultExpr,ce.getOperator(),ScriptEvalUtil.newExprInfo(op1Text,resultOp1),ScriptEvalUtil.newExprInfo(op2Text,resultOp2));
  }
 else {
    DataException e=new DataException(ResourceConstants.INVALID_EXPR_HANDLE);
    throw e;
  }
  if (exprValue instanceof DataExceptionMocker) {
    throw ((DataExceptionMocker)exprValue).getCause();
  }
  return exprValue;
}