ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject ignite git commit: IGNITE-6012 Review.
Date Thu, 10 Aug 2017 09:57:41 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-6012 a0fe6ea46 -> 3ae7bff97


IGNITE-6012 Review.


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

Branch: refs/heads/ignite-6012
Commit: 3ae7bff97db9d47d712444888cab3a83353ddd3b
Parents: a0fe6ea
Author: Andrey Novikov <anovikov@gridgain.com>
Authored: Thu Aug 10 16:57:03 2017 +0700
Committer: Andrey Novikov <anovikov@gridgain.com>
Committed: Thu Aug 10 16:57:20 2017 +0700

----------------------------------------------------------------------
 .../http/jetty/GridJettyRestHandler.java        | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3ae7bff9/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index b1c5577..327c13a 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@ -17,8 +17,7 @@
 
 package org.apache.ignite.internal.processors.rest.protocols.http.jetty;
 
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import java.io.BufferedInputStream;
 import java.io.ByteArrayOutputStream;
@@ -358,10 +357,10 @@ public class GridJettyRestHandler extends AbstractHandler {
 
             U.error(log, "Failed to process HTTP request [action=" + act + ", req=" + req
+ ']', e);
 
-            cmdRes = new GridRestResponse(STATUS_FAILED, e.getMessage());
-
             if (e instanceof Error)
                 throw (Error)e;
+
+            cmdRes = new GridRestResponse(STATUS_FAILED, e.getMessage());
         }
 
         try {
@@ -370,17 +369,10 @@ public class GridJettyRestHandler extends AbstractHandler {
             try {
                 jsonMapper.writeValue(os, cmdRes);
             }
-            catch (JsonGenerationException | JsonMappingException e1) {
-                U.error(log, "Failed to convert response to JSON: " + cmdRes, e1);
+            catch (JsonProcessingException e) {
+                U.error(log, "Failed to convert response to JSON: " + cmdRes, e);
 
-                GridRestResponse resFailed = new GridRestResponse(STATUS_FAILED, e1.getMessage());
-
-                try {
-                    jsonMapper.writeValue(os, resFailed);
-                }
-                catch (JsonGenerationException | JsonMappingException e2) {
-                    jsonMapper.writeValue(os, "{\"successStatus\": \"1\", \"error:\" \""
+ e2.getMessage() + "\"}}");
-                }
+                jsonMapper.writeValue(os, F.asMap("successStatus", STATUS_FAILED, "error",
e.getMessage()));
             }
 
             if (log.isDebugEnabled())


Mime
View raw message