#297 NPE compiling empty xsl:attribute-set

v8.2
closed
5
2012-10-08
2005-02-01
Michael Kay
No

If an XSLT attribute set definition is empty, a null
pointer exception occurs at compile time.

The problem is new in 8.2.

Source fix: change the compile() method on line 156 of
net.sf.saxon.style.XSLAttributeSet.java to read:

public Expression compile(Executable exec) throws

TransformerConfigurationException {
if (referenceCount > 0 ) {
Expression body =
compileSequenceConstructor(exec,
iterateAxis(Axis.CHILD), true);

        try {
            if (body != null) {
                body =

body.simplify(getStaticContext());
if
(getConfiguration().getTraceListener() != null) {
TraceWrapper trace = new
TraceInstruction(body, this);

trace.setLocationId(allocateLocationId(getSystemId(),
getLineNumber()));

trace.setParentExpression(procedure);
body = trace;
}
}

procedure.setUseAttributeSets(useAttributeSets);
procedure.setNameCode(getObjectNameCode());
procedure.setBody(body);
procedure.setStackFrameMap(stackFrameMap);
procedure.setSystemId(getSystemId());
procedure.setLineNumber(getLineNumber());
procedure.setExecutable(exec);
} catch (XPathException e) {
compileError(e);
}
}
return null;
}

Discussion

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks