This is an automated email from the ASF dual-hosted git repository.
ptupitsyn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 75036d2 IGNITE-14776 .NET: Fix NRE in ClientFailoverSocket due to
late logger setter (#9499)
75036d2 is described below
commit 75036d28ebce294ba2aad68d3495e179ccb7409a
Author: Pavel Tupitsyn <[email protected]>
AuthorDate: Mon Oct 18 22:30:08 2021 +0300
IGNITE-14776 .NET: Fix NRE in ClientFailoverSocket due to late logger
setter (#9499)
---
.../Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs | 11 +++++++++++
.../Apache.Ignite.Core/Impl/Client/ClientFailoverSocket.cs | 3 +--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git
a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
index fe7f88b..457d261 100644
---
a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
+++
b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
@@ -286,6 +286,17 @@ namespace Apache.Ignite.Core.Tests.Client
}
/// <summary>
+ /// Tests that invalid protocol causes a socket exception.
+ /// </summary>
+ [Test]
+ public void TestInvalidProtocolThrowsSocketException()
+ {
+ var cfg = new
IgniteClientConfiguration("bad_proto://foo.bar:12345");
+
+ Assert.Catch<SocketException>(() => Ignition.StartClient(cfg));
+ }
+
+ /// <summary>
/// Tests that default configuration throws.
/// </summary>
[Test]
diff --git
a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientFailoverSocket.cs
b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientFailoverSocket.cs
index 4fb9e11..d23bd72 100644
---
a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientFailoverSocket.cs
+++
b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientFailoverSocket.cs
@@ -114,6 +114,7 @@ namespace Apache.Ignite.Core.Impl.Client
_config = config;
_marsh = marsh;
_transactions = transactions;
+ _logger = (_config.Logger ??
NoopLogger.Instance).GetLogger(GetType());
#pragma warning disable 618 // Type or member is obsolete
if (config.Host == null && (config.Endpoints == null ||
config.Endpoints.Count == 0))
@@ -130,8 +131,6 @@ namespace Apache.Ignite.Core.Impl.Client
throw new IgniteClientException("Failed to resolve all
specified hosts.");
}
- _logger = (_config.Logger ??
NoopLogger.Instance).GetLogger(GetType());
-
ConnectDefaultSocket();
OnFirstConnection();
}