Project

Profile

Help

Bug #6361

closed

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

Added by Manikandan S 2 months ago. Updated 16 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Saxon extensions
Sprint/Milestone:
-
Start date:
2024-02-27
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
10
Fix Committed on Branch:
10
Fixed in Maintenance Release:
Platforms:
Java

Description

  • 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.
  • Jar file is located in classpath under JVM_PARAMS, Xpath function is able to find that jar from classPath.
  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.
  • I'm using Saxon 10.6 and Xpath 3.0

Note: Here I'm using custom library(External Jar file) which inside the class path contains some Xpath functions, not modified anything on Saxon FunctionLibrary interface.

Stack overflow ticket : https://stackoverflow.com/questions/78001210/xpath-parser-continously-looping-to-find-xpath-function-library-in-a-given-custo?noredirect=1#comment137514388_78001210

Please register to edit this issue

Also available in: Atom PDF