svn commit: r647015 - /lenya/sandbox/modules/diff/java/src/org/apache/lenya/modules/diff/xml/impl/ElementImpl.java

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Thu Apr 10 16:44:34 2008
New Revision: 647015

URL: http://svn.apache.org/viewvc?rev=647015&view=rev
Log:
Handle case that namespace URIs of elements are null.

Modified:
    lenya/sandbox/modules/diff/java/src/org/apache/lenya/modules/diff/xml/impl/ElementImpl.java

Modified: lenya/sandbox/modules/diff/java/src/org/apache/lenya/modules/diff/xml/impl/ElementImpl.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/diff/java/src/org/apache/lenya/modules/diff/xml/impl/ElementImpl.java?rev=647015&r1=647014&r2=647015&view=diff
==============================================================================
--- lenya/sandbox/modules/diff/java/src/org/apache/lenya/modules/diff/xml/impl/ElementImpl.java (original)
+++ lenya/sandbox/modules/diff/java/src/org/apache/lenya/modules/diff/xml/impl/ElementImpl.java Thu Apr 10 16:44:34 2008
@@ -36,8 +36,13 @@
             for (int i = 0; i < children.length; i++) {
                 if (children[i] instanceof Element) {
                     Element element = (Element) children[i];
-                    if (element.getLocalName().equals(getLocalName())
-                            && element.getNamespaceUri().equals(getNamespaceUri())) {
+                    String otherLocal = element.getLocalName();
+                    String local = getLocalName();
+                    String otherNs = element.getNamespaceUri();
+                    String ns = getNamespaceUri();
+                    if (local.equals(otherLocal)
+                            && ((ns == null && otherNs == null) || (ns != null && otherNs != null && ns
+                                    .equals(otherNs)))) {
                         sameTypeChildren.add(element);
                     }
                 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.