Michael Kroll created CXF-9021: ---------------------------------- Summary: Warning "Could not resolve Schema for datatypes.dtd" when file was found Key: CXF-9021 URL: https://issues.apache.org/jira/browse/CXF-9021 Project: CXF Issue Type: Bug Components: Core Affects Versions: 4.0.4 Reporter: Michael Kroll
Assuming you have - system property {{javax.xml.accessExternalDTD}} set to {{all}} or {{file}} - enabled {{out}} validation - an xsd that references a DTD And fire a request, the following log appears: {quote} WARN [org.apa.cxf.ws.add.EndpointReferenceUtils] Could not resolve Schema for ../dtd/XMLSchema.dtd {quote} The request is then correctly validated, despite the warning. Tested with both valid and invalid equests. Looking at the code: {code:java|org.apache.cxf.ws.addressing.EndpointReferenceUtils.SchemaLSResourceResolver#resolveResource} if (impl == null) { [...] // if found in schemas map: return impl; if (systemId != null) { [...] // if found by systemId: return impl; } if (namespaceURI != null) { [...] // if found by namespaceURI: return impl; } [...] if (systemId == null) { systemId = publicId; } if (systemId != null) { InputSource source = resolver.resolve(systemId, baseURI); if (source != null) { impl = new LSInputImpl(); impl.setByteStream(source.getByteStream()); impl.setSystemId(source.getSystemId()); impl.setPublicId(source.getPublicId()); + ### the code above is run, source is found, impl is set + ### i miss a 'return impl;' here, to match the code above } } LOG.warning("Could not resolve Schema for " + systemId); } return impl; {code} I added two inline 'comments', starting with ### to mark the place where i miss a return statement. Reasoning: # all of the above happens in an if block: {{if (impl==null)}} # it seems that with different searches eg. via {{namespaceURI}} and {{systemId}}, the variable {{impl}} should be filled and then returned # the warning in the last line says 'Could not resolve Schema' # but the code directly above it may indeed find a {{source}} and fill {{impl}} # so the schema (in my case a DTD) is found. I can verify that by looking into debug values. And the validation then takes place, with expected outcomes. # first finding the schema and then printing that it could not be found is misleading proposed solution: - either a {{return impl;}} statement like mentioned above - or guard the warning with {{if (impl==null)}} -- This message was sent by Atlassian Jira (v8.20.10#820010)