From 6e89f42bc8e7dd2b4effb130efc9f29a63ee3073 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Wed, 12 Jun 2024 15:22:39 +0000 Subject: [PATCH] cleanup: Modernize PubSubRoute code, json parsing --- .../PubSub/Client/Routing/PubSubRouter.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/DataStreamSuite/PubSub/Client/Routing/PubSubRouter.cs b/src/DataStreamSuite/PubSub/Client/Routing/PubSubRouter.cs index a53f589df..0304c1411 100644 --- a/src/DataStreamSuite/PubSub/Client/Routing/PubSubRouter.cs +++ b/src/DataStreamSuite/PubSub/Client/Routing/PubSubRouter.cs @@ -48,6 +48,7 @@ namespace BCG { throw new ArgumentException($"Failed to find route for tag '{tag}'", nameof(tag)); } Log.Gen.info($"PubSubRouter.get_sub_url_for_tag tag: {tag} route: {route}"); + ArgumentNullException.ThrowIfNull(route.ServerAddress); return RemoteConnectionInfo.parse_url(route.ServerAddress); } @@ -56,17 +57,18 @@ namespace BCG { throw new ArgumentException($"Failed to find route for tag '{tag}'", nameof(tag)); } Log.Gen.info($"PubSubRouter.get_sub_url_for_tag tag: {tag} route: {route}"); + ArgumentNullException.ThrowIfNull(route.ServerAddress); return RemoteConnectionInfo.parse_url(route.ServerAddress); } public List get_all_pubsub_sub_urls() => - _sub_routes.Select(r => r.ServerAddress).ToList(); + _sub_routes.Select(r => r.ServerAddress ?? throw new InvalidOperationException("Route.ServerAddress is null")).ToList(); public List get_all_pubsub_pub_urlss() => - _pub_routes.Select(r => r.ServerAddress).ToList(); + _pub_routes.Select(r => r.ServerAddress ?? throw new InvalidOperationException("Route.ServerAddress is null")).ToList(); - public event PubSubTagURLChangeDelegate onSubURLTagRouteChange; - public event PubSubTagURLChangeDelegate onPubURLTagRouteChange; + public event PubSubTagURLChangeDelegate? onSubURLTagRouteChange; + public event PubSubTagURLChangeDelegate? onPubURLTagRouteChange; #endregion @@ -77,7 +79,5 @@ namespace BCG { aVar = aVar + 2; } } - - } }