and since users will be trying to use them we'll probably need to add support.
It is further unfortunate these are added as System properties since that has all the problems of global variables; as well as the question of how these should interact with existing configuration settings.
This issue was found in our project when we tried to comply with SonarQubes warning that we should always disable DTD resolution.
We have a method:
public static javax.xml.stream.XMLInputFactory buildXMLInputFactory(NameSpace ns)
{
javax.xml.stream.XMLInputFactory factory = javax.xml.stream.XMLInputFactory.newInstance();
factory.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, ""); // Compliant ← This is (XMLInputFactory.java:277)
factory.setProperty(javax.xml.stream.XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
factory.setProperty(javax.xml.stream.XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
factory.setProperty(javax.xml.stream.XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.valueOf(ns == NameSpace.NAMESPACE_AWARE));
return factory;
}
And this fails with:
Caused by: java.lang.IllegalArgumentException: Unrecognized property 'http://javax.xml.XMLConstants/property/accessExternalDTD'
at com.fasterxml.aalto.impl.CommonConfig.setProperty(CommonConfig.java:135)
at com.fasterxml.aalto.in.ReaderConfig.setProperty(ReaderConfig.java:373)
at com.fasterxml.aalto.stax.InputFactoryImpl.setProperty(InputFactoryImpl.java:229)
at com.company.xml.XMLInputFactory.buildXMLInputFactory(XMLInputFactory.java:277)
Text stolen from https://github.com/FasterXML/woodstox/issues/51
Apparently there's a JEP to add Yet Another Set of configuration properties (to overlap with existing) ones:
http://openjdk.java.net/jeps/185
and since users will be trying to use them we'll probably need to add support.
It is further unfortunate these are added as System properties since that has all the problems of global variables; as well as the question of how these should interact with existing configuration settings.
This issue was found in our project when we tried to comply with SonarQubes warning that we should always disable DTD resolution.
We have a method:
And this fails with: