You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2011/02/03 12:37:48 UTC

svn commit: r1066784 - in /santuario/xml-security-java/trunk/src: main/java/org/apache/xml/security/utils/ test/java/org/apache/xml/security/test/signature/

Author: coheigea
Date: Thu Feb  3 11:37:47 2011
New Revision: 1066784

URL: http://svn.apache.org/viewvc?rev=1066784&view=rev
Log:
[SANTUARIO-259] - More source cleanup
 - Removed redundant hashmap instance in XMLUtils.

Modified:
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/CachedXPathAPIHolder.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/CachedXPathFuncHereAPI.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/Constants.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/ElementProxy.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/EncryptionConstants.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/XMLUtils.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/XPathFuncHereAPI.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/signature/CreateSignatureTest.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/signature/SignatureTest.java

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/CachedXPathAPIHolder.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/CachedXPathAPIHolder.java?rev=1066784&r1=1066783&r2=1066784&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/CachedXPathAPIHolder.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/CachedXPathAPIHolder.java Thu Feb  3 11:37:47 2011
@@ -24,18 +24,18 @@ import org.w3c.dom.Document;
  */
 public class CachedXPathAPIHolder {
 
-    static ThreadLocal  local=new ThreadLocal();
-    static ThreadLocal localDoc=new ThreadLocal();
-  
+    static ThreadLocal<CachedXPathAPI> local = new ThreadLocal<CachedXPathAPI>();
+    static ThreadLocal<Document> localDoc = new ThreadLocal<Document>();
+
     /**
      * Sets the doc for the xpath transformation. Resets the cache if needed
      * @param doc
      */
     public static void setDoc(Document doc) {                    
-        if (localDoc.get()!=doc) {
-            CachedXPathAPI cx=(CachedXPathAPI)local.get();
-            if (cx==null) {
-                cx=new CachedXPathAPI();
+        if (localDoc.get() != doc) {
+            CachedXPathAPI cx = local.get();
+            if (cx == null) {
+                cx = new CachedXPathAPI();
                 local.set(cx);
                 localDoc.set(doc);
                 return;
@@ -50,9 +50,9 @@ public class CachedXPathAPIHolder {
      * @return the cachexpathapi for this thread
      */
     public static CachedXPathAPI getCachedXPathAPI() {        
-        CachedXPathAPI cx=(CachedXPathAPI)local.get();        
-        if (cx==null) {
-            cx=new CachedXPathAPI();
+        CachedXPathAPI cx = local.get();        
+        if (cx == null) {
+            cx = new CachedXPathAPI();
             local.set(cx);
             localDoc.set(null);            
         }

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/CachedXPathFuncHereAPI.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/CachedXPathFuncHereAPI.java?rev=1066784&r1=1066783&r2=1066784&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/CachedXPathFuncHereAPI.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/CachedXPathFuncHereAPI.java Thu Feb  3 11:37:47 2011
@@ -16,8 +16,6 @@
  */
 package org.apache.xml.security.utils;
 
-
-
 import org.apache.xml.dtm.DTMManager;
 import org.apache.xml.security.transforms.implementations.FuncHere;
 import org.apache.xml.security.transforms.implementations.FuncHereContext;
@@ -30,7 +28,6 @@ import org.apache.xpath.XPathContext;
 import org.apache.xpath.compiler.FunctionTable;
 import org.apache.xpath.objects.XObject;
 import org.w3c.dom.*;
-import org.w3c.dom.traversal.NodeIterator;
 
 import javax.xml.transform.ErrorListener;
 import javax.xml.transform.SourceLocator;
@@ -46,334 +43,238 @@ import java.lang.reflect.Modifier;
 public class CachedXPathFuncHereAPI {
 
     static org.apache.commons.logging.Log log =
-           org.apache.commons.logging.LogFactory.getLog(CachedXPathFuncHereAPI.class.getName());
-   /**
-    * XPathContext, and thus DTMManager and DTMs, persists through multiple
-    *   calls to this object.
-    */
-   FuncHereContext _funcHereContext = null;
+        org.apache.commons.logging.LogFactory.getLog(CachedXPathFuncHereAPI.class.getName());
+    /**
+     * XPathContext, and thus DTMManager and DTMs, persists through multiple
+     *   calls to this object.
+     */
+    FuncHereContext funcHereContext = null;
 
-   /** Field _dtmManager */
-   DTMManager _dtmManager = null;
+    /** Field dtmManager */
+    DTMManager dtmManager = null;
 
-   XPathContext _context = null;
+    XPathContext context = null;
 
-   String xpathStr=null;
+    String xpathStr=null;
 
-   XPath xpath=null;
+    XPath xpath=null;
 
-   static FunctionTable _funcTable = null;
+    static FunctionTable funcTable = null;
 
     static {
         fixupFunctionTable();
     }
 
-   /**
-    * Method getFuncHereContext
-    * @return the context for this object
-    *
-    */
-   public FuncHereContext getFuncHereContext() {
-      return this._funcHereContext;
-   }
-
-   /**
-    * Constructor CachedXPathFuncHereAPI
-    *
-    */
-   private CachedXPathFuncHereAPI() {}
-
-   /**
-    * Constructor CachedXPathFuncHereAPI
-    *
-    * @param existingXPathContext
-    */
-   public CachedXPathFuncHereAPI(XPathContext existingXPathContext) {
-      this._dtmManager = existingXPathContext.getDTMManager();
-      this._context=existingXPathContext;
-   }
-
-   /**
-    * Constructor CachedXPathFuncHereAPI
-    *
-    * @param previouslyUsed
-    */
-   public CachedXPathFuncHereAPI(CachedXPathAPI previouslyUsed) {
-      this._dtmManager = previouslyUsed.getXPathContext().getDTMManager();
-      this._context=previouslyUsed.getXPathContext();
-   }
-
-   /**
-    * Use an XPath string to select a single node. XPath namespace
-    * prefixes are resolved from the context node, which may not
-    * be what you want (see the next method).
-    *
-    * @param contextNode The node to start searching from.
-    * @param xpathnode A Node containing a valid XPath string.
-    * @return The first node found that matches the XPath, or null.
-    *
-    * @throws TransformerException
-    */
-   public Node selectSingleNode(Node contextNode, Node xpathnode)
-           throws TransformerException {
-      return selectSingleNode(contextNode, xpathnode, contextNode);
-   }
-
-   /**
-    * Use an XPath string to select a single node.
-    * XPath namespace prefixes are resolved from the namespaceNode.
-    *
-    * @param contextNode The node to start searching from.
-    * @param xpathnode
-    * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
-    * @return The first node found that matches the XPath, or null.
-    *
-    * @throws TransformerException
-    */
-   public Node selectSingleNode(
-           Node contextNode, Node xpathnode, Node namespaceNode)
-              throws TransformerException {
-
-      // Have the XObject return its result as a NodeSetDTM.
-      NodeIterator nl = selectNodeIterator(contextNode, xpathnode,
-                                           namespaceNode);
-
-      // Return the first node, or null
-      return nl.nextNode();
-   }
-
-   /**
-    *   Use an XPath string to select a nodelist.
-    *   XPath namespace prefixes are resolved from the contextNode.
-    *
-    *   @param contextNode The node to start searching from.
-    *   @param xpathnode
-    *   @return A NodeIterator, should never be null.
-    *
-    *  @throws TransformerException
-    */
-   public NodeIterator selectNodeIterator(Node contextNode, Node xpathnode)
-           throws TransformerException {
-      return selectNodeIterator(contextNode, xpathnode, contextNode);
-   }
-
-   /**
-    *  Use an XPath string to select a nodelist.
-    *  XPath namespace prefixes are resolved from the namespaceNode.
-    *
-    *  @param contextNode The node to start searching from.
-    * @param xpathnode
-    *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
-    *  @return A NodeIterator, should never be null.
-    *
-    * @throws TransformerException
-    * @deprecated
-    */
-   public NodeIterator selectNodeIterator(
-           Node contextNode, Node xpathnode, Node namespaceNode)
-              throws TransformerException {
-
-      // Execute the XPath, and have it return the result
-      XObject list = eval(contextNode, xpathnode, getStrFromNode(xpathnode), namespaceNode);
-
-      // Have the XObject return its result as a NodeSetDTM.
-      return list.nodeset();
-   }
-
-   /**
-    *  Use an XPath string to select a nodelist.
-    *  XPath namespace prefixes are resolved from the contextNode.
-    *
-    *  @param contextNode The node to start searching from.
-    * @param xpathnode
-    *  @return A NodeIterator, should never be null.
-    *
-    * @throws TransformerException
-    * @deprecated
-    */
-   public NodeList selectNodeList(Node contextNode, Node xpathnode)
-           throws TransformerException {
-      return selectNodeList(contextNode, xpathnode, getStrFromNode(xpathnode), contextNode);
-   }
-
-   /**
-    *  Use an XPath string to select a nodelist.
-    *  XPath namespace prefixes are resolved from the namespaceNode.
-    *
-    *  @param contextNode The node to start searching from.
-    * @param xpathnode
-    * @param str
-    *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
-    *  @return A NodeIterator, should never be null.
-    *
-    * @throws TransformerException
-    */
-   public NodeList selectNodeList(
-           Node contextNode, Node xpathnode, String str, Node namespaceNode)
-              throws TransformerException {
-
-      // Execute the XPath, and have it return the result
-      XObject list = eval(contextNode, xpathnode, str, namespaceNode);
-
-      // Return a NodeList.
-      return list.nodelist();
-   }
-
-   /**
-    *  Evaluate XPath string to an XObject.  Using this method,
-    *  XPath namespace prefixes will be resolved from the namespaceNode.
-    *  @param contextNode The node to start searching from.
-    * @param xpathnode
-    *  @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
-    *  @see org.apache.xpath.objects.XObject
-    *  @see org.apache.xpath.objects.XNull
-    *  @see org.apache.xpath.objects.XBoolean
-    *  @see org.apache.xpath.objects.XNumber
-    *  @see org.apache.xpath.objects.XString
-    *  @see org.apache.xpath.objects.XRTreeFrag
-    *
-    * @throws TransformerException
-    * @deprecated
-    */
-   public XObject eval(Node contextNode, Node xpathnode)
-           throws TransformerException {
-      return eval(contextNode, xpathnode, getStrFromNode(xpathnode),contextNode);
-   }
-
-   /**
-    *  Evaluate XPath string to an XObject.
-    *  XPath namespace prefixes are resolved from the namespaceNode.
-    *  The implementation of this is a little slow, since it creates
-    *  a number of objects each time it is called.  This could be optimized
-    *  to keep the same objects around, but then thread-safety issues would arise.
-    *
-    *  @param contextNode The node to start searching from.
-    * @param xpathnode
-    * @param str
-    *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
-    *  @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
-    *  @see org.apache.xpath.objects.XObject
-    *  @see org.apache.xpath.objects.XNull
-    *  @see org.apache.xpath.objects.XBoolean
-    *  @see org.apache.xpath.objects.XNumber
-    *  @see org.apache.xpath.objects.XString
-    *  @see org.apache.xpath.objects.XRTreeFrag
-    *
-    * @throws TransformerException
-    */
-   public XObject eval(Node contextNode, Node xpathnode, String str, Node namespaceNode)
-           throws TransformerException {
-      //  Create the XPath object.
-      //String str = CachedXPathFuncHereAPI.getStrFromNode(xpathnode);
-
-      // Since we don't have a XML Parser involved here, install some default support
-      // for things like namespaces, etc.
-      // (Changed from: XPathContext xpathSupport = new XPathContext();
-      //    because XPathContext is weak in a number of areas... perhaps
-      //    XPathContext should be done away with.)
-      if (this._funcHereContext == null) {
-         this._funcHereContext = new FuncHereContext(xpathnode,
-                                                     this._dtmManager);
-      }
-
-      // Create an object to resolve namespace prefixes.
-      // XPath namespaces are resolved from the input context node's document element
-      // if it is a root node, or else the current context node (for lack of a better
-      // resolution space, given the simplicity of this sample code).
-      PrefixResolverDefault prefixResolver =
-         new PrefixResolverDefault((namespaceNode.getNodeType()
-                                    == Node.DOCUMENT_NODE)
-                                   ? ((Document) namespaceNode)
-                                      .getDocumentElement()
-                                   : namespaceNode);
-
-      // only check if string points to different object (for performance)
-      if (str!=xpathStr) {
-        if (str.indexOf("here()")>0) {
-            _context.reset();
-            _dtmManager=_context.getDTMManager();
-        }
-        xpath = createXPath(str, prefixResolver);
-        xpathStr=str;
-      }
-
-      // Execute the XPath, and have it return the result
-      // return xpath.execute(xpathSupport, contextNode, prefixResolver);
-      int ctxtNode = this._funcHereContext.getDTMHandleFromNode(contextNode);
-
-      return xpath.execute(this._funcHereContext, ctxtNode, prefixResolver);
-   }
-
-   /**
-    *   Evaluate XPath string to an XObject.
-    *   XPath namespace prefixes are resolved from the namespaceNode.
-    *   The implementation of this is a little slow, since it creates
-    *   a number of objects each time it is called.  This could be optimized
-    *   to keep the same objects around, but then thread-safety issues would arise.
-    *
-    *   @param contextNode The node to start searching from.
-    * @param xpathnode
-    * @param str
-    *   @param prefixResolver Will be called if the parser encounters namespace
-    *                         prefixes, to resolve the prefixes to URLs.
-    *   @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
-    *   @see org.apache.xpath.objects.XObject
-    *   @see org.apache.xpath.objects.XNull
-    *   @see org.apache.xpath.objects.XBoolean
-    *   @see org.apache.xpath.objects.XNumber
-    *   @see org.apache.xpath.objects.XString
-    *   @see org.apache.xpath.objects.XRTreeFrag
-    *
-    * @throws TransformerException
-    */
-   public XObject eval(
-           Node contextNode, Node xpathnode, String str, PrefixResolver prefixResolver)
-              throws TransformerException {
-
-      // Since we don't have a XML Parser involved here, install some default support
-      // for things like namespaces, etc.
-      // (Changed from: XPathContext xpathSupport = new XPathContext();
-      //    because XPathContext is weak in a number of areas... perhaps
-      //    XPathContext should be done away with.)
-      // Create the XPath object.
-      //String str = CachedXPathFuncHereAPI.getStrFromNode(xpathnode);
-    // only check if string points to different object (for performance)
-    if (str!=xpathStr) {
-        if (str.indexOf("here()")>0) {
-            _context.reset();
-            _dtmManager=_context.getDTMManager();
+    /**
+     * Method getFuncHereContext
+     * @return the context for this object
+     *
+     */
+    public FuncHereContext getFuncHereContext() {
+        return this.funcHereContext;
+    }
+
+    /**
+     * Constructor CachedXPathFuncHereAPI
+     *
+     * @param existingXPathContext
+     */
+    public CachedXPathFuncHereAPI(XPathContext existingXPathContext) {
+        this.dtmManager = existingXPathContext.getDTMManager();
+        this.context=existingXPathContext;
+    }
+
+    /**
+     * Constructor CachedXPathFuncHereAPI
+     *
+     * @param previouslyUsed
+     */
+    public CachedXPathFuncHereAPI(CachedXPathAPI previouslyUsed) {
+        this.dtmManager = previouslyUsed.getXPathContext().getDTMManager();
+        this.context=previouslyUsed.getXPathContext();
+    }
+
+    /**
+     * Use an XPath string to select a single node. XPath namespace
+     * prefixes are resolved from the context node, which may not
+     * be what you want (see the next method).
+     *
+     * @param contextNode The node to start searching from.
+     * @param xpathnode A Node containing a valid XPath string.
+     * @return The first node found that matches the XPath, or null.
+     *
+     * @throws TransformerException
+     */
+    public Node selectSingleNode(Node contextNode, Node xpathnode)
+    throws TransformerException {
+        return selectSingleNode(contextNode, xpathnode, contextNode);
+    }
+
+    /**
+     * Use an XPath string to select a single node.
+     * XPath namespace prefixes are resolved from the namespaceNode.
+     *
+     * @param contextNode The node to start searching from.
+     * @param xpathnode
+     * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
+     * @return The first node found that matches the XPath, or null.
+     *
+     * @throws TransformerException
+     */
+    public Node selectSingleNode(
+        Node contextNode, Node xpathnode, Node namespaceNode
+    ) throws TransformerException {
+        NodeList nl = 
+            selectNodeList(contextNode, xpathnode, getStrFromNode(xpathnode), namespaceNode);
+
+        // Return the first node, or null
+        if (nl == null) {
+            return null;
         }
-        try {
+        return nl.item(0);
+    }
+
+    /**
+     *  Use an XPath string to select a nodelist.
+     *  XPath namespace prefixes are resolved from the namespaceNode.
+     *
+     *  @param contextNode The node to start searching from.
+     *  @param xpathnode
+     *  @param str
+     *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
+     *  @return A NodeIterator, should never be null.
+     *
+     * @throws TransformerException
+     */
+    public NodeList selectNodeList(
+        Node contextNode, Node xpathnode, String str, Node namespaceNode)
+    throws TransformerException {
+
+        // Execute the XPath, and have it return the result
+        XObject list = eval(contextNode, xpathnode, str, namespaceNode);
+
+        // Return a NodeList.
+        return list.nodelist();
+    }
+
+    /**
+     *  Evaluate XPath string to an XObject.
+     *  XPath namespace prefixes are resolved from the namespaceNode.
+     *  The implementation of this is a little slow, since it creates
+     *  a number of objects each time it is called.  This could be optimized
+     *  to keep the same objects around, but then thread-safety issues would arise.
+     *
+     *  @param contextNode The node to start searching from.
+     *  @param xpathnode
+     *  @param str
+     *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
+     *  @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
+     *  @see org.apache.xpath.objects.XObject
+     *  @see org.apache.xpath.objects.XNull
+     *  @see org.apache.xpath.objects.XBoolean
+     *  @see org.apache.xpath.objects.XNumber
+     *  @see org.apache.xpath.objects.XString
+     *  @see org.apache.xpath.objects.XRTreeFrag
+     *
+     * @throws TransformerException
+     */
+    public XObject eval(Node contextNode, Node xpathnode, String str, Node namespaceNode)
+    throws TransformerException {
+        if (this.funcHereContext == null) {
+            this.funcHereContext = new FuncHereContext(xpathnode, this.dtmManager);
+        }
+
+        // Create an object to resolve namespace prefixes.
+        // XPath namespaces are resolved from the input context node's document element
+        // if it is a root node, or else the current context node (for lack of a better
+        // resolution space, given the simplicity of this sample code).
+        PrefixResolverDefault prefixResolver =
+            new PrefixResolverDefault((namespaceNode.getNodeType()
+                == Node.DOCUMENT_NODE)
+                ? ((Document) namespaceNode)
+                    .getDocumentElement()
+                    : namespaceNode);
+
+        // only check if string points to different object (for performance)
+        if (str!=xpathStr) {
+            if (str.indexOf("here()")>0) {
+                context.reset();
+                dtmManager=context.getDTMManager();
+            }
             xpath = createXPath(str, prefixResolver);
-        } catch (TransformerException ex) {
-            //Try to see if it is a problem with the classloader.
-            Throwable th= ex.getCause();
-            if (th instanceof ClassNotFoundException) {
-                 if (th.getMessage().indexOf("FuncHere")>0) {
-                     throw new RuntimeException(I18n.translate("endorsed.jdk1.4.0")/*,*/+ex);
-                 }
-              }
-              throw ex;
-        }
-        xpathStr=str;
-    }
-
-      // Execute the XPath, and have it return the result
-      if (this._funcHereContext == null) {
-         this._funcHereContext = new FuncHereContext(xpathnode,
-                                                     this._dtmManager);
-      }
+            xpathStr=str;
+        }
 
-      int ctxtNode = this._funcHereContext.getDTMHandleFromNode(contextNode);
+        // Execute the XPath, and have it return the result
+        // return xpath.execute(xpathSupport, contextNode, prefixResolver);
+        int ctxtNode = this.funcHereContext.getDTMHandleFromNode(contextNode);
 
-      return xpath.execute(this._funcHereContext, ctxtNode, prefixResolver);
-   }
+        return xpath.execute(this.funcHereContext, ctxtNode, prefixResolver);
+    }
+
+    /**
+     *   Evaluate XPath string to an XObject.
+     *   XPath namespace prefixes are resolved from the namespaceNode.
+     *   The implementation of this is a little slow, since it creates
+     *   a number of objects each time it is called.  This could be optimized
+     *   to keep the same objects around, but then thread-safety issues would arise.
+     *
+     *   @param contextNode The node to start searching from.
+     *   @param xpathnode
+     *   @param str
+     *   @param prefixResolver Will be called if the parser encounters namespace
+     *                         prefixes, to resolve the prefixes to URLs.
+     *   @return An XObject, which can be used to obtain a string, number, nodelist, etc, 
+     *   should never be null.
+     *   @see org.apache.xpath.objects.XObject
+     *   @see org.apache.xpath.objects.XNull
+     *   @see org.apache.xpath.objects.XBoolean
+     *   @see org.apache.xpath.objects.XNumber
+     *   @see org.apache.xpath.objects.XString
+     *   @see org.apache.xpath.objects.XRTreeFrag
+     *
+     * @throws TransformerException
+     */
+    public XObject eval(
+        Node contextNode, Node xpathnode, String str, PrefixResolver prefixResolver)
+    throws TransformerException {
+        // only check if string points to different object (for performance)
+        if (str!=xpathStr) {
+            if (str.indexOf("here()")>0) {
+                context.reset();
+                dtmManager=context.getDTMManager();
+            }
+            try {
+                xpath = createXPath(str, prefixResolver);
+            } catch (TransformerException ex) {
+                //Try to see if it is a problem with the classloader.
+                Throwable th= ex.getCause();
+                if (th instanceof ClassNotFoundException) {
+                    if (th.getMessage().indexOf("FuncHere")>0) {
+                        throw new RuntimeException(I18n.translate("endorsed.jdk1.4.0")/*,*/+ex);
+                    }
+                }
+                throw ex;
+            }
+            xpathStr=str;
+        }
+
+        // Execute the XPath, and have it return the result
+        if (this.funcHereContext == null) {
+            this.funcHereContext = new FuncHereContext(xpathnode,
+                                                        this.dtmManager);
+        }
+
+        int ctxtNode = this.funcHereContext.getDTMHandleFromNode(contextNode);
+
+        return xpath.execute(this.funcHereContext, ctxtNode, prefixResolver);
+    }
 
     private XPath createXPath(String str, PrefixResolver prefixResolver) throws TransformerException {
         XPath xpath = null;
         Class[] classes = new Class[]{String.class, SourceLocator.class, PrefixResolver.class, int.class,
-                ErrorListener.class, FunctionTable.class};
-        Object[] objects = new Object[]{str, null, prefixResolver, new Integer(XPath.SELECT), null, _funcTable};
+                                      ErrorListener.class, FunctionTable.class};
+        Object[] objects = new Object[]{str, null, prefixResolver, new Integer(XPath.SELECT), null, funcTable};
         try {
             Constructor constructor = XPath.class.getConstructor(classes);
             xpath = (XPath) constructor.newInstance(objects);
@@ -393,28 +294,28 @@ public class CachedXPathFuncHereAPI {
      */
     public static String getStrFromNode(Node xpathnode) {
 
-       if (xpathnode.getNodeType() == Node.TEXT_NODE) {
+        if (xpathnode.getNodeType() == Node.TEXT_NODE) {
+
+            // we iterate over all siblings of the context node because eventually,
+            // the text is "polluted" with pi's or comments
+            StringBuffer sb = new StringBuffer();
+
+            for (Node currentSibling = xpathnode.getParentNode().getFirstChild();
+            currentSibling != null;
+            currentSibling = currentSibling.getNextSibling()) {
+                if (currentSibling.getNodeType() == Node.TEXT_NODE) {
+                    sb.append(((Text) currentSibling).getData());
+                }
+            }
 
-          // we iterate over all siblings of the context node because eventually,
-          // the text is "polluted" with pi's or comments
-          StringBuffer sb = new StringBuffer();
-
-          for (Node currentSibling = xpathnode.getParentNode().getFirstChild();
-               currentSibling != null;
-               currentSibling = currentSibling.getNextSibling()) {
-             if (currentSibling.getNodeType() == Node.TEXT_NODE) {
-                sb.append(((Text) currentSibling).getData());
-             }
-          }
-
-          return sb.toString();
-       } else if (xpathnode.getNodeType() == Node.ATTRIBUTE_NODE) {
-          return ((Attr) xpathnode).getNodeValue();
-       } else if (xpathnode.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
-          return ((ProcessingInstruction) xpathnode).getNodeValue();
-       }
+            return sb.toString();
+        } else if (xpathnode.getNodeType() == Node.ATTRIBUTE_NODE) {
+            return ((Attr) xpathnode).getNodeValue();
+        } else if (xpathnode.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
+            return ((ProcessingInstruction) xpathnode).getNodeValue();
+        }
 
-       return null;
+        return null;
     }
 
     private static void fixupFunctionTable() {
@@ -436,11 +337,11 @@ public class CachedXPathFuncHereAPI {
         }
         if(!installed) {
             try {
-                _funcTable = new FunctionTable();
+                funcTable = new FunctionTable();
                 Class []args = {String.class, Class.class};
                 Method installFunction = FunctionTable.class.getMethod("installFunction", args);
                 Object []params = {"here", FuncHere.class};
-                installFunction.invoke(_funcTable, params);
+                installFunction.invoke(funcTable, params);
                 installed = true;
             } catch (Throwable t) {
                 log.debug("Error installing function using the static installFunction method", t);
@@ -449,10 +350,10 @@ public class CachedXPathFuncHereAPI {
         if (log.isDebugEnabled()) {
             if (installed) {
                 log.debug("Registered class " + FuncHere.class.getName()
-                        + " for XPath function 'here()' function in internal table");
+                          + " for XPath function 'here()' function in internal table");
             } else {
                 log.debug("Unable to register class " + FuncHere.class.getName()
-                        + " for XPath function 'here()' function in internal table");
+                          + " for XPath function 'here()' function in internal table");
             }
         }
     }

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/Constants.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/Constants.java?rev=1066784&r1=1066783&r2=1066784&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/Constants.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/Constants.java Thu Feb  3 11:37:47 2011
@@ -16,8 +16,6 @@
  */
 package org.apache.xml.security.utils;
 
-import org.apache.xml.security.exceptions.XMLSecurityException;
-
 /**
  * Provides all constants and some translation functions for i18n.
  *
@@ -251,34 +249,4 @@ public class Constants {
         // we don't allow instantiation
     }
 
-    /**
-     * Sets the namespace prefix which will be used to identify elements in the
-     * XML Signature Namespace.
-     *
-     * <pre>
-     * Constants.setSignatureSpecNSprefix("dsig");
-     * </pre>
-     *
-     * @param newPrefix is the new namespace prefix.
-     * @throws XMLSecurityException
-     * @see org.apache.xml.security.utils.Constants#getSignatureSpecNSprefix
-     * $todo$ Add consistency checking for valid prefix
-     */
-    public static void setSignatureSpecNSprefix(String newPrefix) throws XMLSecurityException {
-        ElementProxy.setDefaultPrefix(Constants.SignatureSpecNS, newPrefix);
-    }
-
-    /**
-     * Returns the XML namespace prefix which is used for elements in the XML
-     * Signature namespace.
-     *
-     * It is defaulted to <code>dsig</code>, but can be changed using the
-     * {@link #setSignatureSpecNSprefix} function.
-     *
-     * @return the current used namespace prefix
-     * @see #setSignatureSpecNSprefix
-     */
-    public static String getSignatureSpecNSprefix() {
-        return ElementProxy.getDefaultPrefix(Constants.SignatureSpecNS);
-    }
 }

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/ElementProxy.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/ElementProxy.java?rev=1066784&r1=1066783&r2=1066784&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/ElementProxy.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/ElementProxy.java Thu Feb  3 11:37:47 2011
@@ -17,7 +17,7 @@
 package org.apache.xml.security.utils;
 
 import java.math.BigInteger;
-import java.util.HashMap;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.Map;
 
 import org.apache.xml.security.exceptions.Base64DecodingException;
@@ -51,8 +51,8 @@ public abstract class ElementProxy {
     protected Document doc = null;
     
     /** Field prefixMappings */
-    static Map<String, String> prefixMappings = new HashMap<String, String>();
-    static Map<String, String> prefixMappingsBindings = new HashMap<String, String>();
+    static Map<String, String> prefixMappings = new ConcurrentHashMap<String, String>();
+    static Map<String, String> prefixMappingsBindings = new ConcurrentHashMap<String, String>();
 
     /**
      * Constructor ElementProxy

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/EncryptionConstants.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/EncryptionConstants.java?rev=1066784&r1=1066783&r2=1066784&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/EncryptionConstants.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/EncryptionConstants.java Thu Feb  3 11:37:47 2011
@@ -16,8 +16,6 @@
  */
 package org.apache.xml.security.utils;
 
-import org.apache.xml.security.exceptions.XMLSecurityException;
-
 /**
  *
  * @author $Author$
@@ -190,23 +188,4 @@ public class EncryptionConstants {
         // we don't allow instantiation
     }
 
-    /**
-     * Method setEncryptionSpecNSprefix
-     *
-     * @param newPrefix
-     * @throws XMLSecurityException
-     */
-    public static void setEncryptionSpecNSprefix(String newPrefix)
-        throws XMLSecurityException {
-        ElementProxy.setDefaultPrefix(EncryptionConstants.EncryptionSpecNS, newPrefix);
-    }
-
-    /**
-     * Method getEncryptionSpecNSprefix
-     *
-     * @return the prefix for this node.
-     */
-    public static String getEncryptionSpecNSprefix() {
-        return ElementProxy.getDefaultPrefix(EncryptionConstants.EncryptionSpecNS);
-    }
 }

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/XMLUtils.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/XMLUtils.java?rev=1066784&r1=1066783&r2=1066784&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/XMLUtils.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/XMLUtils.java Thu Feb  3 11:37:47 2011
@@ -21,10 +21,8 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
-import java.util.Map;
 import java.util.Set;
 
 import org.apache.xml.security.c14n.CanonicalizationException;
@@ -53,6 +51,9 @@ public class XMLUtils {
                     ("org.apache.xml.security.ignoreLineBreaks"));
             }
         })).booleanValue();
+    
+    static String dsPrefix = null;
+    static String xencPrefix = null;
 
     /**
      * Constructor XMLUtils
@@ -218,10 +219,6 @@ public class XMLUtils {
         return sb.toString();
     }
 
-
-    static  String dsPrefix=null;
-    private static Map namePrefixes= java.util.Collections.synchronizedMap(new HashMap());
-
     /**
      * Creates an Element in the XML Signature specification namespace.
      *
@@ -237,18 +234,12 @@ public class XMLUtils {
         if ((dsPrefix == null) || (dsPrefix.length() == 0)) {
             return doc.createElementNS(Constants.SignatureSpecNS, elementName);
         } 
-        String namePrefix=(String) namePrefixes.get(elementName);
-        if (namePrefix==null) {
-            StringBuilder tag=new StringBuilder(dsPrefix);
-            tag.append(':');
-            tag.append(elementName);
-            namePrefix=tag.toString();
-            namePrefixes.put(elementName,namePrefix);
-        }
-        return doc.createElementNS(Constants.SignatureSpecNS, namePrefix);
+        StringBuilder tag = new StringBuilder(dsPrefix);
+        tag.append(':');
+        tag.append(elementName);
+        return doc.createElementNS(Constants.SignatureSpecNS, tag.toString());
     }
 
-    static  String xencPrefix=null;
     /**
      * Creates an Element in the XML Encryption specification namespace.
      *
@@ -256,25 +247,18 @@ public class XMLUtils {
      * @param elementName the local name of the Element
      * @return the Element
      */
-    public static Element createElementInEncryptionSpace(Document doc,
-                                                         String elementName) {
-
+    public static Element createElementInEncryptionSpace(Document doc, String elementName) {
         if (doc == null) {
             throw new RuntimeException("Document is null");
         }
 
         if ((xencPrefix == null) || (xencPrefix.length() == 0)) {
             return doc.createElementNS(EncryptionConstants.EncryptionSpecNS, elementName);
-        } 
-        String namePrefix=(String) namePrefixes.get(elementName);
-        if (namePrefix==null) {
-            StringBuilder tag=new StringBuilder(xencPrefix);
-            tag.append(':');
-            tag.append(elementName);
-            namePrefix=tag.toString();
-            namePrefixes.put(elementName,namePrefix);
         }
-        return doc.createElementNS(EncryptionConstants.EncryptionSpecNS, namePrefix);
+        StringBuilder tag = new StringBuilder(dsPrefix);
+        tag.append(':');
+        tag.append(elementName);
+        return doc.createElementNS(EncryptionConstants.EncryptionSpecNS, tag.toString());
     }
 
     /**
@@ -283,15 +267,16 @@ public class XMLUtils {
      *
      * @param element
      * @param localName
-     * @return true if the element is in XML Signature namespace and the local name equals the supplied one
+     * @return true if the element is in XML Signature namespace and the local name equals 
+     * the supplied one
      */
-    public static boolean elementIsInSignatureSpace(Element element,
-                                                    String localName) {
-        if(element == null){
+    public static boolean elementIsInSignatureSpace(Element element, String localName) {
+        if (element == null){
             return false;
         }
 
-        return Constants.SignatureSpecNS.equals(element.getNamespaceURI()) && element.getLocalName().equals(localName);
+        return Constants.SignatureSpecNS.equals(element.getNamespaceURI()) 
+            && element.getLocalName().equals(localName);
     }
 
     /**
@@ -300,14 +285,15 @@ public class XMLUtils {
      *
      * @param element
      * @param localName
-     * @return true if the element is in XML Encryption namespace and the local name equals the supplied one
+     * @return true if the element is in XML Encryption namespace and the local name 
+     * equals the supplied one
      */
-    public static boolean elementIsInEncryptionSpace(Element element,
-                                                     String localName) {
-        if(element == null){
+    public static boolean elementIsInEncryptionSpace(Element element, String localName) {
+        if (element == null){
             return false;
         }
-        return EncryptionConstants.EncryptionSpecNS.equals(element.getNamespaceURI()) && element.getLocalName().equals(localName);
+        return EncryptionConstants.EncryptionSpecNS.equals(element.getNamespaceURI()) 
+            && element.getLocalName().equals(localName);
     }
 
     /**
@@ -320,7 +306,6 @@ public class XMLUtils {
      * @return the owner document of the node
      */
     public static Document getOwnerDocument(Node node) {
-
         if (node.getNodeType() == Node.DOCUMENT_NODE) {
             return (Document) node;
         } 
@@ -331,7 +316,6 @@ public class XMLUtils {
                                            + " Original message was \""
                                            + npe.getMessage() + "\"");
         }
-
     }
 
     /**
@@ -343,17 +327,17 @@ public class XMLUtils {
      * @param xpathNodeSet
      * @return the owner document 
      */
-    public static Document getOwnerDocument(Set xpathNodeSet) {
+    public static Document getOwnerDocument(Set<Node> xpathNodeSet) {
         NullPointerException npe = null;
-        Iterator iterator = xpathNodeSet.iterator();
+        Iterator<Node> iterator = xpathNodeSet.iterator();
         while(iterator.hasNext()) {
-            Node node = (Node) iterator.next();
-            int nodeType =node.getNodeType();
+            Node node = iterator.next();
+            int nodeType = node.getNodeType();
             if (nodeType == Node.DOCUMENT_NODE) {
                 return (Document) node;
             } 
             try {
-                if (nodeType==Node.ATTRIBUTE_NODE) {
+                if (nodeType == Node.ATTRIBUTE_NODE) {
                     return ((Attr)node).getOwnerElement().getOwnerDocument();  
                 }
                 return node.getOwnerDocument();
@@ -375,8 +359,7 @@ public class XMLUtils {
      * @param namespace
      * @return the element.
      */
-    public static Element createDSctx(Document doc, String prefix,
-                                      String namespace) {
+    public static Element createDSctx(Document doc, String prefix, String namespace) {
 
         if ((prefix == null) || (prefix.trim().length() == 0)) {
             throw new IllegalArgumentException("You must supply a prefix");
@@ -384,8 +367,7 @@ public class XMLUtils {
 
         Element ctx = doc.createElementNS(null, "namespaceContext");
 
-        ctx.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:" + prefix.trim(),
-                           namespace);
+        ctx.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:" + prefix.trim(), namespace);
 
         return ctx;
     }
@@ -396,7 +378,6 @@ public class XMLUtils {
      * @param e
      */
     public static void addReturnToElement(Element e) {
-
         if (!ignoreLineBreaks) {
             Document doc = e.getOwnerDocument();
             e.appendChild(doc.createTextNode("\n"));
@@ -422,14 +403,14 @@ public class XMLUtils {
      * @param xpathNodeSet
      * @return the set with the nodelist
      */
-    public static Set convertNodelistToSet(NodeList xpathNodeSet) {
+    public static Set<Node> convertNodelistToSet(NodeList xpathNodeSet) {
 
         if (xpathNodeSet == null) {
-            return new HashSet();
+            return new HashSet<Node>();
         }
 
         int length = xpathNodeSet.getLength();
-        Set set = new HashSet(length);
+        Set<Node> set = new HashSet<Node>(length);
 
         for (int i = 0; i < length; i++) {
             set.add(xpathNodeSet.item(i));
@@ -448,7 +429,8 @@ public class XMLUtils {
      * hand in DOM spaces so that the nodes become visible in XPath space.
      *
      * @param doc
-     * @see <A HREF="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2650">Namespace axis resolution is not XPath compliant </A>
+     * @see <A HREF="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2650">
+     * Namespace axis resolution is not XPath compliant </A>
      */
     public static void circumventBug2650(Document doc) {
 
@@ -469,24 +451,26 @@ public class XMLUtils {
      * This is the work horse for {@link #circumventBug2650}.
      *
      * @param node
-     * @see <A HREF="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2650">Namespace axis resolution is not XPath compliant </A>
+     * @see <A HREF="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2650">
+     * Namespace axis resolution is not XPath compliant </A>
      */
     private static void circumventBug2650internal(Node node) {
-        Node parent=null;
-        Node sibling=null;
-        final String namespaceNs=Constants.NamespaceSpecNS;
+        Node parent = null;
+        Node sibling = null;
+        final String namespaceNs = Constants.NamespaceSpecNS;
         do {
             switch (node.getNodeType()) {
             case Node.ELEMENT_NODE :
                 Element element = (Element) node;
-                if (!element.hasChildNodes())
+                if (!element.hasChildNodes()) {
                     break;
+                }
                 if (element.hasAttributes()) {            	 
                     NamedNodeMap attributes = element.getAttributes();         	
                     int attributesLength = attributes.getLength();    
 
                     for (Node child = element.getFirstChild(); child!=null; 
-                    child=child.getNextSibling()) {            
+                        child = child.getNextSibling()) {            
 
                         if (child.getNodeType() != Node.ELEMENT_NODE) {
                             continue;
@@ -497,34 +481,32 @@ public class XMLUtils {
                             Attr currentAttr = (Attr) attributes.item(i); 
                             if (!namespaceNs.equals(currentAttr.getNamespaceURI()))
                                 continue;
-                            if (childElement.hasAttributeNS(namespaceNs,
+                            if (childElement.hasAttributeNS(namespaceNs, 
                                                             currentAttr.getLocalName())) {
                                 continue;
                             }
                             childElement.setAttributeNS(namespaceNs,
                                                         currentAttr.getName(),
                                                         currentAttr.getNodeValue());         					
-
-
                         }
                     }            
                 }
             case Node.ENTITY_REFERENCE_NODE :
             case Node.DOCUMENT_NODE :
-                parent=node;
-                sibling=node.getFirstChild();
+                parent = node;
+                sibling = node.getFirstChild();
                 break;
             }
-            while ((sibling==null) && (parent!=null)) {
-                sibling=parent.getNextSibling();
-                parent=parent.getParentNode();
+            while ((sibling == null) && (parent != null)) {
+                sibling = parent.getNextSibling();
+                parent = parent.getParentNode();
             };
-            if (sibling==null) {
+            if (sibling == null) {
                 return;
             }
 
-            node=sibling;
-            sibling=node.getNextSibling();
+            node = sibling;
+            sibling = node.getNextSibling();
         } while (true);
     }
 
@@ -532,17 +514,18 @@ public class XMLUtils {
      * @param sibling
      * @param nodeName
      * @param number
-     * @return nodes with the constrain
+     * @return nodes with the constraint
      */
     public static Element selectDsNode(Node sibling, String nodeName, int number) {
-        while (sibling!=null) {
-            if (Constants.SignatureSpecNS.equals(sibling.getNamespaceURI()) && sibling.getLocalName().equals(nodeName)) {
-                if (number==0){
+        while (sibling != null) {
+            if (Constants.SignatureSpecNS.equals(sibling.getNamespaceURI()) 
+                && sibling.getLocalName().equals(nodeName)) {
+                if (number == 0){
                     return (Element)sibling;
                 }
                 number--;
             }
-            sibling=sibling.getNextSibling();
+            sibling = sibling.getNextSibling();
         }
         return null;
     }
@@ -556,13 +539,14 @@ public class XMLUtils {
 
     public static Element selectXencNode(Node sibling, String nodeName, int number) {
         while (sibling!=null) {
-            if (EncryptionConstants.EncryptionSpecNS.equals(sibling.getNamespaceURI()) && sibling.getLocalName().equals(nodeName)) {
-                if (number==0){
+            if (EncryptionConstants.EncryptionSpecNS.equals(sibling.getNamespaceURI()) 
+                && sibling.getLocalName().equals(nodeName)) {
+                if (number == 0){
                     return (Element)sibling;
                 }
                 number--;
             }
-            sibling=sibling.getNextSibling();
+            sibling = sibling.getNextSibling();
         }
         return null;
     }
@@ -575,13 +559,13 @@ public class XMLUtils {
      * @return nodes with the constrain
      */
     public static Text selectDsNodeText(Node sibling, String nodeName, int number) {
-        Node n=selectDsNode(sibling,nodeName,number);
-        if (n==null) {
+        Node n = selectDsNode(sibling,nodeName,number);
+        if (n == null) {
             return null;
         }
-        n=n.getFirstChild();
-        while (n!=null && n.getNodeType()!=Node.TEXT_NODE) {
-            n=n.getNextSibling();
+        n = n.getFirstChild();
+        while (n != null && n.getNodeType() != Node.TEXT_NODE) {
+            n = n.getNextSibling();
         }
         return (Text)n;
     }
@@ -594,13 +578,13 @@ public class XMLUtils {
      * @return nodes with the constrain
      */
     public static Text selectNodeText(Node sibling, String uri, String nodeName, int number) {
-        Node n=selectNode(sibling,uri,nodeName,number);
-        if (n==null) {
+        Node n = selectNode(sibling,uri,nodeName,number);
+        if (n == null) {
             return null;
         }
-        n=n.getFirstChild();
-        while (n!=null && n.getNodeType()!=Node.TEXT_NODE) {
-            n=n.getNextSibling();
+        n = n.getFirstChild();
+        while (n != null && n.getNodeType() != Node.TEXT_NODE) {
+            n = n.getNextSibling();
         }
         return (Text)n;
     }
@@ -613,14 +597,15 @@ public class XMLUtils {
      * @return nodes with the constrain
      */
     public static Element selectNode(Node sibling, String uri,String nodeName, int number) {
-        while (sibling!=null) {
-            if (sibling.getNamespaceURI() != null && sibling.getNamespaceURI().equals(uri) && sibling.getLocalName().equals(nodeName)) {
-                if (number==0){
+        while (sibling != null) {
+            if (sibling.getNamespaceURI() != null && sibling.getNamespaceURI().equals(uri) 
+                && sibling.getLocalName().equals(nodeName)) {
+                if (number == 0){
                     return (Element)sibling;
                 }
                 number--;
             }
-            sibling=sibling.getNextSibling();
+            sibling = sibling.getNextSibling();
         }
         return null;
     }
@@ -630,35 +615,37 @@ public class XMLUtils {
      * @param nodeName    
      * @return nodes with the constrain
      */
-    public static Element[] selectDsNodes(Node sibling,String nodeName) {
-        return selectNodes(sibling,Constants.SignatureSpecNS,nodeName);
+    public static Element[] selectDsNodes(Node sibling, String nodeName) {
+        return selectNodes(sibling, Constants.SignatureSpecNS, nodeName);
     }
+    
     /**
      * @param sibling
      * @param uri
      * @param nodeName
-     * @return nodes with the constrain
+     * @return nodes with the constraint
      */
-    public static Element[] selectNodes(Node sibling,String uri,String nodeName) {
-        int size=20;
-        Element[] a= new Element[size];
-        int curr=0;
+    public static Element[] selectNodes(Node sibling, String uri, String nodeName) {
+        int size = 20;
+        Element[] a = new Element[size];
+        int curr = 0;
         //List list=new ArrayList();
-        while (sibling!=null) {
-            if (sibling.getNamespaceURI() != null && sibling.getNamespaceURI().equals(uri) && sibling.getLocalName().equals(nodeName)) {
-                a[curr++]=(Element)sibling;
-                if (size<=curr) {
-                    int cursize= size<<2;
-                    Element []cp=new Element[cursize];
-                    System.arraycopy(a,0,cp,0,size);
-                    a=cp;
-                    size=cursize;
+        while (sibling != null) {
+            if (sibling.getNamespaceURI() != null && sibling.getNamespaceURI().equals(uri) 
+                && sibling.getLocalName().equals(nodeName)) {
+                a[curr++] = (Element)sibling;
+                if (size <= curr) {
+                    int cursize = size<<2;
+                    Element []cp = new Element[cursize];
+                    System.arraycopy(a, 0, cp, 0, size);
+                    a = cp;
+                    size = cursize;
                 }   
             }
-            sibling=sibling.getNextSibling();
+            sibling = sibling.getNextSibling();
         }
-        Element []af=new Element[curr];
-        System.arraycopy(a,0,af,0,curr);
+        Element[] af = new Element[curr];
+        System.arraycopy(a, 0, af, 0, curr);
         return af;
     }
 
@@ -667,15 +654,14 @@ public class XMLUtils {
      * @param inputSet
      * @return nodes with the constrain
      */
-    public static Set excludeNodeFromSet(Node signatureElement, Set inputSet) {
-        Set resultSet = new HashSet();
-        Iterator iterator = inputSet.iterator();
+    public static Set<Node> excludeNodeFromSet(Node signatureElement, Set<Node> inputSet) {
+        Set<Node> resultSet = new HashSet<Node>();
+        Iterator<Node> iterator = inputSet.iterator();
 
         while (iterator.hasNext()) {
-            Node inputNode = (Node) iterator.next();
+            Node inputNode = iterator.next();
 
-            if (!XMLUtils
-                .isDescendantOrSelf(signatureElement, inputNode)) {
+            if (!XMLUtils.isDescendantOrSelf(signatureElement, inputNode)) {
                 resultSet.add(inputNode);
             }
         }

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/XPathFuncHereAPI.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/XPathFuncHereAPI.java?rev=1066784&r1=1066783&r2=1066784&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/XPathFuncHereAPI.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/XPathFuncHereAPI.java Thu Feb  3 11:37:47 2011
@@ -17,8 +17,6 @@
  */
 package org.apache.xml.security.utils;
 
-
-
 import javax.xml.transform.TransformerException;
 
 import org.apache.xml.security.transforms.implementations.FuncHereContext;
@@ -35,8 +33,6 @@ import org.w3c.dom.Text;
 import org.w3c.dom.traversal.NodeIterator;
 
 
-
-
 /**
  * This class does the same as {@link org.apache.xpath.XPathAPI} except that the XPath strings
  * are not supplied as Strings but as {@link Text}, {@link Attr}ibute or
@@ -54,250 +50,246 @@ import org.w3c.dom.traversal.NodeIterato
  */
 public class XPathFuncHereAPI {
 
-   /**
-    * Use an XPath string to select a single node. XPath namespace
-    * prefixes are resolved from the context node, which may not
-    * be what you want (see the next method).
-    *
-    * @param contextNode The node to start searching from.
-    * @param xpathnode A Node containing a valid XPath string.
-    * @return The first node found that matches the XPath, or null.
-    *
-    * @throws TransformerException
-    */
-   public static Node selectSingleNode(Node contextNode, Node xpathnode)
-           throws TransformerException {
-      return selectSingleNode(contextNode, xpathnode, contextNode);
-   }
-
-   /**
-    * Use an XPath string to select a single node.
-    * XPath namespace prefixes are resolved from the namespaceNode.
-    *
-    * @param contextNode The node to start searching from.
-    * @param xpathnode
-    * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
-    * @return The first node found that matches the XPath, or null.
-    *
-    * @throws TransformerException
-    */
-   public static Node selectSingleNode(
-           Node contextNode, Node xpathnode, Node namespaceNode)
-              throws TransformerException {
-
-      // Have the XObject return its result as a NodeSetDTM.
-      NodeIterator nl = selectNodeIterator(contextNode, xpathnode,
-                                           namespaceNode);
-
-      // Return the first node, or null
-      return nl.nextNode();
-   }
-
-   /**
-    *  Use an XPath string to select a nodelist.
-    *  XPath namespace prefixes are resolved from the contextNode.
-    *
-    *  @param contextNode The node to start searching from.
-    * @param xpathnode
-    *  @return A NodeIterator, should never be null.
-    *
-    * @throws TransformerException
-    */
-   public static NodeIterator selectNodeIterator(
-           Node contextNode, Node xpathnode) throws TransformerException {
-      return selectNodeIterator(contextNode, xpathnode, contextNode);
-   }
-
-   /**
-    *  Use an XPath string to select a nodelist.
-    *  XPath namespace prefixes are resolved from the namespaceNode.
-    *
-    *  @param contextNode The node to start searching from.
-    * @param xpathnode
-    *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
-    *  @return A NodeIterator, should never be null.
-    *
-    * @throws TransformerException
-    */
-   public static NodeIterator selectNodeIterator(
-           Node contextNode, Node xpathnode, Node namespaceNode)
-              throws TransformerException {
-
-      // Execute the XPath, and have it return the result
-      XObject list = eval(contextNode, xpathnode, namespaceNode);
-
-      // Have the XObject return its result as a NodeSetDTM.
-      return list.nodeset();
-   }
-
-   /**
-    *  Use an XPath string to select a nodelist.
-    *  XPath namespace prefixes are resolved from the contextNode.
-    *
-    *  @param contextNode The node to start searching from.
-    * @param xpathnode
-    *  @return A NodeIterator, should never be null.
-    *
-    * @throws TransformerException
-    */
-   public static NodeList selectNodeList(Node contextNode, Node xpathnode)
-           throws TransformerException {
-      return selectNodeList(contextNode, xpathnode, contextNode);
-   }
-
-   /**
-    *  Use an XPath string to select a nodelist.
-    *  XPath namespace prefixes are resolved from the namespaceNode.
-    *
-    *  @param contextNode The node to start searching from.
-    * @param xpathnode
-    *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
-    *  @return A NodeIterator, should never be null.
-    *
-    * @throws TransformerException
-    */
-   public static NodeList selectNodeList(
-           Node contextNode, Node xpathnode, Node namespaceNode)
-              throws TransformerException {
-
-      // Execute the XPath, and have it return the result
-      XObject list = eval(contextNode, xpathnode, namespaceNode);
-
-      // Return a NodeList.
-      return list.nodelist();
-   }
-
-   /**
-    *  Evaluate XPath string to an XObject.  Using this method,
-    *  XPath namespace prefixes will be resolved from the namespaceNode.
-    *  @param contextNode The node to start searching from.
-    * @param xpathnode
-    *  @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
-    *  @see org.apache.xpath.objects.XObject
-    *  @see org.apache.xpath.objects.XNull
-    *  @see org.apache.xpath.objects.XBoolean
-    *  @see org.apache.xpath.objects.XNumber
-    *  @see org.apache.xpath.objects.XString
-    *  @see org.apache.xpath.objects.XRTreeFrag
-    *
-    * @throws TransformerException
-    */
-   public static XObject eval(Node contextNode, Node xpathnode)
-           throws TransformerException {
-      return eval(contextNode, xpathnode, contextNode);
-   }
-
-   /**
-    *  Evaluate XPath string to an XObject.
-    *  XPath namespace prefixes are resolved from the namespaceNode.
-    *  The implementation of this is a little slow, since it creates
-    *  a number of objects each time it is called.  This could be optimized
-    *  to keep the same objects around, but then thread-safety issues would arise.
-    *
-    *  @param contextNode The node to start searching from.
-    * @param xpathnode
-    *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
-    *  @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
-    *  @see org.apache.xpath.objects.XObject
-    *  @see org.apache.xpath.objects.XNull
-    *  @see org.apache.xpath.objects.XBoolean
-    *  @see org.apache.xpath.objects.XNumber
-    *  @see org.apache.xpath.objects.XString
-    *  @see org.apache.xpath.objects.XRTreeFrag
-    *
-    * @throws TransformerException
-    */
-   public static XObject eval(
-           Node contextNode, Node xpathnode, Node namespaceNode)
-              throws TransformerException {
-
-      // Since we don't have a XML Parser involved here, install some default support
-      // for things like namespaces, etc.
-      // (Changed from: XPathContext xpathSupport = new XPathContext();
-      //    because XPathContext is weak in a number of areas... perhaps
-      //    XPathContext should be done away with.)
-      FuncHereContext xpathSupport = new FuncHereContext(xpathnode);
-
-      // Create an object to resolve namespace prefixes.
-      // XPath namespaces are resolved from the input context node's document element
-      // if it is a root node, or else the current context node (for lack of a better
-      // resolution space, given the simplicity of this sample code).
-      PrefixResolverDefault prefixResolver =
-         new PrefixResolverDefault((namespaceNode.getNodeType()
-                                    == Node.DOCUMENT_NODE)
-                                   ? ((Document) namespaceNode)
-                                      .getDocumentElement()
-                                   : namespaceNode);
-      String str = getStrFromNode(xpathnode);
-
-      // Create the XPath object.
-      XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
-
-      // Execute the XPath, and have it return the result
-      // return xpath.execute(xpathSupport, contextNode, prefixResolver);
-      int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode);
-
-      return xpath.execute(xpathSupport, ctxtNode, prefixResolver);
-   }
-
-   /**
-    *   Evaluate XPath string to an XObject.
-    *   XPath namespace prefixes are resolved from the namespaceNode.
-    *   The implementation of this is a little slow, since it creates
-    *   a number of objects each time it is called.  This could be optimized
-    *   to keep the same objects around, but then thread-safety issues would arise.
-    *
-    *   @param contextNode The node to start searching from.
-    * @param xpathnode
-    *   @param prefixResolver Will be called if the parser encounters namespace
-    *                         prefixes, to resolve the prefixes to URLs.
-    *   @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
-    *   @see org.apache.xpath.objects.XObject
-    *   @see org.apache.xpath.objects.XNull
-    *   @see org.apache.xpath.objects.XBoolean
-    *   @see org.apache.xpath.objects.XNumber
-    *   @see org.apache.xpath.objects.XString
-    *   @see org.apache.xpath.objects.XRTreeFrag
-    *
-    * @throws TransformerException
-    */
-   public static XObject eval(
-           Node contextNode, Node xpathnode, PrefixResolver prefixResolver)
-              throws TransformerException {
-
-      String str = getStrFromNode(xpathnode);
-
-      // Since we don't have a XML Parser involved here, install some default support
-      // for things like namespaces, etc.
-      // (Changed from: XPathContext xpathSupport = new XPathContext();
-      //    because XPathContext is weak in a number of areas... perhaps
-      //    XPathContext should be done away with.)
-      // Create the XPath object.
-      XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
-
-      // Execute the XPath, and have it return the result
-      FuncHereContext xpathSupport = new FuncHereContext(xpathnode);
-      int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode);
-
-      return xpath.execute(xpathSupport, ctxtNode, prefixResolver);
-   }
-
-   /**
-    * Method getStrFromNode
-    *
-    * @param xpathnode
-    * @return the string from the node
-    */
-   private static String getStrFromNode(Node xpathnode) {
-
-      if (xpathnode.getNodeType() == Node.TEXT_NODE) {
-         return ((Text) xpathnode).getData();
-      } else if (xpathnode.getNodeType() == Node.ATTRIBUTE_NODE) {
-         return ((Attr) xpathnode).getNodeValue();
-      } else if (xpathnode.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
-         return ((ProcessingInstruction) xpathnode).getNodeValue();
-      }
+    /**
+     * Use an XPath string to select a single node. XPath namespace
+     * prefixes are resolved from the context node, which may not
+     * be what you want (see the next method).
+     *
+     * @param contextNode The node to start searching from.
+     * @param xpathnode A Node containing a valid XPath string.
+     * @return The first node found that matches the XPath, or null.
+     *
+     * @throws TransformerException
+     */
+    public static Node selectSingleNode(Node contextNode, Node xpathnode)
+        throws TransformerException {
+        return selectSingleNode(contextNode, xpathnode, contextNode);
+    }
+
+    /**
+     * Use an XPath string to select a single node.
+     * XPath namespace prefixes are resolved from the namespaceNode.
+     *
+     * @param contextNode The node to start searching from.
+     * @param xpathnode
+     * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
+     * @return The first node found that matches the XPath, or null.
+     *
+     * @throws TransformerException
+     */
+    public static Node selectSingleNode(
+        Node contextNode, Node xpathnode, Node namespaceNode
+    ) throws TransformerException {
+
+        // Have the XObject return its result as a NodeSetDTM.
+        NodeIterator nl = selectNodeIterator(contextNode, xpathnode, namespaceNode);
+
+        // Return the first node, or null
+        return nl.nextNode();
+    }
+
+    /**
+     *  Use an XPath string to select a nodelist.
+     *  XPath namespace prefixes are resolved from the contextNode.
+     *
+     *  @param contextNode The node to start searching from.
+     * @param xpathnode
+     *  @return A NodeIterator, should never be null.
+     *
+     * @throws TransformerException
+     */
+    public static NodeIterator selectNodeIterator(
+        Node contextNode, Node xpathnode) throws TransformerException {
+        return selectNodeIterator(contextNode, xpathnode, contextNode);
+    }
+
+    /**
+     *  Use an XPath string to select a nodelist.
+     *  XPath namespace prefixes are resolved from the namespaceNode.
+     *
+     *  @param contextNode The node to start searching from.
+     * @param xpathnode
+     *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
+     *  @return A NodeIterator, should never be null.
+     *
+     * @throws TransformerException
+     */
+    public static NodeIterator selectNodeIterator(
+        Node contextNode, Node xpathnode, Node namespaceNode
+    ) throws TransformerException {
+
+        // Execute the XPath, and have it return the result
+        XObject list = eval(contextNode, xpathnode, namespaceNode);
+
+        // Have the XObject return its result as a NodeSetDTM.
+        return list.nodeset();
+    }
+
+    /**
+     *  Use an XPath string to select a nodelist.
+     *  XPath namespace prefixes are resolved from the contextNode.
+     *
+     *  @param contextNode The node to start searching from.
+     * @param xpathnode
+     *  @return A NodeIterator, should never be null.
+     *
+     * @throws TransformerException
+     */
+    public static NodeList selectNodeList(Node contextNode, Node xpathnode)
+        throws TransformerException {
+        return selectNodeList(contextNode, xpathnode, contextNode);
+    }
+
+    /**
+     *  Use an XPath string to select a nodelist.
+     *  XPath namespace prefixes are resolved from the namespaceNode.
+     *
+     *  @param contextNode The node to start searching from.
+     *  @param xpathnode
+     *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
+     *  @return A NodeIterator, should never be null.
+     *
+     * @throws TransformerException
+     */
+    public static NodeList selectNodeList(
+        Node contextNode, Node xpathnode, Node namespaceNode
+    ) throws TransformerException {
+
+        // Execute the XPath, and have it return the result
+        XObject list = eval(contextNode, xpathnode, namespaceNode);
+
+        // Return a NodeList.
+        return list.nodelist();
+    }
+
+    /**
+     *  Evaluate XPath string to an XObject.  Using this method,
+     *  XPath namespace prefixes will be resolved from the namespaceNode.
+     *  @param contextNode The node to start searching from.
+     *  @param xpathnode
+     *  @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
+     *  @see org.apache.xpath.objects.XObject
+     *  @see org.apache.xpath.objects.XNull
+     *  @see org.apache.xpath.objects.XBoolean
+     *  @see org.apache.xpath.objects.XNumber
+     *  @see org.apache.xpath.objects.XString
+     *  @see org.apache.xpath.objects.XRTreeFrag
+     *
+     * @throws TransformerException
+     */
+    public static XObject eval(Node contextNode, Node xpathnode)
+        throws TransformerException {
+        return eval(contextNode, xpathnode, contextNode);
+    }
+
+    /**
+     *  Evaluate XPath string to an XObject.
+     *  XPath namespace prefixes are resolved from the namespaceNode.
+     *  The implementation of this is a little slow, since it creates
+     *  a number of objects each time it is called.  This could be optimized
+     *  to keep the same objects around, but then thread-safety issues would arise.
+     *
+     *  @param contextNode The node to start searching from.
+     *  @param xpathnode
+     *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
+     *  @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
+     *  @see org.apache.xpath.objects.XObject
+     *  @see org.apache.xpath.objects.XNull
+     *  @see org.apache.xpath.objects.XBoolean
+     *  @see org.apache.xpath.objects.XNumber
+     *  @see org.apache.xpath.objects.XString
+     *  @see org.apache.xpath.objects.XRTreeFrag
+     *
+     * @throws TransformerException
+     */
+    public static XObject eval(
+        Node contextNode, Node xpathnode, Node namespaceNode
+    ) throws TransformerException {
+        // Since we don't have a XML Parser involved here, install some default support
+        // for things like namespaces, etc.
+        // (Changed from: XPathContext xpathSupport = new XPathContext();
+        //    because XPathContext is weak in a number of areas... perhaps
+        //    XPathContext should be done away with.)
+        FuncHereContext xpathSupport = new FuncHereContext(xpathnode);
+
+        // Create an object to resolve namespace prefixes.
+        // XPath namespaces are resolved from the input context node's document element
+        // if it is a root node, or else the current context node (for lack of a better
+        // resolution space, given the simplicity of this sample code).
+        PrefixResolverDefault prefixResolver =
+            new PrefixResolverDefault((namespaceNode.getNodeType() == Node.DOCUMENT_NODE)
+                    ? ((Document) namespaceNode).getDocumentElement() : namespaceNode);
+        String str = getStrFromNode(xpathnode);
+
+        // Create the XPath object.
+        XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
+
+        // Execute the XPath, and have it return the result
+        // return xpath.execute(xpathSupport, contextNode, prefixResolver);
+        int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode);
+
+        return xpath.execute(xpathSupport, ctxtNode, prefixResolver);
+    }
+
+    /**
+     *   Evaluate XPath string to an XObject.
+     *   XPath namespace prefixes are resolved from the namespaceNode.
+     *   The implementation of this is a little slow, since it creates
+     *   a number of objects each time it is called.  This could be optimized
+     *   to keep the same objects around, but then thread-safety issues would arise.
+     *
+     *   @param contextNode The node to start searching from.
+     *   @param xpathnode
+     *   @param prefixResolver Will be called if the parser encounters namespace
+     *                         prefixes, to resolve the prefixes to URLs.
+     *   @return An XObject, which can be used to obtain a string, number, nodelist, etc, 
+     *           should never be null.
+     *   @see org.apache.xpath.objects.XObject
+     *   @see org.apache.xpath.objects.XNull
+     *   @see org.apache.xpath.objects.XBoolean
+     *   @see org.apache.xpath.objects.XNumber
+     *   @see org.apache.xpath.objects.XString
+     *   @see org.apache.xpath.objects.XRTreeFrag
+     *
+     * @throws TransformerException
+     */
+    public static XObject eval(
+        Node contextNode, Node xpathnode, PrefixResolver prefixResolver
+    ) throws TransformerException {
+
+        String str = getStrFromNode(xpathnode);
+
+        // Since we don't have a XML Parser involved here, install some default support
+        // for things like namespaces, etc.
+        // (Changed from: XPathContext xpathSupport = new XPathContext();
+        //    because XPathContext is weak in a number of areas... perhaps
+        //    XPathContext should be done away with.)
+        // Create the XPath object.
+        XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
+
+        // Execute the XPath, and have it return the result
+        FuncHereContext xpathSupport = new FuncHereContext(xpathnode);
+        int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode);
+
+        return xpath.execute(xpathSupport, ctxtNode, prefixResolver);
+    }
+
+    /**
+     * Method getStrFromNode
+     *
+     * @param xpathnode
+     * @return the string from the node
+     */
+    private static String getStrFromNode(Node xpathnode) {
+
+        if (xpathnode.getNodeType() == Node.TEXT_NODE) {
+            return ((Text) xpathnode).getData();
+        } else if (xpathnode.getNodeType() == Node.ATTRIBUTE_NODE) {
+            return ((Attr) xpathnode).getNodeValue();
+        } else if (xpathnode.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
+            return ((ProcessingInstruction) xpathnode).getNodeValue();
+        }
 
-      return "";
-   }
+        return "";
+    }
 }

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/signature/CreateSignatureTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/signature/CreateSignatureTest.java?rev=1066784&r1=1066783&r2=1066784&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/signature/CreateSignatureTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/signature/CreateSignatureTest.java Thu Feb  3 11:37:47 2011
@@ -39,6 +39,7 @@ import org.apache.xml.security.transform
 import org.apache.xml.security.transforms.params.XPathContainer;
 import org.apache.xml.security.signature.XMLSignature;
 import org.apache.xml.security.utils.Constants;
+import org.apache.xml.security.utils.ElementProxy;
 import org.apache.xml.security.utils.XMLUtils;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -136,13 +137,13 @@ public class CreateSignatureTest extends
 
     @org.junit.Test
     public void testWithNSPrefixDisabled() throws Exception {
-        String prefix = Constants.getSignatureSpecNSprefix();
+        String prefix = ElementProxy.getDefaultPrefix(Constants.SignatureSpecNS);
         try {
-            Constants.setSignatureSpecNSprefix("");
+            ElementProxy.setDefaultPrefix(Constants.SignatureSpecNS, "");
             doSign();
-            Constants.setSignatureSpecNSprefix(prefix);
+            ElementProxy.setDefaultPrefix(Constants.SignatureSpecNS, prefix);
         } catch (Exception e) {
-            Constants.setSignatureSpecNSprefix(prefix);
+            ElementProxy.setDefaultPrefix(Constants.SignatureSpecNS, prefix);
             throw e;
         }
     }

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/signature/SignatureTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/signature/SignatureTest.java?rev=1066784&r1=1066783&r2=1066784&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/signature/SignatureTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/signature/SignatureTest.java Thu Feb  3 11:37:47 2011
@@ -31,6 +31,7 @@ import org.apache.xml.security.signature
 import org.apache.xml.security.signature.XMLSignatureException;
 import org.apache.xml.security.transforms.Transforms;
 import org.apache.xml.security.utils.Constants;
+import org.apache.xml.security.utils.ElementProxy;
 import org.apache.xml.security.utils.resolver.implementations.ResolverXPointer;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -46,7 +47,7 @@ public class SignatureTest extends org.j
 
     public SignatureTest() throws Exception {
         Init.init();
-        Constants.setSignatureSpecNSprefix("ds");
+        ElementProxy.setDefaultPrefix(Constants.SignatureSpecNS, "ds");
     }
 
     @org.junit.Test