F4ded edited a comment on pull request #484:
URL: https://github.com/apache/tomcat/pull/484#issuecomment-1071100064
> I would appreciate it if someone who understands the Jasper components of
Tomcat better than I do could please evaluate this patch for correctness. It
looks good to me, but I haven't reproduced the problem and tested the solution.
It seems simple enough that a code-inspection would suffice as a review and
inclusion... if the code is well-understood.
Here are the details.
org.apache.jasper.compiler.Compiler#isOutDated(boolean):
```java
public boolean isOutDated(boolean checkClass) {
if (jsw != null
&& (ctxt.getOptions().getModificationTestInterval() > 0)) {
if (jsw.getLastModificationTest()
+ (ctxt.getOptions().getModificationTestInterval() *
1000) > System
.currentTimeMillis()) {
return false;
}
jsw.setLastModificationTest(System.currentTimeMillis());
}
//...
}
```
- `jsw.getLastModificationTest()` default value is 0
- `ctxt.getOptions().getModificationTestInterval()` default value is 4
After modifying the jsp file, condition `if(jsw.getLast ...... >
System.currentTimeMillis())` is false when the jsp file is accessed for the
first time, then `jsw.setLastModificationTest(System.currentTimeMillis())` will
be executed.
So within 4 seconds we access this jsp page again, the condition
`if(jsw.getLast ...... > System.currentTimeMillis())` will be true and the
function `isOutdated` will return false:
<img width="1098" alt="image"
src="https://user-images.githubusercontent.com/66620626/158852595-7a68480a-9b17-4a51-bcdd-221c44e15a45.png">
The statement `try{..}` will not be executed, when the function `compile()`
returns to `JspServletWrapper#service`, the `
compileException` will not be thrown, then function `getServlet()` will
return a servlet which corresponds to the old jsp file, request will be handled
by it, so the we get the response of old jsp file:
<img width="862" alt="image"
src="https://user-images.githubusercontent.com/66620626/158854495-3ac488c4-6807-4271-9b5c-a9bb1b5bcf7f.png">
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]