ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject ignite git commit: IGNITE-8971 Make GridRestProcessor propagate error message - Fixes #4604.
Date Fri, 24 Aug 2018 15:18:02 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 07847bea6 -> a4e144cc3


IGNITE-8971 Make GridRestProcessor propagate error message - Fixes #4604.

Signed-off-by: Alexey Goncharuk <alexey.goncharuk@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a4e144cc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a4e144cc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a4e144cc

Branch: refs/heads/master
Commit: a4e144cc3616f2430843934cf844b4ac29841ba0
Parents: 07847be
Author: AMedvedev <andrew.y.medvedev>
Authored: Fri Aug 24 18:15:05 2018 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Fri Aug 24 18:17:33 2018 +0300

----------------------------------------------------------------------
 .../JettyRestProcessorAbstractSelfTest.java     |  2 +-
 .../processors/rest/GridRestProcessor.java      | 23 +++++++++++++++++++-
 2 files changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a4e144cc/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
index 8bfef10..f39c280 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
@@ -688,7 +688,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
         String ret = content(DEFAULT_CACHE_NAME, GridRestCommand.CACHE_PUT, "key", "key0");
 
         assertResponseContainsError(ret,
-            "Failed to handle request: [req=CACHE_PUT, err=Failed to find mandatory parameter
in request: val]");
+            "Failed to find mandatory parameter in request: val");
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/a4e144cc/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
index d7a30f9..ccb92df 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.internal.processors.rest;
 
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
@@ -349,7 +351,11 @@ public class GridRestProcessor extends GridProcessorAdapter {
                             .a(", params=").a(tskReq.params());
                     }
 
-                    sb.a(", err=").a(e.getMessage() != null ? e.getMessage() : e.getClass().getName()).a(']');
+                    sb.a(", err=")
+                        .a(e.getMessage() != null ? e.getMessage() : e.getClass().getName())
+                        .a(", trace=")
+                        .a(getErrorMessage(e))
+                        .a(']');
 
                     res = new GridRestResponse(STATUS_FAILED, sb.toString());
                 }
@@ -367,6 +373,21 @@ public class GridRestProcessor extends GridProcessorAdapter {
     }
 
     /**
+     * @param th Th.
+     * @return Stack trace
+     */
+    private String getErrorMessage(Throwable th) {
+        if (th == null)
+            return "";
+
+        StringWriter writer = new StringWriter();
+
+        th.printStackTrace(new PrintWriter(writer));
+
+        return writer.toString();
+    }
+
+    /**
      * @param req Request.
      * @return Not null session.
      * @throws IgniteCheckedException If failed.


Mime
View raw message