Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.3-incubating
-
None
Description
org.apache.deltaspike.security.impl.extension.Authorizer invokes a java method on org.apache.deltaspike.security.impl.authorization.SecuredAnnotationAuthorizer using reflection (line 122). It uses org.apache.deltaspike.core.util.metadata.builder.InjectableMethod to do that.
If the target method throws an exception, the reflection API wraps the original exception within InvocationTargetException. The problem is that DeltaSpike reflection utilities nor the security module unwraps the exception. As a result, the unwrapped InvocationTargetException is thrown out of SecurityInterceptor.
Finally, org.apache.deltaspike.test.security.impl.authorization.secured.SecuredAnnotationTest expects to receive AccessDeniedException. The test fails because it receives AccessDeniedException wrapped within InvocationTargetException.
See https://issues.jboss.org/browse/WELD-1270 for more details.
The relevant stack trace:
10:17:36,846 ERROR [stderr] (pool-3-thread-13) java.lang.reflect.InvocationTargetException
10:17:36,847 ERROR [stderr] (pool-3-thread-13) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10:17:36,847 ERROR [stderr] (pool-3-thread-13) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
10:17:36,848 ERROR [stderr] (pool-3-thread-13) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
10:17:36,848 ERROR [stderr] (pool-3-thread-13) at java.lang.reflect.Method.invoke(Method.java:601)
10:17:36,848 ERROR [stderr] (pool-3-thread-13) at org.apache.deltaspike.core.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:188)
10:17:36,848 ERROR [stderr] (pool-3-thread-13) at org.apache.deltaspike.core.util.metadata.builder.InjectableMethod.invoke(InjectableMethod.java:187)
10:17:36,849 ERROR [stderr] (pool-3-thread-13) at org.apache.deltaspike.security.impl.extension.Authorizer.authorize(Authorizer.java:122)
10:17:36,849 ERROR [stderr] (pool-3-thread-13) at org.apache.deltaspike.security.impl.extension.DefaultSecurityStrategy.execute(DefaultSecurityStrategy.java:56)
10:17:36,849 ERROR [stderr] (pool-3-thread-13) at org.apache.deltaspike.security.impl.extension.SecurityInterceptor.filterDeniedInvocations(SecurityInterceptor.java:44)
10:17:36,849 ERROR [stderr] (pool-3-thread-13) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10:17:36,850 ERROR [stderr] (pool-3-thread-13) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
10:17:36,850 ERROR [stderr] (pool-3-thread-13) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
10:17:36,850 ERROR [stderr] (pool-3-thread-13) at java.lang.reflect.Method.invoke(Method.java:601)
10:17:36,851 ERROR [stderr] (pool-3-thread-13) at org.jboss.weld.interceptor.proxy.SimpleMethodInvocation.invoke(SimpleMethodInvocation.java:30)
10:17:36,851 ERROR [stderr] (pool-3-thread-13) at org.jboss.weld.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:69)
10:17:36,851 ERROR [stderr] (pool-3-thread-13) at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:113)
10:17:36,852 ERROR [stderr] (pool-3-thread-13) at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:92)
10:17:36,852 ERROR [stderr] (pool-3-thread-13) at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:52)
10:17:36,852 ERROR [stderr] (pool-3-thread-13) at org.apache.deltaspike.test.security.impl.authorization.secured.SecuredBean1$Proxy$_$$_WeldSubclass.getBlockedResult(Unknown Source)
10:17:36,853 ERROR [stderr] (pool-3-thread-13) at org.apache.deltaspike.test.security.impl.authorization.secured.SecuredBean1$Proxy$_$$_WeldClientProxy.getBlockedResult(Unknown Source)
10:17:36,853 ERROR [stderr] (pool-3-thread-13) at org.apache.deltaspike.test.security.impl.authorization.secured.SecuredAnnotationTest.simpleInterceptorTest(SecuredAnnotationTest.java:58)
10:17:36,853 ERROR [stderr] (pool-3-thread-13) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10:17:36,854 ERROR [stderr] (pool-3-thread-13) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
10:17:36,854 ERROR [stderr] (pool-3-thread-13) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
10:17:36,854 ERROR [stderr] (pool-3-thread-13) at java.lang.reflect.Method.invoke(Method.java:601)
10:17:36,855 ERROR [stderr] (pool-3-thread-13) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
10:17:36,855 ERROR [stderr] (pool-3-thread-13) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
10:17:36,855 ERROR [stderr] (pool-3-thread-13) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
10:17:36,855 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:270)
10:17:36,855 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60)
10:17:36,856 ERROR [stderr] (pool-3-thread-13) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10:17:36,856 ERROR [stderr] (pool-3-thread-13) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
10:17:36,856 ERROR [stderr] (pool-3-thread-13) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
10:17:36,856 ERROR [stderr] (pool-3-thread-13) at java.lang.reflect.Method.invoke(Method.java:601)
10:17:36,856 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
10:17:36,857 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
10:17:36,857 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
10:17:36,857 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
10:17:36,857 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
10:17:36,857 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
10:17:36,858 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.container.test.impl.execution.ContainerTestExecuter.execute(ContainerTestExecuter.java:38)
10:17:36,858 ERROR [stderr] (pool-3-thread-13) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10:17:36,858 ERROR [stderr] (pool-3-thread-13) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
10:17:36,858 ERROR [stderr] (pool-3-thread-13) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
10:17:36,858 ERROR [stderr] (pool-3-thread-13) at java.lang.reflect.Method.invoke(Method.java:601)
10:17:36,859 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
10:17:36,859 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
10:17:36,859 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
10:17:36,859 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:89)
10:17:36,859 ERROR [stderr] (pool-3-thread-13) at sun.reflect.GeneratedMethodAccessor106.invoke(Unknown Source)
10:17:36,859 ERROR [stderr] (pool-3-thread-13) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
10:17:36,860 ERROR [stderr] (pool-3-thread-13) at java.lang.reflect.Method.invoke(Method.java:601)
10:17:36,860 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
10:17:36,861 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
10:17:36,861 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)
10:17:36,861 ERROR [stderr] (pool-3-thread-13) at sun.reflect.GeneratedMethodAccessor105.invoke(Unknown Source)
10:17:36,862 ERROR [stderr] (pool-3-thread-13) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
10:17:36,862 ERROR [stderr] (pool-3-thread-13) at java.lang.reflect.Method.invoke(Method.java:601)
10:17:36,863 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
10:17:36,863 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
10:17:36,864 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)
10:17:36,864 ERROR [stderr] (pool-3-thread-13) at sun.reflect.GeneratedMethodAccessor104.invoke(Unknown Source)
10:17:36,864 ERROR [stderr] (pool-3-thread-13) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
10:17:36,864 ERROR [stderr] (pool-3-thread-13) at java.lang.reflect.Method.invoke(Method.java:601)
10:17:36,864 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
10:17:36,865 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
10:17:36,865 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
10:17:36,865 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111)
10:17:36,865 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:263)
10:17:36,865 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:226)
10:17:36,866 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
10:17:36,866 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
10:17:36,866 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:240)
10:17:36,866 ERROR [stderr] (pool-3-thread-13) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
10:17:36,866 ERROR [stderr] (pool-3-thread-13) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
10:17:36,867 ERROR [stderr] (pool-3-thread-13) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
10:17:36,867 ERROR [stderr] (pool-3-thread-13) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
10:17:36,867 ERROR [stderr] (pool-3-thread-13) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
10:17:36,867 ERROR [stderr] (pool-3-thread-13) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
10:17:36,867 ERROR [stderr] (pool-3-thread-13) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
10:17:36,868 ERROR [stderr] (pool-3-thread-13) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
10:17:36,868 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:185)
10:17:36,868 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
10:17:36,868 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
10:17:36,868 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)
10:17:36,869 ERROR [stderr] (pool-3-thread-13) at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
10:17:36,869 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)
10:17:36,869 ERROR [stderr] (pool-3-thread-13) at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
10:17:36,869 ERROR [stderr] (pool-3-thread-13) at org.junit.runner.JUnitCore.run(JUnitCore.java:136)
10:17:36,869 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:65)
10:17:36,870 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethodInternal(JMXTestRunner.java:129)
10:17:36,870 ERROR [stderr] (pool-3-thread-13) at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethod(JMXTestRunner.java:108)
10:17:36,870 ERROR [stderr] (pool-3-thread-13) at org.jboss.as.arquillian.service.ArquillianService$ExtendedJMXTestRunner.runTestMethod(ArquillianService.java:226)
10:17:36,870 ERROR [stderr] (pool-3-thread-13) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10:17:36,870 ERROR [stderr] (pool-3-thread-13) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
10:17:36,870 ERROR [stderr] (pool-3-thread-13) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
10:17:36,871 ERROR [stderr] (pool-3-thread-13) at java.lang.reflect.Method.invoke(Method.java:601)
10:17:36,871 ERROR [stderr] (pool-3-thread-13) at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:111)
10:17:36,871 ERROR [stderr] (pool-3-thread-13) at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:45)
10:17:36,872 ERROR [stderr] (pool-3-thread-13) at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:235)
10:17:36,872 ERROR [stderr] (pool-3-thread-13) at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:138)
10:17:36,872 ERROR [stderr] (pool-3-thread-13) at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:250)
10:17:36,872 ERROR [stderr] (pool-3-thread-13) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
10:17:36,872 ERROR [stderr] (pool-3-thread-13) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:791)
10:17:36,873 ERROR [stderr] (pool-3-thread-13) at org.jboss.as.jmx.PluggableMBeanServerImpl$TcclMBeanServer.invoke(PluggableMBeanServerImpl.java:498)
10:17:36,873 ERROR [stderr] (pool-3-thread-13) at org.jboss.as.jmx.PluggableMBeanServerImpl.invoke(PluggableMBeanServerImpl.java:246)
10:17:36,873 ERROR [stderr] (pool-3-thread-13) at org.jboss.remotingjmx.protocol.v1.ServerProxy$InvokeHandler.handle(ServerProxy.java:1034)
10:17:36,873 ERROR [stderr] (pool-3-thread-13) at org.jboss.remotingjmx.protocol.v1.ServerProxy$MessageReciever$1.run(ServerProxy.java:215)
10:17:36,873 ERROR [stderr] (pool-3-thread-13) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
10:17:36,874 ERROR [stderr] (pool-3-thread-13) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
10:17:36,874 ERROR [stderr] (pool-3-thread-13) at java.lang.Thread.run(Thread.java:722)
10:17:36,874 ERROR [stderr] (pool-3-thread-13) Caused by: org.apache.deltaspike.security.api.authorization.AccessDeniedException
10:17:36,875 ERROR [stderr] (pool-3-thread-13) at org.apache.deltaspike.security.impl.authorization.SecuredAnnotationAuthorizer.invokeVoters(SecuredAnnotationAuthorizer.java:139)
10:17:36,875 ERROR [stderr] (pool-3-thread-13) at org.apache.deltaspike.security.impl.authorization.SecuredAnnotationAuthorizer.doSecuredCheck(SecuredAnnotationAuthorizer.java:77)
10:17:36,875 ERROR [stderr] (pool-3-thread-13) ... 111 more