#393 collection() fails with NPE

v8.5
closed
nobody
5
2012-10-08
2005-08-15
Michael Kay
No

The collection() function fails with a
NullPointerException if the URI supplied is a relative
URI and no base URI is known. For consistency with the
document() function, it should default the base URI to
that of the current working directory (Java property
user.dir).

The following source change fixes this:

In
net.sf.saxon.functions.StandardCollectionURIResolver,
at line 77, add the code:

if (base == null) {
base = StandardURIResolver.tryToExpand(base);
if (base == null) {
DynamicError err = new DynamicError(
"Cannot resolve relative URI: no
base URI available");
err.setXPathContext(context);
throw err;
}
}

This requires an import for
net.sf.saxon.StandardURIResolver.

Michael Kay

Discussion