You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pp...@apache.org on 2022/08/31 15:21:54 UTC

[ignite] branch master updated: IGNITE-17499 Fixed propagation of service call exception stacktrace to the client side (#10186)

This is an automated email from the ASF dual-hosted git repository.

ppa 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 076ef80617a IGNITE-17499 Fixed propagation of service call exception stacktrace to the client side (#10186)
076ef80617a is described below

commit 076ef80617a87db5dcb87b3ae34e4eadfe8167fb
Author: Mikhail Petrov <32...@users.noreply.github.com>
AuthorDate: Wed Aug 31 18:21:45 2022 +0300

    IGNITE-17499 Fixed propagation of service call exception stacktrace to the client side (#10186)
---
 .../client/service/ClientServiceInvokeRequest.java |  2 +-
 .../Client/ClientConnectionTest.cs                 | 32 ++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/service/ClientServiceInvokeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/service/ClientServiceInvokeRequest.java
index 907f95af020..57aabbb0ef0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/service/ClientServiceInvokeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/service/ClientServiceInvokeRequest.java
@@ -195,7 +195,7 @@ public class ClientServiceInvokeRequest extends ClientRequest {
         catch (PlatformNativeException e) {
             ctx.kernalContext().log(getClass()).error("Failed to invoke platform service", e);
 
-            throw new IgniteException("Failed to invoke platform service, see server logs for details");
+            throw new IgniteException("Failed to invoke platform service, see server logs for details", e);
         }
         catch (Throwable e) {
             throw new IgniteException(e);
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 9d19fd881e5..6e5761a1db6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
@@ -36,6 +36,7 @@ namespace Apache.Ignite.Core.Tests.Client
     using Apache.Ignite.Core.Tests.Client.Cache;
     using Apache.Ignite.Core.Tests.Client.Compute;
     using Apache.Ignite.Core.Tests.Compute;
+    using Apache.Ignite.Core.Tests.Services;
     using NUnit.Framework;
 
     /// <summary>
@@ -954,6 +955,37 @@ namespace Apache.Ignite.Core.Tests.Client
             }
         }
 
+        /// <summary>
+        /// Tests that the stack trace of an exception that occurred during a service call is propagated to the thin
+        /// client side.
+        /// </summary>
+        [Test]
+        public void TestSendServerServiceExceptionStackTraceToClient()
+        {
+            var ignite = Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration())
+            {
+                ClientConnectorConfiguration = new ClientConnectorConfiguration
+                {
+                    ThinClientConfiguration = new ThinClientConfiguration
+                    {
+                        SendServerExceptionStackTraceToClient = true,
+                    }
+                }
+            });
+
+            const string svcName = "PlatformTestService";
+
+            ignite.GetServices().DeployClusterSingleton(svcName, new PlatformTestService());
+
+            using var client = StartClient();
+
+            var ex = Assert.Catch<Exception>(() =>
+                client.GetServices().GetServiceProxy<IJavaService>(svcName).testException("")).GetBaseException();
+            
+            StringAssert.Contains("ClassName=System.NotImplementedException", ex.Message);
+            StringAssert.Contains("Message=The method or operation is not implemented.", ex.Message);
+        }
+
         /// <summary>
         /// Tests that server exception stack trace is included in error details when enabled.
         /// </summary>