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; } }
return; } finally { digester.reset();
return; } finally { digester.reset();
return; } finally { digester.reset();
return; } finally { digester.reset();
return; } 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(); 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; } }
throw e; } finally { digester.reset();
throw e; } finally { digester.reset();
/** * 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(); } }
return; } finally { digester.reset();
throw e; } finally { digester.reset();
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(); } } } }