[Jboss-cvs] JBossAS SVN: r56780 - trunk/aop/src/main/org/jboss/aop
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Sep 12 15:41:54 EDT 2006
Author: kabir.khan at jboss.com
Date: 2006-09-12 15:41:43 -0400 (Tue, 12 Sep 2006)
New Revision: 56780
Modified:
trunk/aop/src/main/org/jboss/aop/FieldInfo.java
Log:
Fix broken regression test
Modified: trunk/aop/src/main/org/jboss/aop/FieldInfo.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/FieldInfo.java 2006-09-12 18:32:06 UTC (rev 56779)
+++ trunk/aop/src/main/org/jboss/aop/FieldInfo.java 2006-09-12 19:41:43 UTC (rev 56780)
@@ -59,8 +59,8 @@
{
this.index = index;
this.advisedField = (System.getSecurityManager() == null) ?
- GetDeclaredFieldAction.NON_PRIVILEGED.get(clazz, fieldName) :
- GetDeclaredFieldAction.PRIVILEGED.get(clazz, fieldName);
+ GetDeclaredFieldAction.NON_PRIVILEGED.get(this, clazz, fieldName) :
+ GetDeclaredFieldAction.PRIVILEGED.get(this, clazz, fieldName);
this.wrapper = MethodHashing.findMethodByHash(clazz, wrapperHash);
this.setAdvisor(advisor);
this.read = read;
@@ -143,13 +143,38 @@
return read;
}
+ private Field doGet(Class clazz, String name)throws NoSuchFieldException
+ {
+ Field field = null;
+ Class superClass = clazz;
+ while (superClass != null)
+ {
+ try
+ {
+ field = superClass.getDeclaredField(name);
+ break;
+ }
+ catch (NoSuchFieldException e)
+ {
+ }
+ //Check super class
+ superClass = superClass.getSuperclass();
+ }
+
+ if (field == null)
+ {
+ throw new NoSuchFieldException("Cannot find field in " + clazz.getName() + " or any of its superclasses");
+ }
+ return field;
+ }
+
interface GetDeclaredFieldAction
{
- Field get(Class clazz, String name) throws NoSuchFieldException;
+ Field get(FieldInfo target, Class clazz, String name) throws NoSuchFieldException;
GetDeclaredFieldAction PRIVILEGED = new GetDeclaredFieldAction()
{
- public Field get(final Class clazz, final String name) throws NoSuchFieldException
+ public Field get(final FieldInfo target, final Class clazz, final String name) throws NoSuchFieldException
{
try
{
@@ -157,7 +182,7 @@
{
public Object run() throws Exception
{
- return clazz.getDeclaredField(name);
+ return target.doGet(clazz, name);//clazz.getDeclaredField(name);
}
});
}
@@ -175,9 +200,9 @@
GetDeclaredFieldAction NON_PRIVILEGED = new GetDeclaredFieldAction()
{
- public Field get(Class clazz, String name) throws NoSuchFieldException
+ public Field get(FieldInfo target, Class clazz, String name) throws NoSuchFieldException
{
- return clazz.getDeclaredField(name);
+ return target.doGet(clazz, name);//clazz.getDeclaredField(name);
}
};
}
More information about the jboss-cvs-commits
mailing list