Program: 68395
Project: 68395
Buggy source:
/** 
 * @param obj1
 * @param obj2
 * @return -1,0 and 1 standing for <,= and > respectively
 * @throws BirtException
 * @throws DataException
 */
private static int compare(Object obj1,Object obj2) throws BirtException {
  if (obj1 == null || obj2 == null) {
    if (obj1 == null && obj2 != null)     return -1;
 else     if (obj1 != null && obj2 == null)     return 1;
 else     return 0;
  }
  if (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 (obj1 instanceof BigDecimal || obj2 instanceof BigDecimal) {
    BigDecimal a=DataTypeUtil.toBigDecimal(obj1);
    BigDecimal b=DataTypeUtil.toBigDecimal(obj2);
    return a.compareTo(b);
  }
 else   if (isNumericOrString(obj1) && isNumericOrString(obj2)) {
    return DataTypeUtil.toDouble(obj1).compareTo(DataTypeUtil.toDouble(obj2));
  }
 else   if (isTimeOrString(obj1) && isTimeOrString(obj2)) {
    return DataTypeUtil.toSqlTime(obj1).compareTo(DataTypeUtil.toSqlTime(obj2));
  }
 else   if (isSQLDateOrString(obj1) && isSQLDateOrString(obj2)) {
    return DataTypeUtil.toSqlDate(obj1).compareTo(DataTypeUtil.toSqlDate(obj2));
  }
 else   if (isDateOrString(obj1) && isDateOrString(obj2)) {
    return DataTypeUtil.toDate(obj1).compareTo(DataTypeUtil.toDate(obj2));
  }
 else   throw new IllegalArgumentException();
}

Fixed version (ground truth):
/** 
 * @param obj1
 * @param obj2
 * @return -1,0 and 1 standing for <,= and > respectively
 * @throws BirtException
 * @throws DataException
 */
private static int compare(Object obj1,Object obj2) throws BirtException {
  if (obj1 == null || obj2 == null) {
    if (obj1 == null && obj2 != null)     return -1;
 else     if (obj1 != null && obj2 == null)     return 1;
 else     return 0;
  }
  if (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 (obj1 instanceof BigDecimal || obj2 instanceof BigDecimal) {
    BigDecimal a=DataTypeUtil.toBigDecimal(obj1);
    BigDecimal b=DataTypeUtil.toBigDecimal(obj2);
    return a.compareTo(b);
  }
 else   if (isNumericOrString(obj1) && isNumericOrString(obj2)) {
    return DataTypeUtil.toDouble(obj1).compareTo(DataTypeUtil.toDouble(obj2));
  }
 else   if (isTimeOrString(obj1) && isTimeOrString(obj2)) {
    return DataTypeUtil.toSqlTime(obj1).compareTo(DataTypeUtil.toSqlTime(obj2));
  }
 else   if (isSQLDateOrString(obj1) && isSQLDateOrString(obj2)) {
    return DataTypeUtil.toSqlDate(obj1).compareTo(DataTypeUtil.toSqlDate(obj2));
  }
 else   if (isDateOrString(obj1) && isDateOrString(obj2)) {
    return DataTypeUtil.toDate(obj1).compareTo(DataTypeUtil.toDate(obj2));
  }
 else {
    String object1=null;
    String object2=null;
    if (obj1 instanceof ScriptableObject)     object1=DataTypeUtil.toString(((ScriptableObject)obj1).getDefaultValue(null));
 else     object1=DataTypeUtil.toString(obj1);
    if (obj2 instanceof ScriptableObject)     object2=DataTypeUtil.toString(((ScriptableObject)obj2).getDefaultValue(null));
 else     object2=DataTypeUtil.toString(obj2);
    return compare(object1,object2);
  }
}