ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/types Resource.java
Date Fri, 05 Aug 2005 15:45:18 GMT
mbenson     2005/08/05 08:45:18

  Modified:    src/main/org/apache/tools/ant/types Resource.java
  Log:
  refine toString() and compareTo() methods
  
  Revision  Changes    Path
  1.15      +2 -15     ant/src/main/org/apache/tools/ant/types/Resource.java
  
  Index: Resource.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/Resource.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Resource.java	12 Jun 2005 15:54:15 -0000	1.14
  +++ Resource.java	5 Aug 2005 15:45:18 -0000	1.15
  @@ -269,16 +269,7 @@
               throw new IllegalArgumentException(
                   "Can only be compared with Resources");
           }
  -        Resource r = (Resource) other;
  -        String name = getName();
  -        String oname = r.getName();
  -        if (name == null && oname == null) {
  -            return 0;
  -        }
  -        if (name == null) {
  -            return -1;
  -        }
  -        return oname == null ? 1 : name.compareTo(oname);
  +        return toString().compareTo(other.toString());
       }
   
       /**
  @@ -392,11 +383,7 @@
               return getCheckedRef().toString();
           }
           String n = getName();
  -        if (n != null) {
  -            return n;
  -        }
  -        String classname = getClass().getName();
  -        return "anonymous " + classname.substring(classname.lastIndexOf('.') + 1);
  +        return n == null ? "(anonymous)" : n;
       }
   
       /**
  
  
  

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


Mime
View raw message