You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by pe...@apache.org on 2003/09/26 12:16:02 UTC

cvs commit: ant/src/main/org/apache/tools/ant UnknownElement.java

peterreilly    2003/09/26 03:16:02

  Modified:    src/main/org/apache/tools/ant UnknownElement.java
  Log:
  UE#similar had forgot to check the text
  
  Revision  Changes    Path
  1.64      +16 -2     ant/src/main/org/apache/tools/ant/UnknownElement.java
  
  Index: UnknownElement.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/UnknownElement.java,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- UnknownElement.java	10 Sep 2003 10:37:13 -0000	1.63
  +++ UnknownElement.java	26 Sep 2003 10:16:02 -0000	1.64
  @@ -552,6 +552,7 @@
               return false;
           }
           UnknownElement other = (UnknownElement) obj;
  +        // Are the names the same ?
           if (!equalsString(elementName, other.elementName)) {
               return false;
           }
  @@ -561,12 +562,25 @@
           if (!qname.equals(other.qname)) {
               return false;
           }
  +        // Are attributes the same ?
           if (!getWrapper().getAttributeMap().equals(
                   other.getWrapper().getAttributeMap())) {
               return false;
           }
  -        if (children == null) {
  -            return other.children == null;
  +        // Is the text the same?
  +        //   Need to use equals on the string and not
  +        //   on the stringbuffer as equals on the string buffer
  +        //   does not compare the contents.
  +        if (!getWrapper().getText().toString().equals(
  +                other.getWrapper().getText().toString())) {
  +            return false;
  +        }
  +        // Are the sub elements the same ?
  +        if (children == null || children.size() == 0) {
  +            return other.children == null || other.children.size() == 0;
  +        }
  +        if (other.children == null) {
  +            return false;
           }
           if (children.size() != other.children.size()) {
               return false;
  
  
  

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