Use Uint32.saturatedOf() 17/105117/1
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 31 Mar 2023 14:39:13 +0000 (16:39 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 31 Mar 2023 14:41:11 +0000 (16:41 +0200)
commitea0c792364c98451ded28448d30a2905569e788e
tree17a0c86d7f12f6c4381b3f59cb0914824211aecd
parenta5a311b52cdf5cbe9bce5f0dff057cb3e7e71ea6
Use Uint32.saturatedOf()

We are receiving a splat when the sum ends up being negative. While the
underlying cause needs to be investigated, we also should be properly
defensive. Uint32.saturatedOf() catches negative values and squashes
them to 0.

JIRA: BGPCEP-1021
Change-Id: Ia376305aa677ebd05a41629c5083f8829891615f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit cc71ea45a8e373d50b063a61966245c5e90d4aa8)
bgp/openconfig-state/src/main/java/org/opendaylight/protocol/bgp/state/PeerGroupUtil.java