Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 46071 invoked from network); 11 Apr 2008 23:01:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Apr 2008 23:01:36 -0000 Received: (qmail 67006 invoked by uid 500); 11 Apr 2008 23:01:29 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 66959 invoked by uid 500); 11 Apr 2008 23:01:29 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 66948 invoked by uid 500); 11 Apr 2008 23:01:29 -0000 Delivered-To: apmail-jakarta-tomcat-dev@jakarta.apache.org Received: (qmail 66230 invoked by uid 99); 11 Apr 2008 23:01:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Apr 2008 16:01:27 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Apr 2008 23:00:53 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 826D91A9832; Fri, 11 Apr 2008 16:01:06 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r647344 - /tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java Date: Fri, 11 Apr 2008 23:01:05 -0000 To: tomcat-dev@jakarta.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080411230106.826D91A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: markt Date: Fri Apr 11 16:00:55 2008 New Revision: 647344 URL: http://svn.apache.org/viewvc?rev=647344&view=rev Log: Code clean up. Java5 and remove unused code. No functional change. Modified: tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java Modified: tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java?rev=647344&r1=647343&r2=647344&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java (original) +++ tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java Fri Apr 11 16:00:55 2008 @@ -47,7 +47,6 @@ import javax.servlet.ServletException; import org.apache.catalina.Context; -import org.apache.catalina.Globals; import org.apache.catalina.core.StandardContext; import org.apache.catalina.util.StringManager; import org.apache.tomcat.util.digester.Digester; @@ -253,12 +252,6 @@ File tldCache=null; - if (context instanceof StandardContext) { - File workDir= (File) - ((StandardContext)context).getServletContext().getAttribute(Globals.WORK_DIR_ATTR); - //tldCache=new File( workDir, "tldCache.ser"); - } - // Option to not rescan if( ! rescan ) { // find the cache @@ -273,8 +266,8 @@ * Acquire the list of TLD resource paths, possibly embedded in JAR * files, to be processed */ - Set resourcePaths = tldScanResourcePaths(); - Map jarPaths = getJarPaths(); + Set resourcePaths = tldScanResourcePaths(); + Map jarPaths = getJarPaths(); // Check to see if we can use cached listeners if (tldCache != null && tldCache.exists()) { @@ -286,19 +279,20 @@ } // Scan each accumulated resource path for TLDs to be processed - Iterator paths = resourcePaths.iterator(); + Iterator paths = resourcePaths.iterator(); while (paths.hasNext()) { - String path = (String) paths.next(); + String path = paths.next(); if (path.endsWith(".jar")) { tldScanJar(path); } else { tldScanTld(path); } } + if (jarPaths != null) { - paths = jarPaths.values().iterator(); - while (paths.hasNext()) { - tldScanJar((File) paths.next()); + Iterator files = jarPaths.values().iterator(); + while (files.hasNext()) { + tldScanJar(files.next()); } } @@ -339,12 +333,12 @@ * * @return Last modification date */ - private long getLastModified(Set resourcePaths, Map jarPaths) - throws Exception { + private long getLastModified(Set resourcePaths, + Map jarPaths) throws Exception { long lastModified = 0; - Iterator paths = resourcePaths.iterator(); + Iterator paths = resourcePaths.iterator(); while (paths.hasNext()) { String path = (String) paths.next(); URL url = context.getServletContext().getResource(path); @@ -360,9 +354,9 @@ } if (jarPaths != null) { - paths = jarPaths.values().iterator(); - while (paths.hasNext()) { - File jarFile = (File) paths.next(); + Iterator files = jarPaths.values().iterator(); + while (files.hasNext()) { + File jarFile = files.next(); long lastM = jarFile.lastModified(); if (lastM > lastModified) lastModified = lastM; if (log.isDebugEnabled()) { @@ -459,9 +453,9 @@ try { jarFile = new JarFile(file); - Enumeration entries = jarFile.entries(); + Enumeration entries = jarFile.entries(); while (entries.hasMoreElements()) { - JarEntry entry = (JarEntry) entries.nextElement(); + JarEntry entry = entries.nextElement(); name = entry.getName(); if (!name.startsWith("META-INF/")) { continue; @@ -572,11 +566,11 @@ * @exception IOException if an input/output error occurs while * accumulating the list of resource paths */ - private Set tldScanResourcePaths() throws IOException { + private Set tldScanResourcePaths() throws IOException { if (log.isDebugEnabled()) { log.debug(" Accumulating TLD resource paths"); } - Set resourcePaths = new HashSet(); + Set resourcePaths = new HashSet(); // Accumulate resource paths explicitly listed in the web application // deployment descriptor @@ -623,7 +617,7 @@ */ private void tldScanResourcePathsWebInf(DirContext resources, String rootPath, - Set tldPaths) + Set tldPaths) throws IOException { if (log.isTraceEnabled()) { @@ -631,9 +625,9 @@ } try { - NamingEnumeration items = resources.list(rootPath); + NamingEnumeration items = resources.list(rootPath); while (items.hasMoreElements()) { - NameClassPair item = (NameClassPair) items.nextElement(); + NameClassPair item = items.nextElement(); String resourcePath = rootPath + "/" + item.getName(); if (!resourcePath.endsWith(".tld") && (resourcePath.startsWith("/WEB-INF/classes") @@ -675,9 +669,9 @@ * * @return Map of JAR file paths */ - private Map getJarPaths() { + private Map getJarPaths() { - HashMap jarPathMap = null; + HashMap jarPathMap = null; ClassLoader webappLoader = Thread.currentThread().getContextClassLoader(); ClassLoader loader = webappLoader; @@ -717,7 +711,7 @@ || noTldJars == null || !noTldJars.contains(file.getName())) { if (jarPathMap == null) { - jarPathMap = new HashMap(); + jarPathMap = new HashMap(); jarPathMap.put(path, file); } else if (!jarPathMap.containsKey(path)) { jarPathMap.put(path, file); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org