commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tobr...@apache.org
Subject cvs commit: jakarta-commons/codec/src/java/org/apache/commons/codec StringEncoderComparator.java
Date Sun, 12 Oct 2003 01:34:06 GMT
tobrien     2003/10/11 18:34:06

  Modified:    codec/src/java/org/apache/commons/codec
                        StringEncoderComparator.java
  Log:
  The StringEncoderComparator used to call o1.toString(), and
  o2.toString() on the parameters supplied to the compare
  method.  There is no need to require that only Strings
  are passed to the StringEncoderComparator - (actually
  there is no reason why we couldn't have a generic Encoder
  comparator.  This patch is the first step towards a more
  generic object, and it allows us to test the exception condition
  in this compare() method.
  
  Revision  Changes    Path
  1.7       +3 -3      jakarta-commons/codec/src/java/org/apache/commons/codec/StringEncoderComparator.java
  
  Index: StringEncoderComparator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/StringEncoderComparator.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StringEncoderComparator.java	5 Oct 2003 21:45:48 -0000	1.6
  +++ StringEncoderComparator.java	12 Oct 2003 01:34:06 -0000	1.7
  @@ -103,8 +103,8 @@
           int compareCode = 0;
   
           try {
  -            String s1 = stringEncoder.encode(o1.toString());
  -            String s2 = stringEncoder.encode(o2.toString());
  +            Comparable s1 = (Comparable) ((Encoder) stringEncoder).encode(o1);
  +            Comparable s2 = (Comparable) ((Encoder) stringEncoder).encode(o2);
               compareCode = s1.compareTo(s2);
           } 
           catch (EncoderException ee) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message