diff --git a/core/src/main/java/org/springframework/security/access/intercept/aopalliance/MethodSecurityMetadataSourceAdvisor.java b/core/src/main/java/org/springframework/security/access/intercept/aopalliance/MethodSecurityMetadataSourceAdvisor.java index 819340dba5..7399bd01b8 100644 --- a/core/src/main/java/org/springframework/security/access/intercept/aopalliance/MethodSecurityMetadataSourceAdvisor.java +++ b/core/src/main/java/org/springframework/security/access/intercept/aopalliance/MethodSecurityMetadataSourceAdvisor.java @@ -18,11 +18,9 @@ package org.springframework.security.access.intercept.aopalliance; import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; -import java.lang.reflect.AccessibleObject; import java.lang.reflect.Method; import org.aopalliance.aop.Advice; -import org.aopalliance.intercept.MethodInvocation; import org.springframework.aop.Pointcut; import org.springframework.aop.support.AbstractPointcutAdvisor; import org.springframework.aop.support.StaticMethodMatcherPointcut; @@ -129,44 +127,4 @@ public class MethodSecurityMetadataSourceAdvisor extends AbstractPointcutAdvisor return attributeSource.getAttributes(m, targetClass) != null; } } - - /** - * Represents a MethodInvocation. - *

- * Required as MethodSecurityMetadataSource only supports lookup of configuration attributes for - * MethodInvocations. - */ - class InternalMethodInvocation implements MethodInvocation { - private Method method; - private Class targetClass; - - public InternalMethodInvocation(Method method, Class targetClass) { - this.method = method; - this.targetClass = targetClass; - } - - protected InternalMethodInvocation() { - throw new UnsupportedOperationException(); - } - - public Object[] getArguments() { - throw new UnsupportedOperationException(); - } - - public Method getMethod() { - return this.method; - } - - public AccessibleObject getStaticPart() { - throw new UnsupportedOperationException(); - } - - public Object getThis() { - return this.targetClass; - } - - public Object proceed() throws Throwable { - throw new UnsupportedOperationException(); - } - } } diff --git a/core/src/test/java/org/springframework/security/access/intercept/aopalliance/MethodSecurityMetadataSourceAdvisorTests.java b/core/src/test/java/org/springframework/security/access/intercept/aopalliance/MethodSecurityMetadataSourceAdvisorTests.java index 8d2d54f3d3..c7bd4cd35a 100644 --- a/core/src/test/java/org/springframework/security/access/intercept/aopalliance/MethodSecurityMetadataSourceAdvisorTests.java +++ b/core/src/test/java/org/springframework/security/access/intercept/aopalliance/MethodSecurityMetadataSourceAdvisorTests.java @@ -74,39 +74,4 @@ public class MethodSecurityMetadataSourceAdvisorTests extends TestCase { assertTrue(true); } } - - public void testUnsupportedOperations() throws Throwable { - Class clazz = TargetObject.class; - Method method = clazz.getMethod("countLength", new Class[] {String.class}); - - MethodSecurityMetadataSourceAdvisor.InternalMethodInvocation imi = new MethodSecurityMetadataSourceAdvisor(getInterceptor()).new InternalMethodInvocation(method, clazz); - - try { - imi.getArguments(); - fail("Should have thrown UnsupportedOperationException"); - } catch (UnsupportedOperationException expected) { - assertTrue(true); - } - - try { - imi.getStaticPart(); - fail("Should have thrown UnsupportedOperationException"); - } catch (UnsupportedOperationException expected) { - assertTrue(true); - } - - try { - imi.proceed(); - fail("Should have thrown UnsupportedOperationException"); - } catch (UnsupportedOperationException expected) { - assertTrue(true); - } - - try { - new MethodSecurityMetadataSourceAdvisor(getInterceptor()).new InternalMethodInvocation(); - fail("Should have thrown UnsupportedOperationException"); - } catch (UnsupportedOperationException expected) { - assertTrue(true); - } - } }