result = comp1.compareTo( comp2 );
if ( colObj1.getClass( ) != colObj2.getClass( ) && colObj1 instanceof Number && colObj2 instanceof Number ) { try { comp1 = (Comparable) DataTypeUtil.toDouble( colObj1 ); comp2 = (Comparable) DataTypeUtil.toDouble( colObj2 ); } catch ( BirtException ex ) {  } }  result = comp1.compareTo( comp2 );
	private Comparator getComparator( SortSpec sortSpec )	{		if ( sortSpec == null )			return null;		final int[] sortKeyIndexes = sortSpec.sortKeyIndexes;		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;				// compare group keys first				for ( int i = 0; i < sortKeyIndexes.length; i++ )				{					int colIndex = sortKeyIndexes[i];									try					{						Object colObj1 = row1.getFieldValue( colIndex );						Object colObj2 = row2.getFieldValue( colIndex );						int result = doCompare( colObj1, colObj2 );						if ( result != 0 )						{							return sortAscending[i] ? result : -result;						}					}					catch ( DataException e )					{						// Should never get here						// colIndex is always valid					}				}				// all equal, so return 0				return 0;			}			/**			 * Compare two objects			 * 			 * @param colObj1			 * @param colObj2			 * @return true colObj1 equals colObj2			 */			private int doCompare( Object colObj1, Object colObj2 )			{				// default value is 0				int result = 0;				// 1: the case of reference is the same				if ( colObj1 == colObj2 )				{					return result;				}				// 2: the case of one of two object is null				if ( colObj1 == null || colObj2 == null )				{					// keep null value at the first position in ascending order					if ( colObj1 == null )					{						result = -1;					}					else					{						result = 1;					}					return result;				}				// 3: other cases				if ( colObj1.equals( colObj2 ) )				{					return result;				}				else if ( colObj1 instanceof Comparable						&& colObj2 instanceof Comparable )				{					Comparable comp1 = (Comparable) colObj1;					Comparable comp2 = (Comparable) colObj2;					result = comp1.compareTo( comp2 );				}				else if ( colObj1 instanceof Boolean						&& colObj2 instanceof Boolean )				{					// false is less than true					Boolean bool = (Boolean) colObj1;					if ( bool.equals( Boolean.TRUE ) )						result = 1;					else						result = -1;				}				else				{					// Should never get here					//throw new UnsupportedOperationException( );				}				return result;			}		};		return comparator;	}