Author: almaw
Date: Fri Jun  8 07:40:09 2007
New Revision: 545525

URL: http://svn.apache.org/viewvc?view=rev&rev=545525
Log:
WICKET-628 - Don't try to set the classloader if it hasn't changed - avoid 
security exceptions.

Modified:
    
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java

Modified: 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java?view=diff&rev=545525&r1=545524&r2=545525
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
 (original)
+++ 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
 Fri Jun  8 07:40:09 2007
@@ -173,9 +173,13 @@
                }
 
                final ClassLoader previousClassLoader = 
Thread.currentThread().getContextClassLoader();
+               final ClassLoader newClassLoader = getClassLoader();
                try
                {
-                       
Thread.currentThread().setContextClassLoader(getClassLoader());
+                       if (previousClassLoader != newClassLoader)
+                       {
+                               
Thread.currentThread().setContextClassLoader(newClassLoader);
+                       }
 
                        // If the request does not provide information about 
the encoding of
                        // its body (which includes POST parameters), than 
assume the
@@ -269,7 +273,10 @@
                }
                finally
                {
-                       
Thread.currentThread().setContextClassLoader(previousClassLoader);
+                       if (newClassLoader != previousClassLoader)
+                       {
+                               
Thread.currentThread().setContextClassLoader(previousClassLoader);
+                       }
                }
        }
 


Reply via email to