On Nov 5, 2013, at 9:41 AM, ma...@apache.org wrote:

> Author: markt
> Date: Tue Nov  5 15:41:53 2013
> New Revision: 1539036
> 
> URL: http://svn.apache.org/r1539036
> Log:
> Fix remainder of failing tests and a related TODO spotted in the tests as 
> well.
> 
> <snip />
> 
> Modified: 
> tomcat/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderWeaving.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderWeaving.java?rev=1539036&r1=1539035&r2=1539036&view=diff
> ==============================================================================
> --- 
> tomcat/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderWeaving.java
>  (original)
> +++ 
> tomcat/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderWeaving.java
>  Tue Nov  5 15:41:53 2013
> @@ -251,6 +251,8 @@ public class TestWebappClassLoaderWeavin
>         assertEquals("The second result is not correct.", "Hello, Weaver 
> #2!", result);
> 
>         WebappClassLoader copiedLoader = 
> this.loader.copyWithoutTransformers();
> +        // class loader needs to be started to populate URLs
> +        copiedLoader.start();
> 
>         result = invokeDoMethodOnClass(copiedLoader, 
> "TesterNeverWeavedClass");
>         assertEquals("The third result is not correct.", "This will never be 
> weaved.", result);

copyWithoutTransformers(), as defined in the interface 
InstrumentableClassLoader, returns a ClassLoader. The start() method is not 
defined in ClassLoader, it is specific to WebappClassLoader. Furthermore, code 
calling copyWithoutTransformers() won't have access to WebappClassLoader to 
call start() reflectively if a SecurityManager is enabled.

So, the copyWithoutTransformers() method needs to call start() before it 
returns the copied class loader. Otherwise, it will be useless to JPA providers 
and the like.

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

Reply via email to