Suspicious code using System.setProperty() for validation configuration
In SimpleDocumentValidator, the following code looks suspicious:
if ("http://s.validator.nu/html5-all.rnc".equals(schemaUrl)) {
System.setProperty("nu.validator.schema.rdfa-full", "1");
} else {
System.setProperty("nu.validator.schema.rdfa-full", "0");
}
It seems that, even with ClassLoader separation, it is not possible to run two validators in the same JVM at the same time, one with html5-all enabled, and one without. While the impact is small, there still is some impact of this on the CURIE matcher in class nu.validator.datatype.AbstractRel. It is impossible to run two validators in parallel, one that supports the CURIE superset of QNames, and one that doesn't.
A workaround could be to set a ThreadLocal variable in addition to the property. If the ThreadLocal exists, its value could be used, otherwise the System property.
It might also make sense to change the name of the property to "nu.validator.schema.rdfa-curie", as this is only switching QNames to CURIEs for RDFa, nothing else.
Note: This does currently not cause an issue to me. I do not have a use case of mixing CURIEs and QNames in the same JVM. I just noticed this while reading the code.
Thanks for the heads-up and I’m glad to hear at least that it’s not actually causing any problems. But that said, it’s anyway both very unlikely that I’d be able to make time to go back in and make any change/refinement for this — and it also seems very clear that we wouldn’t have any contributors stepping forward to contribute a patch.
However, if any of those circumstances change we and re-open/revisit this at that time.