Author: senaka
Date: Sun Oct 26 15:03:31 2008
New Revision: 708051

URL: http://svn.apache.org/viewvc?rev=708051&view=rev
Log:
The forceExpand method assumed that the namespace returned by getNamespace() 
would never be null. However, in theory a namespace is not mandatory for the 
creation of an OMElement. This causes an NPE, which I have fixed here.

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=708051&r1=708050&r2=708051&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
 Sun Oct 26 15:03:31 2008
@@ -268,7 +268,8 @@
             }
             String readerURI = readerFromDS.getNamespaceURI();
             readerURI = (readerURI == null) ? "" : readerURI;
-            String uri = getNamespace().getNamespaceURI();
+            String uri = (getNamespace() == null) ? "" : 
+                ((getNamespace().getNamespaceURI() == null) ? "" : 
getNamespace().getNamespaceURI());
             if (!readerURI.equals(uri)) {
                 log.error("forceExpand: expected element namespace " +
                         getLocalName() + ", found " + uri);
@@ -282,7 +283,7 @@
             String prefix = null;
             
             OMNamespace ns = getNamespace();
-            if (ns instanceof DeferredNamespace) {
+            if (ns == null || ns instanceof DeferredNamespace) {
                 // prefix is not available until after expansion
             } else {
                 prefix = ns.getPrefix();
@@ -1134,4 +1135,4 @@
         }
         
     }
-}
\ No newline at end of file
+}


Reply via email to