Uploaded image for project: 'Corda'
  1. CORDA-2782

Regression: java.lang.Comparable is not on the default whitelist but never has been

    Details

    • Type: Bug
    • Status: Done (View workflow)
    • Priority: Highest
    • Resolution: Done
    • Affects versions: Corda 4, Corda Enterprise 4 RC05
    • Fix versions: Corda 4.1
    • Components: None
    • Labels:
      None

      Description

      Vault queries that use the greaterThan predicate cannot be executed via CordaRPCOps since the underlying class is not on the default whitelist.

      val criterion = QueryCriteria.VaultCustomQueryCriteria(
              VaultSchemaV1.VaultLinearStates::uuid.greaterThan(UUID.fromString(lastTradeId))
      )
      
      client.ops.vaultQueryBy(
              criteria = criterion
      )
      

      Leads to the following exception:

      [ERROR] 15:22:38,466 [main] amqp.SerializationOutput.log - Serialization failed direction="Serialize", type="java.lang.Comparable<*>", msg="Class "java.lang.Comparable<*>" is not on the whitelist or annotated with @CordaSerializable.", ClassChain="java.util.List<*> -> b(net.corda.core.node.services.vault.QueryCriteria) -> expression(net.corda.core.node.services.vault.CriteriaExpression<net.corda.core.schemas.StatePersistable, java.lang.Boolean>) -> predicate(net.corda.core.node.services.vault.ColumnPredicate<*>) -> java.lang.Comparable<*>"
      
      net.corda.client.rpc.RPCException: Class "java.lang.Comparable<*>" is not on the whitelist or annotated with @CordaSerializable.
      
      	at net.corda.client.rpc.internal.RPCClientProxyHandler.invoke(RPCClientProxyHandler.kt:279)
      	at com.sun.proxy.$Proxy50.vaultQueryBy(Unknown Source)
      	at com.REDACTED.service.LedgerTradeService.findNextWithExternalId(LedgerTradeService.kt:203)
      	at com.REDACTED.service.SwapServiceWithExternalIdsTest$retrieve trades with pagination$1.invoke(SwapServiceWithExternalIdsTest.kt:188)
      	at com.REDACTED.service.SwapServiceWithExternalIdsTest$retrieve trades with pagination$1.invoke(SwapServiceWithExternalIdsTest.kt:28)
      	at com.REDACTED.service.SwapServiceWithExternalIdsTest.withAutoApproval(SwapServiceWithExternalIdsTest.kt:132)
      	at com.REDACTED.service.SwapServiceWithExternalIdsTest.retrieve trades with pagination(SwapServiceWithExternalIdsTest.kt:168)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
      	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
      	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
      	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
      Caused by: java.io.NotSerializableException: Class "java.lang.Comparable<*>" is not on the whitelist or annotated with @CordaSerializable.
      	at net.corda.serialization.internal.amqp.SerializationOutput.serialize(SerializationOutput.kt:54)
      	at net.corda.serialization.internal.amqp.AbstractAMQPSerializationScheme.serialize(AMQPSerializationScheme.kt:235)
      	at net.corda.serialization.internal.SerializationFactoryImpl$serialize$1$1.invoke(SerializationScheme.kt:117)
      	at net.corda.serialization.internal.SerializationFactoryImpl$serialize$1$1.invoke(SerializationScheme.kt:70)
      	at net.corda.core.serialization.SerializationFactory.withCurrentContext(SerializationAPI.kt:72)
      	at net.corda.serialization.internal.SerializationFactoryImpl$serialize$1.invoke(SerializationScheme.kt:117)
      	at net.corda.serialization.internal.SerializationFactoryImpl$serialize$1.invoke(SerializationScheme.kt:70)
      	at net.corda.core.serialization.SerializationFactory.asCurrent(SerializationAPI.kt:86)
      	at net.corda.serialization.internal.SerializationFactoryImpl.serialize(SerializationScheme.kt:117)
      	at net.corda.core.serialization.SerializationAPIKt.serialize(SerializationAPI.kt:311)
      	at net.corda.core.serialization.SerializationAPIKt.serialize$default(SerializationAPI.kt:310)
      	at net.corda.client.rpc.internal.RPCClientProxyHandler.invoke(RPCClientProxyHandler.kt:257)
      	... 30 more
      

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                Dominic.Fox Dominic.Fox@r3.com
                Reporter:
                Moritz.Platt Moritz Platt
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: