You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2010/02/22 22:07:39 UTC

svn commit: r915063 - in /tomcat/tc6.0.x/trunk: STATUS.txt java/org/apache/catalina/startup/TldConfig.java webapps/docs/changelog.xml

Author: markt
Date: Mon Feb 22 21:07:39 2010
New Revision: 915063

URL: http://svn.apache.org/viewvc?rev=915063&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48179
Cleanup uncalled code that was used to read tldCache file (kkolinko)

Modified:
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/TldConfig.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=915063&r1=915062&r2=915063&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Mon Feb 22 21:07:39 2010
@@ -144,12 +144,6 @@
   +1: markt
   -1: 
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48179
-  Cleanup uncalled code that was used to read tldCache file
-  https://issues.apache.org/bugzilla/attachment.cgi?id=24919
-  +1: kkolinko, markt, jfclere
-  -1:
-
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48678
   Having two server fields in the type hierarchy was causing unexpected
   behaviour

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/TldConfig.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/TldConfig.java?rev=915063&r1=915062&r2=915063&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/TldConfig.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/TldConfig.java Mon Feb 22 21:07:39 2010
@@ -20,12 +20,8 @@
 
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLClassLoader;
@@ -47,7 +43,6 @@
 import javax.servlet.ServletException;
 
 import org.apache.catalina.Context;
-import org.apache.catalina.Globals;
 import org.apache.catalina.Lifecycle;
 import org.apache.catalina.LifecycleEvent;
 import org.apache.catalina.LifecycleListener;
@@ -255,24 +250,6 @@
     public void execute() throws Exception {
         long t1=System.currentTimeMillis();
 
-        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
-            if( tldCache!= null && tldCache.exists()) {
-                // just read it...
-                processCache(tldCache);
-                return;
-            }
-        }
-
         /*
          * Acquire the list of TLD resource paths, possibly embedded in JAR
          * files, to be processed
@@ -280,15 +257,6 @@
         Set resourcePaths = tldScanResourcePaths();
         Map jarPaths = getJarPaths();
 
-        // Check to see if we can use cached listeners
-        if (tldCache != null && tldCache.exists()) {
-            long lastModified = getLastModified(resourcePaths, jarPaths);
-            if (lastModified < tldCache.lastModified()) {
-                processCache(tldCache);
-                return;
-            }
-        }
-
         // Scan each accumulated resource path for TLDs to be processed
         Iterator paths = resourcePaths.iterator();
         while (paths.hasNext()) {
@@ -308,18 +276,6 @@
 
         String list[] = getTldListeners();
 
-        if( tldCache!= null ) {
-            log.debug( "Saving tld cache: " + tldCache + " " + list.length);
-            try {
-                FileOutputStream out=new FileOutputStream(tldCache);
-                ObjectOutputStream oos=new ObjectOutputStream( out );
-                oos.writeObject( list );
-                oos.close();
-            } catch( IOException ex ) {
-                ex.printStackTrace();
-            }
-        }
-
         if( log.isDebugEnabled() )
             log.debug( "Adding tld listeners:" + list.length);
         for( int i=0; list!=null && i<list.length; i++ ) {
@@ -335,67 +291,6 @@
 
     // -------------------------------------------------------- Private Methods
 
-    /*
-     * Returns the last modification date of the given sets of resources.
-     *
-     * @param resourcePaths
-     * @param jarPaths
-     *
-     * @return Last modification date
-     */
-    private long getLastModified(Set resourcePaths, Map jarPaths)
-            throws Exception {
-
-        long lastModified = 0;
-
-        Iterator paths = resourcePaths.iterator();
-        while (paths.hasNext()) {
-            String path = (String) paths.next();
-            URL url = context.getServletContext().getResource(path);
-            if (url == null) {
-                log.debug( "Null url "+ path );
-                break;
-            }
-            long lastM = url.openConnection().getLastModified();
-            if (lastM > lastModified) lastModified = lastM;
-            if (log.isDebugEnabled()) {
-                log.debug( "Last modified " + path + " " + lastM);
-            }
-        }
-
-        if (jarPaths != null) {
-            paths = jarPaths.values().iterator();
-            while (paths.hasNext()) {
-                File jarFile = (File) paths.next();
-                long lastM = jarFile.lastModified();
-                if (lastM > lastModified) lastModified = lastM;
-                if (log.isDebugEnabled()) {
-                    log.debug("Last modified " + jarFile.getAbsolutePath()
-                              + " " + lastM);
-                }
-            }
-        }
-
-        return lastModified;
-    }
-
-    private void processCache(File tldCache ) throws IOException {
-        // read the cache and return;
-        try {
-            FileInputStream in=new FileInputStream(tldCache);
-            ObjectInputStream ois=new ObjectInputStream( in );
-            String list[]=(String [])ois.readObject();
-            if( log.isDebugEnabled() )
-                log.debug("Reusing tldCache " + tldCache + " " + list.length);
-            for( int i=0; list!=null && i<list.length; i++ ) {
-                context.addApplicationListener(list[i]);
-            }
-            ois.close();
-        } catch( ClassNotFoundException ex ) {
-            ex.printStackTrace();
-        }
-    }
-
     /**
      * Scan the JAR file at the specified resource path for TLDs in the
      * <code>META-INF</code> subdirectory, and scan each TLD for application

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=915063&r1=915062&r2=915063&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Mon Feb 22 21:07:39 2010
@@ -42,6 +42,10 @@
         started StandardService. (markt)
       </fix>
       <fix>
+        <bug>48179</bug>: Clean up dead code that was used to read tldCache
+        file. (kkolinko)
+      </fix>
+      <fix>
         <bug>48577</bug>: Filter URL when displaying missing included page.
         (markt)
       </fix>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org