defensive-coding-guide/en-US/snippets/Tasks-Serialization-XML-OpenJDK-NoEntityResolver.adoc

12 lines
363 B
Text
Raw Normal View History

class NoEntityResolver implements EntityResolver {
@Override
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException, IOException {
// Throwing an exception stops validation.
throw new IOException(String.format(
"attempt to resolve \"%s\" \"%s\"", publicId, systemId));
}
}