You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ru...@apache.org on 2005/12/17 19:39:27 UTC

svn commit: r357364 - /webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAP11BuilderHelper.java

Author: ruchithf
Date: Sat Dec 17 10:39:17 2005
New Revision: 357364

URL: http://svn.apache.org/viewcvs?rev=357364&view=rev
Log:
A fix to get rid of the NPE when we process SOAP 1.1 SOAPFaults using DOOM

Explanation:
faultcode, faultstring, faultactor, detail are not namespace qualified in SOAP 1.1 and SOAP11BuilderHelper tries to do getLocalName on those elements. But if the in this case a DOOM element will return null See: http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Node.html#getLocalName(). Therefore we have to use getTagName() to get the name of the element if its not qualified


Modified:
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAP11BuilderHelper.java

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAP11BuilderHelper.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAP11BuilderHelper.java?rev=357364&r1=357363&r2=357364&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAP11BuilderHelper.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAP11BuilderHelper.java Sat Dec 17 10:39:17 2005
@@ -28,6 +28,7 @@
 import org.apache.axis2.soap.SOAPFaultText;
 import org.apache.axis2.soap.SOAPFaultValue;
 import org.apache.axis2.soap.SOAPProcessingException;
+import org.w3c.dom.Element;
 
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
@@ -111,14 +112,21 @@
 
         } else if (elementLevel == 5) {
 
-            if (parent.getLocalName().equals(SOAP_FAULT_CODE_LOCAL_NAME)) {
+        	String parentTagName = "";
+        	if(parent instanceof Element) {
+        		parentTagName = ((Element)parent).getTagName();
+        	} else {
+        		parentTagName = parent.getLocalName();
+        	}
+        	
+            if (parentTagName.equals(SOAP_FAULT_CODE_LOCAL_NAME)) {
                 throw new OMBuilderException(
                         "faultcode element should not have children");
-            } else if (parent.getLocalName().equals(
+            } else if (parentTagName.equals(
                     SOAP_FAULT_STRING_LOCAL_NAME)) {
                 throw new OMBuilderException(
                         "faultstring element should not have children");
-            } else if (parent.getLocalName().equals(
+            } else if (parentTagName.equals(
                     SOAP_FAULT_ACTOR_LOCAL_NAME)) {
                 throw new OMBuilderException(
                         "faultactor element should not have children");