Fix NoSuchElementException in toString() 24/90724/2
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 26 Jun 2020 10:33:43 +0000 (12:33 +0200)
committerRobert Varga <nite@hq.sk>
Fri, 26 Jun 2020 11:40:00 +0000 (11:40 +0000)
Original patch missed the fact that an empty set will throw, fix
that up.

Change-Id: I2d0588ec0499475935d285b3be6db299a9d4d525
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/UnsignedLongRangeSet.java

index b8c2fcc..9ea92d0 100644 (file)
@@ -69,7 +69,8 @@ public final class UnsignedLongRangeSet implements Mutable {
     @Override
     public String toString() {
         return MoreObjects.toStringHelper(this)
-                .add("span", rangeset.span())
+                .omitNullValues()
+                .add("span", rangeset.isEmpty() ? null : rangeset.span())
                 .add("rangeSize", rangeset.asRanges().size())
                 .toString();
     }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.