SEC-1295: Placing Security on Roo Aspected method fails. Added suggested fix - check for null target and use Signature.declaredType instead.

This commit is contained in:
Luke Taylor 2009-11-30 22:00:49 +00:00
parent 7e0c7ffc0e
commit 8a0f69b955
1 changed files with 8 additions and 1 deletions

View File

@ -55,7 +55,14 @@ public abstract class AbstractMethodSecurityMetadataSource implements MethodSecu
if (object instanceof JoinPoint) {
JoinPoint jp = (JoinPoint) object;
Class<?> targetClass = jp.getTarget().getClass();
Class<?> targetClass;
if (jp.getTarget() != null) {
targetClass = jp.getTarget().getClass();
} else {
// SEC-1295: target may be null if an ITD is in use
targetClass = jp.getSignature().getDeclaringType();
}
String targetMethodName = jp.getStaticPart().getSignature().getName();
Class<?>[] types = ((CodeSignature) jp.getStaticPart().getSignature()).getParameterTypes();
Class<?> declaringType = ((CodeSignature) jp.getStaticPart().getSignature()).getDeclaringType();