Dear Dr. Kay,
I use SaxonHE 9.5. I have a pool of threads which run XQueryExpressions. Each XQuery processing thread has its own Configuration. All Configurations are compatible as they share a single NamePool and DocumentNumberAllocator. I have a cache of Documents created via Configuration.buildDocument(content) method. The cached documents are provided to the XQuery processing iterators via registered custom SourceResolver. But, when Configuration unravels provided DocumentInfo (TinyDocumentImpl) it compares document's Configuration with itself and throws IllegalArgumentException in case when they're not the same:
public NodeInfo unravel(Source source) { List<ExternalObjectModel> externalObjectModels = getExternalObjectModels(); for (ExternalObjectModel model : externalObjectModels) { NodeInfo node = model.unravel(source, this); if (node != null) { if (node.getConfiguration() != this) { throw new IllegalArgumentException("Externally supplied Node belongs to the wrong Configuration"); } return node; } } if (source instanceof NodeInfo) { if (((NodeInfo) source).getConfiguration() != this) { throw new IllegalArgumentException("Externally supplied NodeInfo belongs to the wrong Configuration"); } return (NodeInfo) source; } .............
Is it really neccesary to have the same Configuration in this case? Can't they be compared as
node.getConfiguration().isCompatible(this) instead?
Thanks, Denis.
Anonymous
Please note we no longer use this site for Saxon support: I would be grateful if you would use http://saxonica.plan.io/ in future, as this allows us to support the open source and commercial products in one place. I will raise an issue there for you.
You're right, this appears to be an oversight. It should be enough to test that the configurations are compatible.