java.lang.StackOverflowError in SaxonHE 11.1
Added by Vladimir Nesterovsky almost 3 years ago
This is continuation of https://saxonica.plan.io/boards/3/topics/8459.
While trying to adapt existing code to changed Saxon's API I've updated my code like this:
configuration.setResourceResolver(
new ResourceResolverWrappingURIResolver(
new StandardURIResolver(configuration)
{
@Override
public Source resolve(String href, String base)
throws XPathException
{
if ((href != null) && (base != null) && base.startsWith("classpath:"))
{
var uri = new URI(href);
if (!uri.isAbsolute())
{
href = "classpath:" +
new URI(base.substring("classpath:".length())).
resolve(uri).
toString();
}
}
return super.resolve(href, base);
}
}));
When I run transformation with my custom URI resolver I get StackOverflowError exception:
[java] Exception in thread "main" java.lang.StackOverflowError
[java] at net.sf.saxon.Configuration.isTiming(Configuration.java:2278)
[java] at net.sf.saxon.lib.StandardURIResolver.resolve(StandardURIResolver.java:177)
[java] at ...$2.resolve()
[java] at net.sf.saxon.lib.ResourceResolverWrappingURIResolver.resolve(ResourceResolverWrappingURIResolver.java:46)
[java] at net.sf.saxon.lib.ResourceRequest.resolve(ResourceRequest.java:123)
[java] at net.sf.saxon.lib.StandardURIResolver.resolve(StandardURIResolver.java:270)
[java] at com.bphx.coolgen.stylesheet.XsltTransformer$2.resolve(XsltTransformer.java:493)
[java] at net.sf.saxon.lib.ResourceResolverWrappingURIResolver.resolve(ResourceResolverWrappingURIResolver.java:46)
[java] at net.sf.saxon.lib.ResourceRequest.resolve(ResourceRequest.java:123)
[java] at net.sf.saxon.lib.StandardURIResolver.resolve(StandardURIResolver.java:270)
[java] at ...$2.resolve()
[java] ...
In fact I think following code will result in exactly the same error:
configuration.setResourceResolver(new ResourceResolverWrappingURIResolver(new StandardURIResolver(configuration)));
Error, in my opinion, is due to that configuration calls resolver, and StandardURIResolver calls configuration's resolver.
Replies (1)
RE: java.lang.StackOverflowError in SaxonHE 11.1 - Added by Michael Kay almost 3 years ago
Raised as issue #5311
Please register to reply