Program: 75323
Project: 75323
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) {
        return ((Comparable)obj1).compareTo(obj2);
      }
 else {
        return obj1.toString().compareTo(obj2.toString());
      }
    }
 else     if (MiscUtil.isNumericOrString(obj1) && MiscUtil.isNumericOrString(obj2)) {
      try {
        return DataTypeUtil.toDouble(obj1).compareTo(DataTypeUtil.toDouble(obj2));
      }
 catch (      Exception e) {
        return DataTypeUtil.toString(obj1).compareTo(DataTypeUtil.toString(obj2));
      }
    }
 else     if (MiscUtil.isDateOrString(obj1) && MiscUtil.isDateOrString(obj2)) {
      try {
        return DataTypeUtil.toDate(obj1).compareTo(DataTypeUtil.toDate(obj2));
      }
 catch (      Exception e) {
        return DataTypeUtil.toString(obj1).compareTo(DataTypeUtil.toString(obj2));
      }
    }
 else     if (MiscUtil.isBooleanOrString(obj1) && MiscUtil.isBooleanOrString(obj2)) {
      try {
        return DataTypeUtil.toBoolean(obj1).compareTo(DataTypeUtil.toBoolean(obj2));
      }
 catch (      Exception e) {
        return DataTypeUtil.toString(obj1).compareTo(DataTypeUtil.toString(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)) {
      try {
        return DataTypeUtil.toDouble(obj1).compareTo(DataTypeUtil.toDouble(obj2));
      }
 catch (      Exception e) {
        return DataTypeUtil.toString(obj1).compareTo(DataTypeUtil.toString(obj2));
      }
    }
 else     if (MiscUtil.isDateOrString(obj1) && MiscUtil.isDateOrString(obj2)) {
      try {
        return DataTypeUtil.toDate(obj1).compareTo(DataTypeUtil.toDate(obj2));
      }
 catch (      Exception e) {
        return DataTypeUtil.toString(obj1).compareTo(DataTypeUtil.toString(obj2));
      }
    }
 else     if (MiscUtil.isBooleanOrString(obj1) && MiscUtil.isBooleanOrString(obj2)) {
      try {
        boolean b1=DataTypeUtil.toBoolean(obj1).booleanValue();
        boolean b2=DataTypeUtil.toBoolean(obj2).booleanValue();
        if (b1 == b2) {
          return 0;
        }
 else         if (b1 == false && b2 == true) {
          return -1;
        }
 else {
          return 1;
        }
      }
 catch (      Exception e) {
        return DataTypeUtil.toString(obj1).compareTo(DataTypeUtil.toString(obj2));
      }
    }
 else     throw new DataException(ResourceConstants.INVALID_TYPE_IN_EXPR);
  }
 catch (  BirtException e) {
    throw new DataException(ResourceConstants.DATATYPEUTIL_ERROR,e);
  }
}