/** * Load Description from external source * * @param aURL */ public void load(String aURL) { synchronized (digester) { File aRegistryFile = serverFile(aURL); try { registry = (StoreRegistry) digester.parse(aRegistryFile); registryResource = aRegistryFile.toURI().toURL(); } catch (IOException e) { log.error(e); } catch (SAXException e) { log.error(e); } } }
public void parse(URL url) throws IOException, SAXException { try (InputStream is = url.openStream()) { XmlErrorHandler handler = new XmlErrorHandler(); digester.setErrorHandler(handler); digester.push(this); InputSource source = new InputSource(url.toExternalForm()); source.setByteStream(is); digester.parse(source); if (!handler.getWarnings().isEmpty() || !handler.getErrors().isEmpty()) { handler.logFindings(log, source.getSystemId()); if (!handler.getErrors().isEmpty()) { // throw the first to indicate there was a error during processing throw handler.getErrors().iterator().next(); } } } finally { digester.reset(); } }
public void parse(URL url) throws IOException, SAXException { try (InputStream is = url.openStream()) { XmlErrorHandler handler = new XmlErrorHandler(); digester.setErrorHandler(handler); digester.push(this); InputSource source = new InputSource(url.toExternalForm()); source.setByteStream(is); digester.parse(source); if (!handler.getWarnings().isEmpty() || !handler.getErrors().isEmpty()) { handler.logFindings(log, source.getSystemId()); if (!handler.getErrors().isEmpty()) { // throw the first to indicate there was a error during processing throw handler.getErrors().iterator().next(); } } } finally { digester.reset(); } }
public void parse(URL url) throws IOException, SAXException { try (InputStream is = url.openStream()) { XmlErrorHandler handler = new XmlErrorHandler(); digester.setErrorHandler(handler); digester.push(this); InputSource source = new InputSource(url.toExternalForm()); source.setByteStream(is); digester.parse(source); if (!handler.getWarnings().isEmpty() || !handler.getErrors().isEmpty()) { handler.logFindings(log, source.getSystemId()); if (!handler.getErrors().isEmpty()) { // throw the first to indicate there was a error during processing throw handler.getErrors().iterator().next(); } } } finally { digester.reset(); } }
private XmlErrorHandler tldScanStream(InputStream resourceStream) throws IOException { InputSource source = new InputSource(resourceStream); XmlErrorHandler result = new XmlErrorHandler(); synchronized (tldDigester) { try { tldDigester.setErrorHandler(result); tldDigester.push(this); tldDigester.parse(source); } catch (SAXException s) { // Hack - makes exception handling simpler throw new IOException(s); } finally { tldDigester.reset(); } return result; } }
private XmlErrorHandler tldScanStream(InputStream resourceStream) throws IOException { InputSource source = new InputSource(resourceStream); XmlErrorHandler result = new XmlErrorHandler(); synchronized (tldDigester) { try { tldDigester.setErrorHandler(result); tldDigester.push(this); tldDigester.parse(source); } catch (SAXException s) { // Hack - makes exception handling simpler throw new IOException(s); } finally { tldDigester.reset(); } return result; } }
public static void main(String[] args) throws Exception { BasicConfigurator.configure(); Digester digester = new Digester(); digester.setValidating(false); digester.addRule("sip-app/servlet-mapping/pattern", new TestRule()); digester.parse(new StringReader(TEST)); }
try { digester.push(this); digester.parse(file); } catch (Exception e) { log.warn("Error processing configuration file " +
try { digester.push(this); digester.parse(file); } catch (Exception e) { log.warn("Error processing configuration file " +
private XmlErrorHandler tldScanStream(InputStream resourceStream) throws IOException { InputSource source = new InputSource(resourceStream); XmlErrorHandler result = new XmlErrorHandler(); synchronized (tldDigester) { try { tldDigester.setErrorHandler(result); tldDigester.push(this); tldDigester.parse(source); } catch (SAXException s) { // Hack - makes exception handling simpler throw new IOException(s); } finally { tldDigester.reset(); if (resourceStream != null) { try { resourceStream.close(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); } } } return result; } }
private XmlErrorHandler tldScanStream(InputStream resourceStream) throws IOException { InputSource source = new InputSource(resourceStream); XmlErrorHandler result = new XmlErrorHandler(); synchronized (tldDigester) { try { tldDigester.setErrorHandler(result); tldDigester.push(this); tldDigester.parse(source); } catch (SAXException s) { // Hack - makes exception handling simpler throw new IOException(s); } finally { tldDigester.reset(); if (resourceStream != null) { try { resourceStream.close(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); } } } return result; } }
private XmlErrorHandler tldScanStream(InputStream resourceStream) throws IOException { InputSource source = new InputSource(resourceStream); XmlErrorHandler result = new XmlErrorHandler(); synchronized (tldDigester) { try { tldDigester.setErrorHandler(result); tldDigester.push(this); tldDigester.parse(source); } catch (SAXException s) { // Hack - makes exception handling simpler throw new IOException(s); } finally { tldDigester.reset(); if (resourceStream != null) { try { resourceStream.close(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); } } } return result; } }
digester.parse(stream); } catch (Exception e) { log.error("Error digesting Registry data", e);
digester.parse(stream); } catch (Exception e) { log.error("Error digesting Registry data", e);
/** * Scan the TLD contents in the specified input stream, and register * any application event listeners found there. <b>NOTE</b> - It is * the responsibility of the caller to close the InputStream after this * method returns. * * @param resourceStream InputStream containing a tag library descriptor * * @exception Exception if an exception occurs while scanning this TLD */ private void tldScanStream(InputSource resourceStream) throws Exception { if (tldDigester == null){ tldDigester = createTldDigester(); } synchronized (tldDigester) { try { tldDigester.push(this); tldDigester.parse(resourceStream); } finally { tldDigester.reset(); } } }
public TaglibXml parse(TldResourcePath path) throws IOException, SAXException { try (InputStream is = path.openStream()) { XmlErrorHandler handler = new XmlErrorHandler(); digester.setErrorHandler(handler); TaglibXml taglibXml = new TaglibXml(); digester.push(taglibXml); InputSource source = new InputSource(path.toExternalForm()); source.setByteStream(is); digester.parse(source); if (!handler.getWarnings().isEmpty() || !handler.getErrors().isEmpty()) { handler.logFindings(log, source.getSystemId()); if (!handler.getErrors().isEmpty()) { // throw the first to indicate there was a error during processing throw handler.getErrors().iterator().next(); } } return taglibXml; } finally { digester.reset(); } }
try { digester.push(this); digester.parse(file); } catch (Exception e) { log.warn("Error processing configuration file " +
static Providers loadProviders(File configFile) { try (InputStream is = new FileInputStream(configFile)) { // Construct a digester to read the XML input file Digester digester = new Digester(); try { digester.setFeature("http://apache.org/xml/features/allow-java-encodings", true); digester.setValidating(true); digester.setNamespaceAware(true); } catch (Exception e) { throw new SecurityException(e); } // Create an object to hold the parse results and put it on the top // of the digester's stack Providers result = new Providers(); digester.push(result); // Configure the digester digester.addObjectCreate("jaspic-providers/provider", Provider.class.getName()); digester.addSetProperties("jaspic-providers/provider"); digester.addSetNext("jaspic-providers/provider", "addProvider", Provider.class.getName()); digester.addObjectCreate("jaspic-providers/provider/property", Property.class.getName()); digester.addSetProperties("jaspic-providers/provider/property"); digester.addSetNext("jaspic-providers/provider/property", "addProperty", Property.class.getName()); // Parse the input digester.parse(is); return result; } catch (IOException | SAXException e) { throw new SecurityException(e); } }
digester.parse(stream); } catch (Exception e) { log.error("Error digesting Registry data", e);
public void execute() throws Exception { if (registry == null) { registry = Registry.getRegistry(null, null); } InputStream stream = (InputStream) source; if (digester == null) { digester = createDigester(registry); } synchronized (digester) { // Process the input file to configure our registry try { // Push our registry object onto the stack digester.push(mbeans); digester.parse(stream); } catch (Exception e) { log.error("Error digesting Registry data", e); throw e; } finally { digester.reset(); } } } }