Resolver attempts to resolve XSDs from w3c.org site [rename] #253
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi Norm,
Thank you for your great work on the XML resolver!
Version: most recent 6.x (resolver + data)
I'd like to consult you on something..... I have integrated theresolver in some some junit tests, basically to explore how the APIs can be used.
It appears that there are significant performance differences between running these tests on my VDI (virtualized PC, Windows 10) and my build agent (Tests run in Java21 linux docker container, which runs on a Linux bamboo agent.)
There are only 4 tests, taking 0.25s on windows, and 131s (!) on docker. Leaving out the preparation/test code, this is the pseudo code:
Good old EntityResolver
For sure the Entity2Resolver
The LSResourceResolver
And the internal API
Also nicely integrated with a parser and validator, the performance is so off expectations.
Do you have an idea why the difference in speed is so significant? Any idea where I should start looking?
A factor is that on my Windows PC there is an HTTP proxy defined which could be used to resolve schemas/dtds/entities; this ENV setting is not available on the build agent. This could in theory cause HTTP timeouts, but I have no proof of this. In the code snippets above only entities stored in the data jar are (attempted to be) resolved.
it looks like (checking with wireshark) still some calls are made to w3c.org.... firewalls do not allow...
Interesting. Have you enabled the
MERGE_HTTPSproperty? I can't tell from your screenshot, are those attempts to usehttporhttps?It looks like the
xmldsigissue may be a different bug. The manifest has a trailing#on the URI which may be causing the miss. I shall have to see if I can test that.thnx for responding. I did not (yet) switch on the 'merge' option.
I see similar delays for eg XMLschema.dtd; I enabled some logging:
the first and last logs lines come from my application, where I put a StopWatch directly around the call to the XMLresolver.
resolver:
after some time of quiet-ness, my code logs:
@ndw I will try the "access-external-entity" and "accessExternalDocument" , and set the protocols "file:,classpath,jar:" - does that make sense?
that yields into
I'm struggling to reproduce this.
That returns
jar:file:/Volumes/Projects/xmlresolver/resolver/build/libs/xmlresolver-6.0.18-data.jar!/org/xmlresolver/www.w3.org/2000/09/xmldsig-core-schema.xsdSo it's not hitting the W3C. I have to say, that's a bad call to resolve entity; the first argument should be the system identifier of an XML entity and an XSD isn't an XML entity and that's not a system identfier. And passing that as the second argument is completely bogus because it definitely isn't a public identifier.
This also works for me:
It doesn't work if I leave the
#off the end of the namespace URI, but I guess it shouldn't as that's not the namespace.What is
TestShared.XMLSIG_NSin your tests?From elsewhere in your comment:
That succeeds for me as well, returning
jar:file:/Volumes/Projects/xmlresolver/resolver/build/libs/xmlresolver-6.0.18-data.jar!/org/xmlresolver/www.w3.org/2001/XMLSchema.dtd.Access denied is completely expected in your last comment. You said
httpaccess was forbidden and then tried to get anhttp:resource. That's a fail without even looking.Can you make a small test program that reproduces the problem? What else is going on? Is this a multithreaded application sharing a resolver between threads? (I'm grasping at straws a bit.)
Your dump of the debug log shows that yes, the data jar is on the classpath, so I'm having a hard time imaging why it should succeed for me and fail for you...
I (kinda) was able to isolate the issue; reminder: it only happens in an isolated build environment, with no internet access, but with access to a maven repository proxy.
The code:
this is the associated log:
with the configuration
Got it. It's an interesting interaction between RDDL support and "masking jar URIs". The resource is resolved, and RDDL wants to go take a peek in it, but masking jar URIs means that instead of returning the jar: URI that was resolved, it returns the original, and then we're off to www.w3.org for it.
Set
parse-rddl=falsein your configuration and I think the problem will go away. I'll fix that bug and probably make RDDL false by default.On 1st glimpse, setting that property does not solve...