You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2010/12/10 18:41:34 UTC

DO NOT REPLY [Bug 50455] New: Jasper don't detects changes in jsp file if we load de jsp and after we modify the jsp in the same second

https://issues.apache.org/bugzilla/show_bug.cgi?id=50455

           Summary: Jasper don't detects changes in jsp file if we load de
                    jsp and after we modify the jsp in the same second
           Product: Tomcat 7
           Version: 7.0.5
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: aag@enforex.es


If we have a jsp file (not in a war file; just directly in the file system)
then we first call the jsp; then it is compiled and executed.
But if after this, the jsp file is modified very very fast (by an external
process for example), then, jasper does not detect the change and then do not
recompile the file, and so on, we do not see the change with the first version.

this is because in the class:

org/apache/jasper/compiler/Compiler.java

in the line 442 is like:

'if (targetLastModified < jspRealLastModified)'

Why is the error? because in some systems, the method lastModified or
getLastModified does not care miliseconds and return units in seconds.

Then, if we first compile, and after (in the same second) we modify the jsp
file, as the functions ignores miliseconds units, then jspRealLastModified is
equals to 
targetLastModified (BUT IT IS NOT).

So I think is that the solution is very simple. Change the condition from:

'if (targetLastModified < jspRealLastModified)'

to

'if (targetLastModified <= jspRealLastModified)'


I tried this and it works.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 50455] Jasper doesn't detect changes in a jsp file if we load and modify the jsp file in the same second

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50455

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX
            Summary|Jasper don't detects        |Jasper doesn't detect
                   |changes in jsp file if we   |changes in a jsp file if we
                   |load de jsp and after we    |load and modify the jsp
                   |modify the jsp in the same  |file in the same second
                   |second                      |

--- Comment #2 from Mark Thomas <ma...@apache.org> 2010-12-12 16:29:34 EST ---
The suggested change will not be made. The system described is clearly capable
of generating and compiling a JSP within the same second. With the proposed
change, the JSP could get compiled unnecessarily.

There are a couple of ways of handling the root cause. Bug 23406 is probably
the best solution for this scenario.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 50455] Jasper don't detects changes in jsp file if we load de jsp and after we modify the jsp in the same second

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50455

--- Comment #1 from Alejandro Anadon <aa...@enforex.es> 2010-12-10 13:22:51 EST ---
(In reply to comment #0)
> If we have a jsp file (not in a war file; just directly in the file system)
> then we first call the jsp; then it is compiled and executed.
> But if after this, the jsp file is modified very very fast (by an external
> process for example), then, jasper does not detect the change and then do not
> recompile the file, and so on, we do not see the change with the first version.
> 
> this is because in the class:
> 
> org/apache/jasper/compiler/Compiler.java
> 
> in the line 442 is like:
> 
> 'if (targetLastModified < jspRealLastModified)'
> 
> Why is the error? because in some systems, the method lastModified or
> getLastModified does not care miliseconds and return units in seconds.
> 
> Then, if we first compile, and after (in the same second) we modify the jsp
> file, as the functions ignores miliseconds units, then jspRealLastModified is
> equals to 
> targetLastModified (BUT IT IS NOT).
> 
> So I think is that the solution is very simple. Change the condition from:
> 
> 'if (targetLastModified < jspRealLastModified)'
> 
> to
> 
> 'if (targetLastModified <= jspRealLastModified)'
> 
> 
> I tried this and it works.


Just only to clarify that when I say 'the method lastModified or
getLastModified does not care miliseconds and return units in seconds' I do not
mean that the funtion returns seconds.. I mean that if the real time is
'1292005037195' it returns '1292005037000' ignoring the 195ms.

(The timestamp of creation of the file, In some file systems does this.)

I tried to be as much clear as it is posible.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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