ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1334335 - /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
Date Sat, 05 May 2012 07:56:22 GMT
Author: veithen
Date: Sat May  5 07:56:22 2012
New Revision: 1334335

URL: http://svn.apache.org/viewvc?rev=1334335&view=rev
Log:
AXIOM-399: Also check that the prefix matches when expanding an OMSourcedElement.

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java?rev=1334335&r1=1334334&r2=1334335&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
Sat May  5 07:56:22 2012
@@ -286,12 +286,25 @@ public class OMSourcedElementImpl extend
             }
             if (definedNamespaceSet) {
                 String readerURI = readerFromDS.getNamespaceURI();
-                readerURI = (readerURI == null) ? "" : readerURI;
-                String uri = (getNamespace() == null) ? "" : getNamespace().getNamespaceURI();
+                if (readerURI == null) {
+                    readerURI = "";
+                }
+                String uri = definedNamespace == null ? "" : definedNamespace.getNamespaceURI();
                 if (!readerURI.equals(uri)) {
                     throw new OMException("Element namespace from data source is " +
                             readerURI + ", not the expected " + uri);
                 }
+                if (!(definedNamespace instanceof DeferredNamespace)) {
+                    String readerPrefix = readerFromDS.getPrefix();
+                    if (readerPrefix == null) {
+                        readerPrefix = "";
+                    }
+                    String prefix = definedNamespace == null ? "" : definedNamespace.getPrefix();
+                    if (!readerPrefix.equals(prefix)) {
+                        throw new OMException("Element prefix from data source is '" +
+                                readerPrefix + "', not the expected '" + prefix + "'");
+                    }
+                }
             }
 
             // Set the builder for this element. Note that the StAXOMBuilder constructor
will also



Mime
View raw message