corda / cordapp-template-kotlin

A Kotlin CorDapp Template. Extend it via the Hello, World tutorial: https://docs.corda.net/hello-world-introduction.html
118 stars 149 forks source link

Removed val prefix from rpcConnection field in NodeRPCConnection class #93

Closed ghost closed 3 months ago

ghost commented 1 year ago

I was getting the following WARN before my fix.

2023-06-15 14:59:01,682 WARN org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor [Thread-8] Destroy method on bean with name 'nodeRPCConnection' threw an exception: kotlin.UninitializedPropertyAccessException: lateinit property rpcConnection has not been initialized

What went wrong: The rpcConnection field of a NodeRPCConnection must be initialized in initialiseNodeRPCConnection(). However, rpcConnection is never initialized because rpcConnection is declared as val in initialiseNodeRPCConnection(). Therefore, executing close() above will result in the above WARN.