Program: 76468
Project: 76468
Buggy source:
/** 
 * To ease the methods compare and between. Exception with specific explanation will be thrown if anything goes wrong.
 * @param obj
 * @param op1
 * @param op2
 * @return
 * @throws DataException
 */
private static Object[] formatToComparable(Object obj,ExprTextAndValue op1,ExprTextAndValue op2) throws DataException {
  Object[] obArray=new Object[3];
  obArray[0]=obj;
  obArray[1]=op1.value;
  obArray[2]=op2.value;
  if (isSameType(obj,obArray[1])) {
    if (obArray[2] == null || (obArray[2] != null && isSameType(obj,obArray[2]))) {
      return obArray;
    }
  }
  try {
    if (obj instanceof Number) {
      obArray[0]=DataTypeUtil.toDouble(obj);
      obArray[1]=DataTypeUtil.toDouble(obArray[1]);
      if (obArray[2] != null) {
        obArray[2]=DataTypeUtil.toDouble(obArray[2]);
      }
    }
 else     if (obj instanceof Date) {
      obArray[0]=DataTypeUtil.toDate(obj);
      obArray[1]=DataTypeUtil.toDate(obArray[1]);
      if (obArray[2] != null) {
        obArray[2]=DataTypeUtil.toDate(obArray[2]);
      }
    }
 else     if (obj instanceof Boolean) {
      obArray[0]=DataTypeUtil.toBoolean(obj);
      obArray[1]=DataTypeUtil.toBoolean(obArray[1]);
    }
  }
 catch (  BirtException e) {
    try {
      makeObjectArrayStringArray(obArray);
    }
 catch (    BirtException e1) {
    }
  }
  return obArray;
}

Fixed version (ground truth):
/** 
 * To ease the methods compare and between. Exception with specific explanation will be thrown if anything goes wrong.
 * @param obj
 * @param op1
 * @param op2
 * @return
 * @throws DataException
 */
private static Object[] formatToComparable(Object obj,ExprTextAndValue op1,ExprTextAndValue op2) throws DataException {
  Object[] obArray=new Object[3];
  obArray[0]=obj;
  obArray[1]=op1.value;
  obArray[2]=op2.value;
  if (isSameType(obj,obArray[1])) {
    if (obArray[2] == null || (obArray[2] != null && isSameType(obj,obArray[2]))) {
      return obArray;
    }
  }
  try {
    if (obj instanceof Number) {
      obArray[0]=DataTypeUtil.toDouble(obj);
      obArray[1]=DataTypeUtil.toDouble(obArray[1]);
      if (obArray[2] != null) {
        obArray[2]=DataTypeUtil.toDouble(obArray[2]);
      }
    }
 else     if (obj instanceof java.sql.Date) {
      obArray[0]=DataTypeUtil.toSqlDate(obj);
      obArray[1]=DataTypeUtil.toSqlDate(obArray[1]);
      if (obArray[2] != null) {
        obArray[2]=DataTypeUtil.toSqlDate(obArray[2]);
      }
    }
 else     if (obj instanceof java.sql.Time) {
      obArray[0]=DataTypeUtil.toSqlTime(obj);
      obArray[1]=DataTypeUtil.toSqlTime(obArray[1]);
      if (obArray[2] != null) {
        obArray[2]=DataTypeUtil.toSqlTime(obArray[2]);
      }
    }
 else     if (obj instanceof Date) {
      obArray[0]=DataTypeUtil.toDate(obj);
      obArray[1]=DataTypeUtil.toDate(obArray[1]);
      if (obArray[2] != null) {
        obArray[2]=DataTypeUtil.toDate(obArray[2]);
      }
    }
 else     if (obj instanceof Boolean) {
      obArray[0]=DataTypeUtil.toBoolean(obj);
      obArray[1]=DataTypeUtil.toBoolean(obArray[1]);
    }
  }
 catch (  BirtException e) {
    try {
      makeObjectArrayStringArray(obArray);
    }
 catch (    BirtException e1) {
    }
  }
  return obArray;
}