Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-4089

CacheAuthorizationTest fails intermitently due to ClassCastException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 7.0.0.Alpha1
    • Test Suite
    • None

      java.security.PrivilegedActionException: java.lang.Exception: Unexpected non-SecurityException
          at java.security.AccessController.doPrivileged(Native Method)
          at javax.security.auth.Subject.doAs(Subject.java:396)
          at org.infinispan.security.CacheAuthorizationTest.testAllCombinations(CacheAuthorizationTest.java:128)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
          at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
          at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
          at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
          at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
          at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
          at org.testng.TestRunner.privateRun(TestRunner.java:767)
          at org.testng.TestRunner.run(TestRunner.java:617)
          at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
          at org.testng.SuiteRunner.access$000(SuiteRunner.java:37)
          at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:368)
          at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
          at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
          at java.util.concurrent.FutureTask.run(FutureTask.java:138)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
          at java.lang.Thread.run(Thread.java:662)
      Caused by: java.lang.Exception: Unexpected non-SecurityException
          at org.infinispan.security.CacheAuthorizationTest$4.run(CacheAuthorizationTest.java:148)
          at org.infinispan.security.CacheAuthorizationTest$4.run(CacheAuthorizationTest.java:128)
          ... 24 more
      Caused by: java.lang.reflect.InvocationTargetException
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.infinispan.security.CacheAuthorizationTest$4.run(CacheAuthorizationTest.java:133)
          ... 25 more
      Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to org.infinispan.atomic.DeltaAware
          at org.infinispan.container.EntryFactoryImpl.wrapEntryForDelta(EntryFactoryImpl.java:222)
          at org.infinispan.interceptors.EntryWrappingInterceptor.visitApplyDeltaCommand(EntryWrappingInterceptor.java:215)
          at org.infinispan.commands.write.ApplyDeltaCommand.acceptVisitor(ApplyDeltaCommand.java:86)
          at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
          at org.infinispan.interceptors.locking.PessimisticLockingInterceptor.visitApplyDeltaCommand(PessimisticLockingInterceptor.java:165)
          at org.infinispan.commands.write.ApplyDeltaCommand.acceptVisitor(ApplyDeltaCommand.java:86)
          at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
          at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:112)
          at org.infinispan.commands.AbstractVisitor.visitApplyDeltaCommand(AbstractVisitor.java:62)
          at org.infinispan.commands.write.ApplyDeltaCommand.acceptVisitor(ApplyDeltaCommand.java:86)
          at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
          at org.infinispan.interceptors.TxInterceptor.enlistWriteAndInvokeNext(TxInterceptor.java:245)
          at org.infinispan.interceptors.TxInterceptor.visitApplyDeltaCommand(TxInterceptor.java:185)
          at org.infinispan.commands.write.ApplyDeltaCommand.acceptVisitor(ApplyDeltaCommand.java:86)
          at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
          at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:112)
          at org.infinispan.commands.AbstractVisitor.visitApplyDeltaCommand(AbstractVisitor.java:62)
          at org.infinispan.commands.write.ApplyDeltaCommand.acceptVisitor(ApplyDeltaCommand.java:86)
          at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
          at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:110)
          at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:73)
          at org.infinispan.commands.AbstractVisitor.visitApplyDeltaCommand(AbstractVisitor.java:62)
          at org.infinispan.commands.write.ApplyDeltaCommand.acceptVisitor(ApplyDeltaCommand.java:86)
          at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
          at org.infinispan.interceptors.BatchingInterceptor.handleDefault(BatchingInterceptor.java:66)
          at org.infinispan.commands.AbstractVisitor.visitApplyDeltaCommand(AbstractVisitor.java:62)
          at org.infinispan.commands.write.ApplyDeltaCommand.acceptVisitor(ApplyDeltaCommand.java:86)
          at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:333)
          at org.infinispan.CacheImpl.applyDelta(CacheImpl.java:678)
          at org.infinispan.security.impl.SecureCacheImpl.applyDelta(SecureCacheImpl.java:378)
          at org.infinispan.security.SecureCacheTestDriver.testApplyDelta_Object_Delta_ObjectArray(SecureCacheTestDriver.java:448)
          ... 30 more
      

      This is caused due to the fact that the test currently runs each of the methods in a non deterministic order due to being put into a HashSet. If the delta test is ran after a test that would have resulted in the cache having a String value in it it, it will get a ClassCastException.

      The easiest fix is probably just to change the key.

              mircea.markus Mircea Markus (Inactive)
              wburns@redhat.com Will Burns
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: