You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by na...@apache.org on 2009/08/29 11:37:53 UTC

svn commit: r809107 - /webservices/rampart/branches/java/1_5/modules/rampart-core/src/main/java/org/apache/rampart/util/RampartUtil.java

Author: nandana
Date: Sat Aug 29 09:37:52 2009
New Revision: 809107

URL: http://svn.apache.org/viewvc?rev=809107&view=rev
Log:
RAMPART-251 Applying the patch. Thanks Prabath

Modified:
    webservices/rampart/branches/java/1_5/modules/rampart-core/src/main/java/org/apache/rampart/util/RampartUtil.java

Modified: webservices/rampart/branches/java/1_5/modules/rampart-core/src/main/java/org/apache/rampart/util/RampartUtil.java
URL: http://svn.apache.org/viewvc/webservices/rampart/branches/java/1_5/modules/rampart-core/src/main/java/org/apache/rampart/util/RampartUtil.java?rev=809107&r1=809106&r2=809107&view=diff
==============================================================================
--- webservices/rampart/branches/java/1_5/modules/rampart-core/src/main/java/org/apache/rampart/util/RampartUtil.java (original)
+++ webservices/rampart/branches/java/1_5/modules/rampart-core/src/main/java/org/apache/rampart/util/RampartUtil.java Sat Aug 29 09:37:52 2009
@@ -909,11 +909,12 @@
                             while (nodesIter.hasNext())
                             {
                                 OMElement e = (OMElement)nodesIter.next();
-                              
-                                WSEncryptionPart encryptedElem = new WSEncryptionPart(e.getLocalName(), 
-                                                                                      e.getNamespace().getNamespaceURI(), 
-                                                                                      "Content",
-                                                                                      WSConstants.PART_TYPE_ELEMENT);
+                                
+                                String localName = e.getLocalName();
+                                String namespace = e.getNamespace() != null ? e.getNamespace().getNamespaceURI() : null;
+                                                            
+                                WSEncryptionPart encryptedElem = new WSEncryptionPart(localName, namespace,
+                            "Content", WSConstants.PART_TYPE_ELEMENT);
                                 
                                 encryptedElem.setXpath(expression);
                                 OMAttribute wsuId = e.getAttribute(new QName(WSConstants.WSU_NS, "Id"));
@@ -1032,15 +1033,17 @@
 			    while (nodesIter.hasNext())
 			    {
 			    	OMElement e = (OMElement)nodesIter.next();
+			    	String localName = e.getLocalName();
+                    String namespace = e.getNamespace() != null ? e.getNamespace().getNamespaceURI() : null;
 			    	
 			    	if (sign) {
-                        WSEncryptionPart encryptedElem = new WSEncryptionPart(e.getLocalName(), e.getNamespace().getNamespaceURI(), "Content", WSConstants.PART_TYPE_ELEMENT);
+                        WSEncryptionPart encryptedElem = new WSEncryptionPart(localName,namespace, "Content", WSConstants.PART_TYPE_ELEMENT);
                         encryptedElem.setXpath(expression);
                         result.add(encryptedElem);
 
                     } else {
 
-                        WSEncryptionPart encryptedElem = new WSEncryptionPart(e.getLocalName(), e.getNamespace().getNamespaceURI(), "Element", WSConstants.PART_TYPE_ELEMENT);
+                        WSEncryptionPart encryptedElem = new WSEncryptionPart(localName,namespace, "Element", WSConstants.PART_TYPE_ELEMENT);
                         encryptedElem.setXpath(expression);
 
 			    		OMAttribute wsuId = e.getAttribute(new QName(WSConstants.WSU_NS, "Id"));
@@ -1064,9 +1067,9 @@
     
     /**
      * Get a element for SOAP 
-     * @param envelope
-     * @param namespaces
-     * @param xpath
+     * @param envelope   SOAP Envelope of which we should check required elements
+     * @param decNamespaces  Declared namespaces in RequiredElements assertion
+     * @param expression  XPATH expression of required elements
      * @return
      */
     public static boolean checkRequiredElements(SOAPEnvelope envelope, HashMap decNamespaces, String expression ) {