FasterXML / FasterXML/aalto-xml

Add support for JEP-185 (JAXP-1.5) properties named ACCESS_EXTERNAL_

Open
#77 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
306
Forks
71
PR merge metrics
No merged PRs in 30d

Description

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:
```java
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)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.