[jdom-interest] JDOM 1.0b6 bug in Element.hasChildren()?

Thomas Koch Thomas.Koch at atlantec-es.com
Thu Mar 22 02:21:10 PST 2001


I believe to have identified a problem with Element.hasChildren()
that occurs when Element is subtyped. There is a test for class
equality that fails in that case even though it should succeed.

See diff below.

Thomas


*** b6/Element.java        Wed Feb 14 20:48:26 2001
--- b6-p1/Element.java        Thu Mar 22 10:46:43 2001
***************
*** 742,748 **** 
          while (i.hasNext()){
              Object obj = i.next();
              Class objclass = obj.getClass();
!             if (objclass == Element.class) {
                  return true;
              }
          }
--- 742,748 ----
          while (i.hasNext()){
              Object obj = i.next();
              Class objclass = obj.getClass();
!             if (Element.class.isAssignableFrom(objclass)) {
                  return true;
              }
          }                            




More information about the jdom-interest mailing list