Program: 76810
Project: 76810
Buggy source:
/** 
 * Most objects should already be formatted to the same type by method formatToComparable at this point if neither of them is null. This method will therefore be terminated pretty soon except for calling from method between with weird parameters like obj:String, op1:Double and op2:Date.
 * @param obj1
 * @param obj2
 * @return -1,0 and 1 standing for <,= and > respectively
 * @throws DataException
 */
public static int compare(Object obj1,Object obj2) throws DataException {
  if (obj1 == null || obj2 == null) {
    if (obj1 == null && obj2 != null)     return -1;
 else     if (obj1 != null && obj2 == null)     return 1;
 else     return 0;
  }
  try {
    if (MiscUtil.isSameType(obj1,obj2)) {
      if (obj1 instanceof Boolean) {
        if (obj1.equals(obj2))         return 0;
        Boolean bool=(Boolean)obj1;
        if (bool.equals(Boolean.TRUE))         return 1;
 else         return -1;
      }
 else       if (obj1 instanceof Comparable) {
        if (obj1 instanceof String) {
          return myCollator.compare(obj1,obj2);
        }
 else {
          return ((Comparable)obj1).compareTo(obj2);
        }
      }
 else {
        return myCollator.compare(obj1.toString(),obj2.toString());
      }
    }
 else     if (MiscUtil.isNumericOrString(obj1) && MiscUtil.isNumericOrString(obj2)) {
      return DataTypeUtil.toDouble(obj1).compareTo(DataTypeUtil.toDouble(obj2));
    }
 else     if (MiscUtil.isDateOrString(obj1) && MiscUtil.isDateOrString(obj2)) {
      return DataTypeUtil.toDate(obj1).compareTo(DataTypeUtil.toDate(obj2));
    }
 else     throw new DataException(ResourceConstants.INVALID_TYPE_IN_EXPR);
  }
 catch (  BirtException e) {
    throw new DataException(ResourceConstants.DATATYPEUTIL_ERROR,e);
  }
}

Fixed version (ground truth):
/** 
 * Most objects should already be formatted to the same type by method formatToComparable at this point if neither of them is null. This method will therefore be terminated pretty soon except for calling from method between with weird parameters like obj:String, op1:Double and op2:Date.
 * @param obj1
 * @param obj2
 * @return -1,0 and 1 standing for <,= and > respectively
 * @throws DataException
 */
public static int compare(Object obj1,Object obj2) throws DataException {
  if (obj1 == null || obj2 == null) {
    if (obj1 == null && obj2 != null)     return -1;
 else     if (obj1 != null && obj2 == null)     return 1;
 else     return 0;
  }
  try {
    if (MiscUtil.isSameType(obj1,obj2)) {
      if (obj1 instanceof Boolean) {
        if (obj1.equals(obj2))         return 0;
        Boolean bool=(Boolean)obj1;
        if (bool.equals(Boolean.TRUE))         return 1;
 else         return -1;
      }
 else       if (obj1 instanceof Comparable) {
        return ((Comparable)obj1).compareTo(obj2);
      }
 else {
        return obj1.toString().compareTo(obj2.toString());
      }
    }
 else     if (MiscUtil.isNumericOrString(obj1) && MiscUtil.isNumericOrString(obj2)) {
      return DataTypeUtil.toDouble(obj1).compareTo(DataTypeUtil.toDouble(obj2));
    }
 else     if (MiscUtil.isDateOrString(obj1) && MiscUtil.isDateOrString(obj2)) {
      return DataTypeUtil.toDate(obj1).compareTo(DataTypeUtil.toDate(obj2));
    }
 else     throw new DataException(ResourceConstants.INVALID_TYPE_IN_EXPR);
  }
 catch (  BirtException e) {
    throw new DataException(ResourceConstants.DATATYPEUTIL_ERROR,e);
  }
}