Thanks, now fixed.  (Saxon 9.1 is attempting to preevaluate constant filter expressions at compile time, and isn't getting the dependency analysis of the predicate right).
 
Michael Kay
Saxonica


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Rademacher, Gunther
Sent: 26 May 2008 16:09
To: Mailing list for the SAXON XSLT and XQuery processor
Subject: [saxon] NPE while compiling XQuery predicate on an external variable

This occurs with Saxon 9.0.9.3 while compiling

    declare variable $v external;
    1[$v]

The stacktrace is

    java.lang.NullPointerException
            at net.sf.saxon.instruct.GlobalParam.evaluateVariable(GlobalParam.java:34)
            at net.sf.saxon.expr.VariableReference.evaluateVariable(VariableReference.java:472)
            at net.sf.saxon.expr.FilterExpression.iterate(FilterExpression.java:1002)
            at net.sf.saxon.expr.FilterExpression.tryEarlyEvaluation(FilterExpression.java:456)
            at net.sf.saxon.expr.FilterExpression.optimize(FilterExpression.java:442)
            at net.sf.saxon.query.XQueryExpression.<init>(XQueryExpression.java:77)
            at net.sf.saxon.query.QueryParser.makeXQueryExpression(QueryParser.java:121)
            at net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:345)
            at net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:407)
            at net.sf.saxon.Query.compileQuery(Query.java:763)
            at net.sf.saxon.Query.doQuery(Query.java:180)
            at net.sf.saxon.Query.main(Query.java:112)

Best regards,
Gunther


Software AG – Sitz/Registered office: Uhlandstraße 12, 64297 Darmstadt, Germany, – Registergericht/Commercial register: Darmstadt HRB 1562 - Vorstand/ Management Board: Karl-Heinz Streibich (Vorsitzender/Chairman), David Broadbent, Mark Edwards, Dr. Peter Kürpick,Arnd Zinnhardt; - Aufsichtsratsvorsitzender/ Chairman of the Supervisory Board: Frank F. Beelitz - http://www.softwareag.com