On 26/05/2010, [email protected] <[email protected]> wrote:
> Author: kkolinko
> Date: Wed May 26 02:31:57 2010
> New Revision: 948294
>
> URL: http://svn.apache.org/viewvc?rev=948294&view=rev
> Log:
> Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=47878
> Return 404's rather than a permanent 500 if a JSP is deleted
> Make sure first response post deletion is correct
>
...
> ---
> tomcat/tc5.5.x/trunk/jasper/src/share/org/apache/jasper/JspCompilationContext.java
> (original)
> +++
> tomcat/tc5.5.x/trunk/jasper/src/share/org/apache/jasper/JspCompilationContext.java
> Wed May 26 02:31:57 2010
> @@ -74,14 +74,13 @@ public class JspCompilationContext {
> private String classPath;
>
> private String baseURI;
> - private String baseOutputDir;
> private String outputDir;
> private ServletContext context;
> private URLClassLoader loader;
>
> private JspRuntimeContext rctxt;
>
> - private int removed = 0;
> + private volatile int removed = 0;
Volatile ensures correct publication across threads, but does not
solve the lost-update problem.
> private URLClassLoader jspLoader;
> private URL baseUrl;
> @@ -539,16 +538,14 @@ public class JspCompilationContext {
> // ==================== Removal ====================
>
> public void incrementRemoved() {
> - if (removed > 1) {
> - jspCompiler.removeGeneratedFiles();
> - if( rctxt != null )
> - rctxt.removeWrapper(jspUri);
> + if (removed == 0 && rctxt != null) {
> + rctxt.removeWrapper(jspUri);
> }
> removed++;
The above line can suffer from a lost update as the increment is not atomic.
> }
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]