CORDA-249: Remove cyclic call from CompositeKey (#1602)

Remove cyclic call from `CompositeKey` cycle detection code. Previously when trying to report a cyclic graph in a `CompositeKey`, it called `toString()` which resulted in serialization of the graph, which of course was cyclic, so it failed.
This commit is contained in:
Ross Nicoll 2017-09-25 22:01:13 +01:00 committed by GitHub
parent 23f16b4b25
commit 7258c910c8

View File

@ -88,7 +88,9 @@ class CompositeKey private constructor(val threshold: Int, children: List<NodeAn
if (node is CompositeKey) {
val curVisitedMap = IdentityHashMap<CompositeKey, Boolean>()
curVisitedMap.putAll(visitedMap)
require(!curVisitedMap.contains(node)) { "Cycle detected for CompositeKey: $node" }
// We can't print the node details, because doing so involves serializing the node, which we can't
// do because of the cyclic graph.
require(!curVisitedMap.contains(node)) { "Cycle detected for CompositeKey" }
curVisitedMap.put(node, true)
node.cycleDetection(curVisitedMap)
}