Package org.apache.tomcat.util.scan

Examples of org.apache.tomcat.util.scan.NonClosingJarInputStream


        // JarURLConnection#getJarFile() creates temporary copies of the JAR if
        // the underlying resource is not a file URL. That can be slow so the
        // InputStream for the resource is used
        URL resourceURL = jarConn.getJarFileURL();
        NonClosingJarInputStream jarInputStream = null;
        String name = null;

        try {
            URLConnection resourceConn = resourceURL.openConnection();
            resourceConn.setUseCaches(false);
            jarInputStream =
                new NonClosingJarInputStream(resourceConn.getInputStream());

            JarEntry entry = jarInputStream.getNextJarEntry();
            while (entry != null) {
                name = entry.getName();
                if (name.startsWith("META-INF/") && name.endsWith(".tld")) {
                    XmlErrorHandler handler = tldScanStream(jarInputStream);
                    handler.logFindings(log, jarConn.getURL() + name);
                }
                entry = jarInputStream.getNextJarEntry();
            }
        } catch (IOException ioe) {
            log.warn(sm.getString("tldConfig.jarFail", jarConn.getURL() + name),
                    ioe);
        } finally {
            if (jarInputStream != null) {
                try {
                    jarInputStream.reallyClose();
                } catch (Throwable t) {
                    ExceptionUtils.handleThrowable(t);
                }
            }
        }
View Full Code Here


        // the underlying resource is not a file URL. That can be slow so the
        // InputStream for the resource is used
        URL resourceURL = jarConn.getJarFileURL();
        String resourcePath = resourceURL.toString();
       
        NonClosingJarInputStream jarInputStream = null;
       
        boolean foundTld = false;
        try {
            URLConnection resourceConn = resourceURL.openConnection();
            resourceConn.setUseCaches(false);
            jarInputStream =
                new NonClosingJarInputStream(resourceConn.getInputStream());
            JarEntry entry = jarInputStream.getNextJarEntry();
            while (entry != null) {
                String name = entry.getName();
                if (name.startsWith("META-INF/") && name.endsWith(".tld")) {
                    foundTld = true;
                    tldScanStream(resourcePath, name, jarInputStream);
                }
                entry = jarInputStream.getNextJarEntry();
            }
        } finally {
            if (jarInputStream != null) {
                try {
                    jarInputStream.reallyClose();
                } catch (Throwable t) {
                    ExceptionUtils.handleThrowable(t);
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.tomcat.util.scan.NonClosingJarInputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.