-
1. Re: Retain ProtectionDomain for instrumented classes
starksm64 May 10, 2005 7:58 AM (in response to twundke)File a bug report as we cannot be throwing away the protection domain.
http://jira.jboss.com/jira/browse/JBAOP -
2. Re: Retain ProtectionDomain for instrumented classes
bill.burke May 10, 2005 8:16 AM (in response to twundke)This is not true. The ClassLoader creates the class and it has the ProtectionDomain. A special ProtectionDomain is created for dynamically created classes though.
-
3. Re: Retain ProtectionDomain for instrumented classes
starksm64 May 10, 2005 8:41 AM (in response to twundke)Give a concrete example that illustrates where the PD is getting lost then Tim.
-
4. Re: Retain ProtectionDomain for instrumented classes
twundke May 11, 2005 4:09 AM (in response to twundke)Sorry I wasn't clearer in my original post. It's been a while since I looked at this issue.
My particular problem is that the generated field wrapper inner classes don't get assigned the correct protection domain. Here's a stack trace that shows the problem occuring.getDefaultDomain():1583, ClassLoader.java preDefineClass():483, ClassLoader.java defineClass():614, ClassLoader.java defineClass():465, ClassLoader.java invoke0():-1, NativeMethodAccessorImpl.java invoke():39, NativeMethodAccessorImpl.java invoke():25, DelegatingMethodAccessorImpl.java invoke():585, Method.java toClass():52, StandaloneClassPool.java toClass():962, CtClass.java compileOrLoadClass():119, TransformerCommon.java createOptimizedInvocationClass():572, FieldAccessTransformer.java buildOptimizedReadWrapper():358, FieldAccessTransformer.java buildOptimizedWrappers():342, FieldAccessTransformer.java buildFieldWrappers():232, FieldAccessTransformer.java buildFieldWrappers():65, FieldAccessTransformer.java transform():592, Instrumentor.java translate():572, AspectManager.java transform():490, AspectManager.java aspectTransform():100, AopAgent.java transform():141, AopAgent.java transform():122, TransformerManager.java transform():155, InstrumentationImpl.java defineClass1():-1, ClassLoader.java defineClass():620, ClassLoader.java defineClass():320, BaseURLClassLoader.java access$000():38, BaseURLClassLoader.java run():108, BaseURLClassLoader.java run():98, BaseURLClassLoader.java doPrivileged():-1, AccessController.java findClass():96, BaseURLClassLoader.java findClassInternal():168, BaseClassLoader.java findClassInternal():146, BaseClassLoader.java findClassInternal():49, FrameworkClassLoader.java loadClass():280, BaseClassLoader.java loadClass():251, ClassLoader.java loadClassInternal():319, ClassLoader.java initialiseDomains():117, DomainManagerImpl.java <init>():78, DomainManagerImpl.java start():153, FrameworkController.java invoke0():-1, NativeMethodAccessorImpl.java invoke():39, NativeMethodAccessorImpl.java invoke():25, DelegatingMethodAccessorImpl.java invoke():585, Method.java initialiseFramework():366, FrameworkLoader.java main():463, FrameworkLoader.java
The toClass method of StandaloneClassPool does the following:Class cl = Class.forName("java.lang.ClassLoader"); java.lang.reflect.Method method = cl.getDeclaredMethod("defineClass", new Class[]{String.class, byte[].class, int.class, int.class});
My classloader doesn't get a chance to define the class, causing the field wrappers to be assigned a default protection domain.
So, what's actually needed is for the class pool to use the correct classloader when calling defineClass.
Hope that helps.
Tim. -
5. Re: Retain ProtectionDomain for instrumented classes
starksm64 May 11, 2005 9:43 AM (in response to twundke)The following issue has been created to validate or reject this:
http://jira.jboss.com/jira/browse/JBAOP-126 -
6. Re: Retain ProtectionDomain for instrumented classes
twundke May 11, 2005 10:25 PM (in response to twundke)Thanks Scott. I'm happy to help with the implementation of the fix if needed.
Tim.