Program: 73416
Project: 73416
Buggy source:
/** 
 * @param sortSpec
 * @return Comparator based on specified sortSpec, null indicates there isno need to do sorting
 */
private static Comparator getComparator(SortSpec sortSpec,final IEventHandler eventHandler){
  if (sortSpec == null)   return null;
  final int[] sortKeyIndexes=sortSpec.sortKeyIndexes;
  final String[] sortKeyColumns=sortSpec.sortKeyColumns;
  if (sortKeyIndexes == null || sortKeyIndexes.length == 0)   return null;
  final boolean[] sortAscending=sortSpec.sortAscending;
  Comparator comparator=new Comparator(){
    /** 
 * compares two row indexes, actually compares two rows pointed by the two row indexes
 */
    public int compare(    Object obj1,    Object obj2){
      IResultObject row1=(IResultObject)obj1;
      IResultObject row2=(IResultObject)obj2;
      for (int i=0; i < sortKeyIndexes.length; i++) {
        int colIndex=sortKeyIndexes[i];
        String colName=sortKeyColumns[i];
        try {
          Object colObj1=null;
          Object colObj2=null;
          if (eventHandler != null) {
            colObj1=eventHandler.getValue(row1,colIndex,colName);
            colObj2=eventHandler.getValue(row2,colIndex,colName);
          }
 else {
            colObj1=row1.getFieldValue(colIndex);
            colObj2=row2.getFieldValue(colIndex);
          }
          int result=CompareUtil.compare(colObj1,colObj2);
          if (result != 0) {
            return sortAscending[i] ? result : -result;
          }
        }
 catch (        DataException e) {
        }
      }
      return 0;
    }
  }
;
  return comparator;
}

Fixed version (ground truth):
/** 
 * @param sortSpec
 * @return Comparator based on specified sortSpec, null indicates there isno need to do sorting
 */
private static Comparator getComparator(SortSpec sortSpec,final IEventHandler eventHandler){
  if (sortSpec == null)   return null;
  final int[] sortKeyIndexes=sortSpec.getSortKeyIndexes();
  final String[] sortKeyColumns=sortSpec.getSortKeyColumns();
  if (sortKeyIndexes == null || sortKeyIndexes.length == 0)   return null;
  final boolean[] sortAscending=sortSpec.getSortAscending();
  final Comparator[] comparators=sortSpec.getComparator();
  Comparator comparator=new Comparator(){
    /** 
 * compares two row indexes, actually compares two rows pointed by the two row indexes
 */
    public int compare(    Object obj1,    Object obj2){
      IResultObject row1=(IResultObject)obj1;
      IResultObject row2=(IResultObject)obj2;
      for (int i=0; i < sortKeyIndexes.length; i++) {
        int colIndex=sortKeyIndexes[i];
        String colName=sortKeyColumns[i];
        try {
          Object colObj1=null;
          Object colObj2=null;
          if (eventHandler != null) {
            colObj1=eventHandler.getValue(row1,colIndex,colName);
            colObj2=eventHandler.getValue(row2,colIndex,colName);
          }
 else {
            colObj1=row1.getFieldValue(colIndex);
            colObj2=row2.getFieldValue(colIndex);
          }
          int result=ScriptEvalUtil.compare(colObj1,colObj2,comparators[i]);
          if (result != 0) {
            return sortAscending[i] ? result : -result;
          }
        }
 catch (        DataException e) {
        }
      }
      return 0;
    }
  }
;
  return comparator;
}