Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#154 NullPtrException evaluating variable used in attribute

v7.6.5
closed
Michael Kay
5
2012-10-08
2003-09-02
Michael Kay
No

in XQuery, a Null Pointer Exception occurs evaluating a
variable reference within an attribute of a direct
element constructor (<e att="{$var}"/>) if the variable
has been "promoted" during expression evaluation; that
is, if the variable is initialized using a let
expression that has been moved outside a containing for
expression because it does not depend on the iterand of
the for expression.

Test case: users/campesato/checkerboard

Source code fixed. The fix is to add the lines

    if (valueExpression != null) {
        valueExpression =

valueExpression.promote(offer);
}

to the promoteInst() method of
net.sf.saxon.instruct.Attribute. Similar changes are
needed for Comment and ProcessingInstruction.

MK

Discussion