test_class.file: rice-framework/krad-app-framework/src/test/java/org/kuali/rice/krad/util/BeanPropertyComparatorTest.java
test_class.identifier: BeanPropertyComparatorTest
test_case.body: @Test
      /**
       * test the comparison of null objects
       */
      public void testCompare_secondNullDates() throws ParseException {
      	List propertiesD = Arrays.asList(new String[] { "d" });
      	
      	DateFormat dateFormat = SimpleDateFormat.getDateInstance(SimpleDateFormat.SHORT);
      	
      	BeanPropertyComparator comparator = new BeanPropertyComparator(propertiesD);
      	
      	D lesser = new D(dateFormat.parse("01/02/1990"));
      	D greater = new D(null);
      	
      	int result = comparator.compare(greater, lesser);
      	Assert.assertEquals(-1, result);
      	
      	result = comparator.compare(lesser, greater);
      	Assert.assertEquals(1, result);
      	
      	result = comparator.compare(lesser, lesser);
      	Assert.assertEquals(0, result);
      	
      	result = comparator.compare(greater, greater);
      	Assert.assertEquals(0, result);
      }
test_case.class_method_signature: BeanPropertyComparatorTest.testCompare_secondNullDates()
test_case.full_signature: @Test /** * test the comparison of null objects */ public void testCompare_secondNullDates()
test_case.identifier: testCompare_secondNullDates
test_case.invocations: asList getDateInstance parse compare assertEquals compare assertEquals compare assertEquals compare assertEquals
test_case.modifiers: @Test /** * test the comparison of null objects */ public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCompare_secondNullDates()
focal_class.declarator: serialVersionUID = -2675700473766186018L
focal_class.modifier: private static final
focal_class.original_string: private static final long serialVersionUID = -2675700473766186018L;
focal_class.type: long
focal_class.var_name: serialVersionUID
focal_class.declarator: ignoreCase
focal_class.original_string: boolean ignoreCase;
focal_class.type: boolean
focal_class.var_name: ignoreCase
focal_class.declarator: propertyNames
focal_class.modifier: private
focal_class.original_string: private List propertyNames;
focal_class.type: List
focal_class.var_name: propertyNames
focal_class.declarator: stringComparator
focal_class.modifier: private
focal_class.original_string: private Comparator stringComparator;
focal_class.type: Comparator
focal_class.var_name: stringComparator
focal_class.declarator: booleanComparator
focal_class.modifier: private
focal_class.original_string: private Comparator booleanComparator;
focal_class.type: Comparator
focal_class.var_name: booleanComparator
focal_class.declarator: genericComparator
focal_class.modifier: private
focal_class.original_string: private Comparator genericComparator;
focal_class.type: Comparator
focal_class.var_name: genericComparator
focal_class.file: rice-framework/krad-app-framework/src/main/java/org/kuali/rice/krad/util/BeanPropertyComparator.java
focal_class.identifier: BeanPropertyComparator
focal_class.interfaces: implements Comparator, Serializable
focal_class.class_method_signature: BeanPropertyComparator.BeanPropertyComparator(List propertyNames)
focal_class.full_signature: public  BeanPropertyComparator(List propertyNames)
focal_class.identifier: BeanPropertyComparator
focal_class.modifiers: public
focal_class.parameters: (List propertyNames)
focal_class.signature:  BeanPropertyComparator(List propertyNames)
focal_class.class_method_signature: BeanPropertyComparator.BeanPropertyComparator(List propertyNames, boolean ignoreCase)
focal_class.full_signature: public  BeanPropertyComparator(List propertyNames, boolean ignoreCase)
focal_class.identifier: BeanPropertyComparator
focal_class.modifiers: public
focal_class.parameters: (List propertyNames, boolean ignoreCase)
focal_class.signature:  BeanPropertyComparator(List propertyNames, boolean ignoreCase)
focal_class.class_method_signature: BeanPropertyComparator.compare(Object o1, Object o2)
focal_class.full_signature: public int compare(Object o1, Object o2)
focal_class.identifier: compare
focal_class.modifiers: public
focal_class.parameters: (Object o1, Object o2)
focal_class.return: int
focal_class.signature: int compare(Object o1, Object o2)
focal_method.body: public int compare(Object o1, Object o2) {
          int compared = 0;
  
          try {
              for (Iterator i = propertyNames.iterator(); (compared == 0) && i.hasNext();) {
                  String currentProperty = i.next().toString();
  
                  // choose appropriate comparator
                  Comparator currentComparator = null;
                  try {
                      PropertyDescriptor propertyDescriptor = PropertyUtils.getPropertyDescriptor(o1, currentProperty);
                      Class propertyClass = propertyDescriptor.getPropertyType();
                      if (propertyClass.equals(String.class)) {
                          currentComparator = this.stringComparator;
                      }
                      else if (TypeUtils.isBooleanClass(propertyClass)) {
                          currentComparator = this.booleanComparator;
                      }
                      else {
                          currentComparator = this.genericComparator;
                      }
                  }
                  catch (NullPointerException e) {
                      throw new BeanComparisonException("unable to find property '" + o1.getClass().getName() + "." + currentProperty + "'", e);
                  }
  
                  // compare the values
                  Object value1 = PropertyUtils.getProperty(o1, currentProperty);
                  Object value2 = PropertyUtils.getProperty(o2, currentProperty);
                  /* Fix for KULRICE-5170 : BeanPropertyComparator throws exception when a null value is found in sortable non-string data type column */
                  if ( value1 == null && value2 == null)
                      return 0;
                  else if ( value1 == null)
                      return -1;
                  else if ( value2 == null )
                      return 1;
                  /* End KULRICE-5170 Fix*/
                  compared = currentComparator.compare(value1, value2);
              }
          }
          catch (IllegalAccessException e) {
              throw new BeanComparisonException("unable to compare property values", e);
          }
          catch (NoSuchMethodException e) {
              throw new BeanComparisonException("unable to compare property values", e);
          }
          catch (InvocationTargetException e) {
              throw new BeanComparisonException("unable to compare property values", e);
          }
  
          return compared;
      }
focal_method.class_method_signature: BeanPropertyComparator.compare(Object o1, Object o2)
focal_method.full_signature: public int compare(Object o1, Object o2)
focal_method.identifier: compare
focal_method.invocations: iterator hasNext toString next getPropertyDescriptor getPropertyType equals isBooleanClass getName getClass getProperty getProperty compare
focal_method.modifiers: public
focal_method.parameters: (Object o1, Object o2)
focal_method.return: int
focal_method.signature: int compare(Object o1, Object o2)