kinman      2004/10/14 16:54:01

  Modified:    jasper2/src/share/org/apache/jasper/compiler Compiler.java
  Log:
  - Fix bugzilla 31382: Stack overflow when compiling recursive tag files.
  
  Revision  Changes    Path
  1.97      +23 -30    
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java
  
  Index: Compiler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v
  retrieving revision 1.96
  retrieving revision 1.97
  diff -u -r1.96 -r1.97
  --- Compiler.java     5 Oct 2004 19:28:19 -0000       1.96
  +++ Compiler.java     14 Oct 2004 23:54:00 -0000      1.97
  @@ -326,7 +326,6 @@
        */
       public boolean isOutDated(boolean checkClass) {
   
  -        boolean outDated = false;
           String jsp = ctxt.getJspFile();
   
           if ((jsw != null)
  @@ -362,31 +361,31 @@
           }
           
           if (!targetFile.exists()) {
  -            outDated = true;
  -        } else {
  -            targetLastModified = targetFile.lastModified();
  -            if (checkClass && jsw != null) {
  -                jsw.setServletClassLastModifiedTime(targetLastModified);
  -            }   
  -            if (targetLastModified < jspRealLastModified) {
  -                if( log.isDebugEnabled() ) {
  -                    log.debug("Compiler: outdated: " + targetFile + " " +
  -                        targetLastModified );
  -                }
  -                outDated = true;
  +            return true;
  +        }
  +
  +        targetLastModified = targetFile.lastModified();
  +        if (checkClass && jsw != null) {
  +            jsw.setServletClassLastModifiedTime(targetLastModified);
  +        }   
  +        if (targetLastModified < jspRealLastModified) {
  +            if( log.isDebugEnabled() ) {
  +                log.debug("Compiler: outdated: " + targetFile + " " +
  +                    targetLastModified );
               }
  +            return true;
           }
   
           // determine if source dependent files (e.g. includes using include
           // directives) have been changed.
           if( jsw==null ) {
  -            return outDated;
  +            return false;
           }
           jsw.setLastModificationTest(System.currentTimeMillis());
           
           List depends = jsw.getDependants();
           if (depends == null) {
  -            return outDated;
  +            return false;
           }
   
           Iterator it = depends.iterator();
  @@ -395,29 +394,23 @@
               try {
                   URL includeUrl = ctxt.getResource(include);
                   if (includeUrl == null) {
  -                    outDated = true;
  +                    return true;
                   }
  -                if (!outDated) {
   
  -                    URLConnection includeUconn = includeUrl.openConnection();
  -                    long includeLastModified = includeUconn.getLastModified();
  -                    includeUconn.getInputStream().close();
  -
  -                    if (includeLastModified > targetLastModified) {
  -                        outDated = true;
  -                    }
  -                }
  -                if (outDated) {
  -                    // Remove any potential Wrappers for tag files
  -                    ctxt.getRuntimeContext().removeWrapper(include);
  +                URLConnection includeUconn = includeUrl.openConnection();
  +                long includeLastModified = includeUconn.getLastModified();
  +                includeUconn.getInputStream().close();
  +
  +                if (includeLastModified > targetLastModified) {
  +                    return true;
                   }
               } catch (Exception e) {
                   e.printStackTrace();
  -                outDated = true;
  +                return true;
               }
           }
   
  -        return outDated;
  +        return false;
   
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to