mirror of
https://github.com/corda/corda.git
synced 2024-12-19 04:57:58 +00:00
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:
parent
23f16b4b25
commit
7258c910c8
@ -88,7 +88,9 @@ class CompositeKey private constructor(val threshold: Int, children: List<NodeAn
|
|||||||
if (node is CompositeKey) {
|
if (node is CompositeKey) {
|
||||||
val curVisitedMap = IdentityHashMap<CompositeKey, Boolean>()
|
val curVisitedMap = IdentityHashMap<CompositeKey, Boolean>()
|
||||||
curVisitedMap.putAll(visitedMap)
|
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)
|
curVisitedMap.put(node, true)
|
||||||
node.cycleDetection(curVisitedMap)
|
node.cycleDetection(curVisitedMap)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user