@Override public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { final InputSource inputSource; if (publicIdToResourceNameMap.keySet().contains(publicId)) { final String dtdResourceName = publicIdToResourceNameMap.get(publicId); final ClassLoader loader = getClass().getClassLoader(); final InputStream dtdIs = loader.getResourceAsStream(dtdResourceName); inputSource = new InputSource(dtdIs); } else { inputSource = super.resolveEntity(publicId, systemId); } return inputSource; }
@Override public InputSource resolveEntity(String systemId, String publicId) throws IOException, SAXException { InputSource result; if (Parser.DEPRECATED_TESTNG_DTD_URL.equals(publicId) || Parser.TESTNG_DTD_URL.equals(publicId)) { m_validate = true; InputStream is = getClass().getClassLoader().getResourceAsStream(Parser.TESTNG_DTD); if (null == is) { is = Thread.currentThread().getContextClassLoader().getResourceAsStream(Parser.TESTNG_DTD); if (null == is) { System.out.println("WARNING: couldn't find in classpath " + publicId + "\n" + "Fetching it from the Web site."); result = super.resolveEntity(systemId, publicId); } else { result = new InputSource(is); } } else { result = new InputSource(is); } } else { result = super.resolveEntity(systemId, publicId); } return result; }
@Override public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException { if (entityResolver != null) { return this.entityResolver.resolveEntity(publicId, systemId); } else { return super.resolveEntity(publicId, systemId); } } }
@Override public InputSource resolveEntity(String systemId, String publicId) throws IOException, SAXException { InputSource result; if (Parser.DEPRECATED_TESTNG_DTD_URL.equals(publicId) || Parser.TESTNG_DTD_URL.equals(publicId)) { m_validate = true; InputStream is = getClass().getClassLoader().getResourceAsStream(Parser.TESTNG_DTD); if (null == is) { is = Thread.currentThread().getContextClassLoader().getResourceAsStream(Parser.TESTNG_DTD); if (null == is) { System.out.println( "WARNING: couldn't find in classpath " + publicId + "\n" + "Fetching it from the Web site."); result = super.resolveEntity(systemId, publicId); } else { result = new InputSource(is); } } else { result = new InputSource(is); } } else { result = super.resolveEntity(systemId, publicId); } return result; }
@Override public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException { if (entityResolver!=null) { return entityResolver.resolveEntity(publicId, systemId); } return super.resolveEntity(publicId, systemId); }
/** * Delegate to {@link #entityResolver} if available. * * <p> * * <p>Note this is an XMLSchema based parser, all attempts to resolved DTDs are rejected. * * @param publicId The public identifier, or null if none is available. * @param systemId The system identifier provided in the XML document. * @return The new input source, or null to require the default behavior. * @exception java.io.IOException If there is an error setting up the new input source. * @exception org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception. */ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { // avoid dtd files if (systemId != null && systemId.endsWith("dtd")) { return new InputSource(new StringReader("")); } if (entityResolver != null) { return entityResolver.resolveEntity(publicId, systemId); } else { return super.resolveEntity(publicId, systemId); } } // hints
@Override public InputSource resolveEntity(String string, String string1) throws IOException, SAXException { return super.resolveEntity(string, string1); }
@Override public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException { return super.resolveEntity(publicId, systemId); }
@Override public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException { return super.resolveEntity(publicId, systemId); } }
@Override public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException { return super.resolveEntity(publicId, systemId); }
@Override public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException { return super.resolveEntity(publicId, systemId); }
public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException { return super.resolveEntity(publicId, systemId); }
@Override public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException { if (loggable) { logger.config("Resolve entity with PUBLIC [" + publicId + "], and SYSTEM [" + systemId + "]"); } return super.resolveEntity(publicId, systemId); }
@Override public InputSource resolveEntity( final String in_public_id, final String in_system_id) throws IOException, SAXException { LOG.trace("resolveEntity: {} {}", in_public_id, in_system_id); return super.resolveEntity(in_public_id, in_system_id); }
@Override public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException { if (this.peekParsingInfo().parsingActive) { return this.targetHandler.resolveEntity(publicId, systemId); } else { return super.resolveEntity(publicId, systemId); } }
@Override public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException { if (entityResolver!=null) { return entityResolver.resolveEntity(publicId, systemId); } return super.resolveEntity(publicId, systemId); }
@Override public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { final InputSource inputSource; if (publicIdToResourceNameMap.keySet().contains(publicId)) { final String dtdResourceName = publicIdToResourceNameMap.get(publicId); final ClassLoader loader = getClass().getClassLoader(); final InputStream dtdIs = loader.getResourceAsStream(dtdResourceName); inputSource = new InputSource(dtdIs); } else { inputSource = super.resolveEntity(publicId, systemId); } return inputSource; }
@Override public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException { InputSource inputSource = new InputSource(new StringReader("")); if (resolveEntities) { inputSource = super.resolveEntity(publicId, systemId); if (inputSource == null) { try { // Note: Not sure why, but following line of code has suffered terrible performance problems. // At times, it could take over a minute for the stream to open. This is why the web.xml // default for resolving entities is false. inputSource = new InputSource(new URL(systemId).openStream()); } catch (IOException ioException) { // Don't bother logging this as a warning or an error, because we can't assume connectivity to // the Internet to download a public URL. logger.trace("Unable to download publicId=[{0}], systemId=[{1}], referenced-in=[{2}]", new Object[] { publicId, systemId, url }); } } } return inputSource; } }
@Override public InputSource resolveEntity(String publicId, String systemId) throws java.io.IOException, SAXException { if (this.systemId != null && (getSchemaURI() == null || getSchemaURI().equals(publicId)) ) { return new InputSource(this.systemId); } return super.resolveEntity(publicId, systemId); }
@Override public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { log.debug("Looking for entity: " + publicId + " " + systemId); if (lastUsedEndsOfPathToAddress.get() != null) { Resource source = resolveEntityOnMap(publicId, systemId, lastUsedEndsOfPathToAddress.get()); if (source != null) { log.debug("Old map found: " + source.getURL()); return new InputSource(source.getInputStream()); } } for (HashMap<String, Resource> map : endsOfPathToAddress) { Resource source = resolveEntityOnMap(publicId, systemId, map); if (source != null) { lastUsedEndsOfPathToAddress.set(map); log.debug("New map found: " + source.getURL()); return new InputSource(source.getInputStream()); } } return super.resolveEntity(publicId, systemId); }