Dear developers of jasper,
I have a question about JspCompilationContext.isRemoved(). I think we should
check the file in file system instead of checking a counter.
In this method, we use a counter named ¡°removed¡± to determine if the JSP
file is in the file system.
   public boolean isRemoved() {
       if (removed > 1 ) {
           return true;
       }
       return false;
}
But I think there are two problems in above code.
1.      We will always get a 404 page when we recover a JSP file after we delete
it and access it with browser. What cause it is because the counter is
increased in Compiler.isOutDated() when we try to access a deleted JSP file.
But the counter is only reset to 0 in JspCompilationContext.load(), which is
executed after the method isOutDated(). In another word, the method load()
is never reset to 0 once counter is set to 2.
2.      We can access the page through browser successfully for two times after
we have deleted the relative JSP file in file system. Because condition is
¡°removed¡± is equal or larger than 2.

I think it may be better if we change the method in this way.
   public boolean isRemoved() {

       String jsp = getJspFile();
       try {
           URL jspUrl = getResource(jsp);
           if (jspUrl == null) {
               return true;
           }
           return false;
       } catch (Exception e) {
           e.printStackTrace();
           return true;
       }

   }

Do you think it is a sound idea? Does it cause impact against other code?
Any help is appreciated.

Sean

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/


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

Reply via email to