Search in sources :

Example 1 with FuncHere

use of com.sun.org.apache.xml.internal.security.transforms.implementations.FuncHere in project jdk8u_jdk by JetBrains.

the class XalanXPathAPI method fixupFunctionTable.

private static synchronized void fixupFunctionTable() {
    installed = false;
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Registering Here function");
    }
    /**
         * Try to register our here() implementation as internal function.
         */
    try {
        Class<?>[] args = { String.class, Expression.class };
        Method installFunction = FunctionTable.class.getMethod("installFunction", args);
        if ((installFunction.getModifiers() & Modifier.STATIC) != 0) {
            Object[] params = { "here", new FuncHere() };
            installFunction.invoke(null, params);
            installed = true;
        }
    } catch (Exception ex) {
        log.log(java.util.logging.Level.FINE, "Error installing function using the static installFunction method", ex);
    }
    if (!installed) {
        try {
            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);
            installed = true;
        } catch (Exception ex) {
            log.log(java.util.logging.Level.FINE, "Error installing function using the static installFunction method", ex);
        }
    }
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        if (installed) {
            log.log(java.util.logging.Level.FINE, "Registered class " + FuncHere.class.getName() + " for XPath function 'here()' function in internal table");
        } else {
            log.log(java.util.logging.Level.FINE, "Unable to register class " + FuncHere.class.getName() + " for XPath function 'here()' function in internal table");
        }
    }
}
Also used : FuncHere(com.sun.org.apache.xml.internal.security.transforms.implementations.FuncHere) FunctionTable(com.sun.org.apache.xpath.internal.compiler.FunctionTable) XObject(com.sun.org.apache.xpath.internal.objects.XObject) Method(java.lang.reflect.Method) TransformerException(javax.xml.transform.TransformerException)

Aggregations

FuncHere (com.sun.org.apache.xml.internal.security.transforms.implementations.FuncHere)1 FunctionTable (com.sun.org.apache.xpath.internal.compiler.FunctionTable)1 XObject (com.sun.org.apache.xpath.internal.objects.XObject)1 Method (java.lang.reflect.Method)1 TransformerException (javax.xml.transform.TransformerException)1