XPath parser continously looping to find Xpath function library in a given custom xpath expression

52 Views Asked by At

I am trying to load a custom library of XPath functions in my project using a custom build jar. However when the function is called to load the XPath functions i get redirected to XPathParser.java class which is present in the package net.sf.saxon.expr.parser, where a function is called - reportMissingFunction which consist of the following loop and it never exits this loop even though it could not find the a particular XPath function.

  if (config.getBooleanProperty(Feature.ALLOW_EXTERNAL_FUNCTIONS)) {
            boolean existsWithDifferentArity = false;

            for(int i = 0; i < arguments.length + 5; ++i) {
                if (i != arguments.length) {
                    SymbolicName.F sn = new SymbolicName.F(functionName, i);
                    if (this.env.getFunctionLibrary().isAvailable(sn)) {
                        existsWithDifferentArity = true;
                        break;
                    }
                }
            }

            if (existsWithDifferentArity) {
                sb.append(". The namespace URI and local name are recognized, but the number of arguments is wrong");
            } else {
                supplementary = getMissingFunctionExplanation(functionName, config);
                if (supplementary != null) {
                    sb.append(". ").append(supplementary);
                }
            }
        } else {
            sb.append(". External function calls have been disabled");
        }

I do not understand whats going on and my application freezes since it is always stuck in the for-loop.

I am expecting either the function to be found and exit the for-loop and continue the normal behavior of my application or some timeout to be set or an error message to be thrown if the XPath functions are not found in that loop.

Please let me know your suggestion on how to proceed.

0

There are 0 best solutions below