These lines of code are causing an xxe vulnerability to show up in a Checkmarx report:
InputStream is = connection.getInputStream();
XMLInputFactory factory = XMLInputFactory.newInstance();
XMLStreamReader reader = factory.createXMLStreamReader(is);
The issue states that:
"The application sends a request to a remote server, for some resource, using createXMLStreamReader. However, an attacker can control the target of the request, by sending a URL or other data in getInputStream."
Any ideas how to resolve this?