Probably this is a regression caused by https://issues.apache.org/jira/browse/ODE-369
It seems like all ode custom xpath functions are called twice.

On 06/01/2012 02:04 PM, Jayant Vaish wrote:
Custom xpath function is executed twice because:-

In
org.apache.ode.bpel.elang.xpath20.runtime.XPath20ExpressionRuntime.evaluate(OExpression
cexp, EvaluationContext ctx) throws FaultException, EvaluationException{
      .....
       try {
             someRes = evaluate(cexp, ctx, XPathConstants.NODESET);
         } catch (Exception e) {
             someRes = evaluate(cexp, ctx, XPathConstants.STRING);
         }
     ....

}


evaluate(cexp, ctx, XPathConstants.NODESET); is responsible to call the
custom xpath function, but that function return type is boolean.
So, it throws exception:
org.apache.ode.bpel.explang.EvaluationException: Error while executing an
XPath expression: net.sf.saxon.trans.XPathException: Extension function
required class org.w3c.dom.NodeList; supplied value of class
net.sf.saxon.value.BooleanValue could not be converted. (As result is not
able to converted into specified type i.e. NODESET)

Then in the catch block it again call the custom xpath function.

Is their any way to avoid calling custom xpath function twice or if there is
any way to get the return type of custom xpath function based on that value
we can set the type.

Thanks in Advance.

Reply via email to