atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From suma...@apache.org
Subject incubator-atlas git commit: ATLAS-1355: Fix for bad error translation from V2 API
Date Wed, 07 Dec 2016 22:39:13 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 78c835edf -> de6122fa3


ATLAS-1355: Fix for bad error translation from V2 API


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

Branch: refs/heads/master
Commit: de6122fa31998bf591b48c73c325fc502a1b1837
Parents: 78c835e
Author: apoorvnaik <anaik@hortonworks.com>
Authored: Wed Dec 7 13:54:12 2016 -0800
Committer: Suma Shivaprasad <sumasai.shivaprasad@gmail.com>
Committed: Wed Dec 7 14:39:01 2016 -0800

----------------------------------------------------------------------
 release-log.txt                                              | 1 +
 .../java/org/apache/atlas/web/resources/TypesResource.java   | 6 ++++++
 .../src/main/java/org/apache/atlas/web/rest/TypesREST.java   | 8 +++-----
 3 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/de6122fa/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index c4d2a49..5a87d9b 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements
for al
 ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
 
 ALL CHANGES:
+ATLAS-1355: Fix for bad error translation from V2 API (apoorvnaik via sumasai)
 ATLAS-1351 HiveHook fails with NPE for hive process registration (vimalsharma via sumasai)
 ATLAS-1342 Titan Solrclient - Add timeouts for zookeeper connect and session (sumasai)
 ATLAS-1353 Invalid error message(500 internal server error) for lineage query on non-existing
table. (sumasai)

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/de6122fa/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
index 355fb8d..9acfb2f 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
@@ -121,6 +121,9 @@ public class TypesResource {
         } catch (IllegalArgumentException e) {
             LOG.error("Unable to persist types", e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to persist types due to V2 API error", e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to persist types", e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -168,6 +171,9 @@ public class TypesResource {
         } catch (AtlasException | IllegalArgumentException e) {
             LOG.error("Unable to persist types", e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to persist types due to V2 API error", e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to persist types", e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/de6122fa/webapp/src/main/java/org/apache/atlas/web/rest/TypesREST.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/TypesREST.java b/webapp/src/main/java/org/apache/atlas/web/rest/TypesREST.java
index 867307f..43414c9 100644
--- a/webapp/src/main/java/org/apache/atlas/web/rest/TypesREST.java
+++ b/webapp/src/main/java/org/apache/atlas/web/rest/TypesREST.java
@@ -18,7 +18,6 @@
 package org.apache.atlas.web.rest;
 
 import com.google.inject.Inject;
-
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.SearchFilter;
 import org.apache.atlas.model.typedef.AtlasClassificationDef;
@@ -38,9 +37,6 @@ import org.apache.http.annotation.Experimental;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.List;
-import java.util.Set;
-
 import javax.inject.Singleton;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.Consumes;
@@ -54,6 +50,8 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
+import java.util.List;
+import java.util.Set;
 
 
 @Path("v2/types")
@@ -457,7 +455,7 @@ public class TypesREST {
         try {
             ret = typeDefStore.updateTypesDef(typesDef);
         } catch (AtlasBaseException ex) {
-            throw new WebApplicationException(Servlets.getErrorResponse(ex, Response.Status.NOT_MODIFIED));
+            throw new WebApplicationException(Servlets.getErrorResponse(ex, ex.getAtlasErrorCode().getHttpCode()));
         }
 
         return ret;


Mime
View raw message