You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by ra...@apache.org on 2004/09/15 20:03:31 UTC

cvs commit: xml-security/src/org/apache/xml/security/utils CachedXPathFuncHereAPI.java

raul        2004/09/15 11:03:31

  Modified:    src/org/apache/xml/security/utils
                        CachedXPathFuncHereAPI.java
  Log:
  Throws an exception in case FuncHere class is not found by xalan (normally jdk 1.4.2_05).
  
  Revision  Changes    Path
  1.10      +17 -4     xml-security/src/org/apache/xml/security/utils/CachedXPathFuncHereAPI.java
  
  Index: CachedXPathFuncHereAPI.java
  ===================================================================
  RCS file: /home/cvs/xml-security/src/org/apache/xml/security/utils/CachedXPathFuncHereAPI.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- CachedXPathFuncHereAPI.java	3 Aug 2004 18:01:22 -0000	1.9
  +++ CachedXPathFuncHereAPI.java	15 Sep 2004 18:03:31 -0000	1.10
  @@ -36,7 +36,6 @@
   import org.w3c.dom.Text;
   import org.w3c.dom.traversal.NodeIterator;
   
  -
   /**
    *
    * @author $Author$
  @@ -192,6 +191,7 @@
       *
       *  @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.
       *
  @@ -238,6 +238,7 @@
       *
       *  @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
  @@ -300,6 +301,7 @@
       *
       *   @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.
  @@ -327,8 +329,19 @@
       	if (str.indexOf("here()")>0) {
       		_context.reset();
       		_dtmManager=_context.getDTMManager();
  -    	}     
  -    	xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
  +    	}
  +        try {
  +        	xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
  +        } 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"));
  +                 }
  +              }
  +              throw ex;
  +        }
           xpathStr=str;
       }