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 2005/01/20 21:06:33 UTC

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

raul        2005/01/20 12:06:33

  Modified:    src/org/apache/xml/security Init.java
  Log:
  Enable to be compiled with the CVS version of XALAN.
  
  Revision  Changes    Path
  1.30      +20 -2     xml-security/src/org/apache/xml/security/Init.java
  
  Index: Init.java
  ===================================================================
  RCS file: /home/cvs/xml-security/src/org/apache/xml/security/Init.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- Init.java	16 Oct 2004 09:20:33 -0000	1.29
  +++ Init.java	20 Jan 2005 20:06:33 -0000	1.30
  @@ -19,6 +19,8 @@
   
   
   import java.io.InputStream;
  +import java.lang.reflect.Method;
  +import java.lang.reflect.Modifier;
   
   import javax.xml.parsers.DocumentBuilder;
   import javax.xml.parsers.DocumentBuilderFactory;
  @@ -34,6 +36,7 @@
   import org.apache.xml.security.utils.PRNG;
   import org.apache.xml.security.utils.XMLUtils;
   import org.apache.xml.security.utils.resolver.ResourceResolver;
  +import org.apache.xpath.Expression;
   import org.apache.xpath.compiler.FuncLoader;
   import org.apache.xpath.compiler.FunctionTable;
   import org.apache.xpath.functions.Function;
  @@ -414,7 +417,22 @@
   	 * Try to register our here() implementation as internal function.
   	 */            
   	{	    
  -	    FunctionTable.installFunction("here", new FuncHere());
  +        Class []args={String.class, Expression.class};
  +        try {
  +			Method installFunction=FunctionTable.class.getMethod("installFunction",args);
  +            if ((installFunction.getModifiers() & Modifier.STATIC)!=0) {
  +            	//xalan 1.1
  +                Object []params={"here",new FuncHere()};
  +                installFunction.invoke(null, params );
  +            } else {
  +            	log.warn("Xalan new, install function not installed.");
  +                //TODO: Right now not a good way to install the function. Let see how this
  +                //is resolv, latter in xalan.
  +            }
  +		} catch (Exception e) {
  +			//what to do here, just log it
  +            log.warn("Exception while installing Function",e);
  +        }
           if (log.isDebugEnabled())
           	log.debug("Registered class " + FuncHere.class.getName()
   	            + " for XPath function 'here()' function in internal table");