Re: [WSS4J] wss4j/src/org/apache/ws/security/util WSSecurityUtil.java,1.13,1.14

Davanum Srinivas <dims-/[email protected]> Tue, 6 Jan 2004 20:56:47 -0800 (PST)
Newsgroups gmane.text.xml.wss4j
Message-ID <[email protected]>
Werner,

testScenario5 fails :(

WSDoAllSender: Signature: error during message
procesingorg.apache.xml.security.signature.XMLSignatureException: Prefix must resolve to a
namespace: Original Exception was
org.apache.xml.security.signature.ReferenceNotInitializedException: Prefix must resolve to a
namespace: Original Exception was
org.apache.xml.security.signature.ReferenceNotInitializedException: Prefix must resolve to a
namespace: Original Exception was
org.apache.xml.security.signature.ReferenceNotInitializedException: Prefix must resolve to a
namespace: Original Exception was
org.apache.xml.security.utils.resolver.ResourceResolverException: Prefix must resolve to a
namespace: Original Exception was javax.xml.transform.TransformerException: Prefix must resolve to
a namespace:

thanks,
dims

--- [email protected] wrote:
> Update of /cvsroot/wss4j/wss4j/src/org/apache/ws/security/util
> In directory sc8-pr-cvs1:/tmp/cvs-serv24603/src/org/apache/ws/security/util
> 
> Modified Files:
> 	WSSecurityUtil.java 
> Log Message:
> Replace the recursive findElement code with a depth-first loop
> (no recursion required).
> 
> Index: WSSecurityUtil.java
> ===================================================================
> RCS file: /cvsroot/wss4j/wss4j/src/org/apache/ws/security/util/WSSecurityUtil.java,v
> retrieving revision 1.13
> retrieving revision 1.14
> diff -C2 -d -r1.13 -r1.14
> *** WSSecurityUtil.java	22 Dec 2003 13:36:29 -0000	1.13
> --- WSSecurityUtil.java	2 Jan 2004 12:15:49 -0000	1.14
> ***************
> *** 160,170 ****
>   	 * not deal with prefixes, just with the real namespace URI  
>   	 * 
> ! 	 * @param node			Where to start the search
>   	 * @param name			Local name of the element
>   	 * @param namespace		Namespace URI of the element
>   	 * @return				The found element or <code>null</code>
>   	 */
> ! 	public static Node findElement(Node node, String name, String namespace) {
>   
>   		if (node.getNodeType() != Node.ELEMENT_NODE) {
>   			return null;
> --- 160,218 ----
>   	 * not deal with prefixes, just with the real namespace URI  
>   	 * 
> ! 	 * @param startNode		Where to start the search
>   	 * @param name			Local name of the element
>   	 * @param namespace		Namespace URI of the element
>   	 * @return				The found element or <code>null</code>
>   	 */
> ! 	public static Node findElement(Node startNode, String name, String namespace) {
>   
> + 		/*
> + 		 * Replace the formely recursive implementation
> + 		 * with a depth-first-loop lookup
> + 		 */
> + 		if (startNode == null) {
> + 			return null;
> + 		}
> + 		Node startParent = startNode.getParentNode();
> + 		Node processedNode = null;
> + 		
> + 		while (startNode != null) {
> + 			// start node processing at this point
> + 			if (startNode.getNodeType() == Node.ELEMENT_NODE
> + 				&& startNode.getLocalName().equals(name)) {
> + 				String ns = startNode.getNamespaceURI();
> + 				if (ns != null && ns.equals(namespace)) {
> + 					return startNode;
> + 				}
> + 
> + 				if ((namespace == null || namespace.length() == 0)
> + 					&& (ns == null || ns.length() == 0)) {
> + 					return startNode;
> + 				}
> + 			}
> + 			processedNode = startNode;
> + 			startNode = startNode.getFirstChild();
> + 			
> + 			// no child, this node is done.
> + 			if (startNode == null) {
> + 				// close node processing, get sibling
> + 				startNode = processedNode.getNextSibling();
> + 			}
> + 			// no more siblings, get parent, all children
> + 			// of parent are processed.
> + 			while (startNode == null) {
> + 				processedNode = processedNode.getParentNode();
> + 				if (processedNode == startParent) {
> + 					return null;
> + 				}
> + 				// close parent node processing (processed node now)
> + 				startNode = processedNode.getNextSibling();
> + 			}
> + 		}
> + 		return null;
> + 
> + 		/*
> + 		 * Replace the recursive implementation with a depth-first lookup loop 
> + 		 
>   		if (node.getNodeType() != Node.ELEMENT_NODE) {
>   			return null;
> ***************
> *** 197,200 ****
> --- 245,249 ----
>   		}
>   		return found;
> + 		*/
>   	}
>   
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: IBM Linux Tutorials.
> Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
> Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
> _______________________________________________
> wss4j-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wss4j-devel


=====
Davanum Srinivas - http://webservices.apache.org/~dims/


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click