You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by sh...@apache.org on 2016/02/02 09:13:05 UTC
incubator-atlas git commit: ATLAS-452 Exceptions while running
HiveHookIT#testAlterTableRename (shwethags)
Repository: incubator-atlas
Updated Branches:
refs/heads/master 6ec94374a -> d2b9b99f4
ATLAS-452 Exceptions while running HiveHookIT#testAlterTableRename (shwethags)
Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/d2b9b99f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/d2b9b99f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/d2b9b99f
Branch: refs/heads/master
Commit: d2b9b99f4b21129667f1a12d3564fb950d42d07c
Parents: 6ec9437
Author: Shwetha GS <ss...@hortonworks.com>
Authored: Tue Feb 2 13:26:16 2016 +0530
Committer: Shwetha GS <ss...@hortonworks.com>
Committed: Tue Feb 2 13:26:16 2016 +0530
----------------------------------------------------------------------
release-log.txt | 1 +
.../atlas/repository/graph/GraphHelper.java | 6 ++-
.../atlas/web/resources/TypesResource.java | 2 +-
.../org/apache/atlas/web/util/Servlets.java | 5 ++-
.../org/apache/atlas/web/util/ServletsTest.java | 40 ++++++++++++++++++++
5 files changed, 49 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2b9b99f/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 93e2866..77d036b 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -7,6 +7,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file (dosset
ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via shwethags)
ALL CHANGES:
+ATLAS-452 Exceptions while running HiveHookIT#testAlterTableRename (shwethags)
ATLAS-388 UI : On creating Tag, the page to be reset for creating new Tag (Anilg via shwethags)
ATLAS-199 webapp build fails (grunt + tests) (sanjayp via shwethags)
ATLAS-415 Hive import fails when importing a table that is already imported without StorageDescriptor information (yhemanth via shwethags)
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2b9b99f/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
index 97710da..2eb4d5b 100755
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
@@ -109,8 +109,9 @@ public final class GraphHelper {
public Edge addEdge(Vertex fromVertex, Vertex toVertex, String edgeLabel) {
LOG.debug("Adding edge for {} -> label {} -> {}", fromVertex, edgeLabel, toVertex);
-
- return titanGraph.addEdge(null, fromVertex, toVertex, edgeLabel);
+ Edge edge = titanGraph.addEdge(null, fromVertex, toVertex, edgeLabel);
+ LOG.debug("Added edge for {} -> label {}, id {} -> {}", fromVertex, edgeLabel, edge.getId(), toVertex);
+ return edge;
}
public Vertex findVertex(String propertyKey, Object value) {
@@ -161,6 +162,7 @@ public final class GraphHelper {
} else {
if (!value.equals(existValue)) {
vertex.setProperty(propertyName, value);
+ LOG.debug("Set property {} = \"{}\" to vertex {}", propertyName, value, vertex);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2b9b99f/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 3b90248..8b0d0e9 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
@@ -214,7 +214,7 @@ public class TypesResource {
} catch (IllegalArgumentException | AtlasException ie) {
LOG.error("Unsupported typeName while retrieving type list {}", type);
throw new WebApplicationException(
- Servlets.getErrorResponse("Unsupported type " + type, Response.Status.BAD_REQUEST));
+ Servlets.getErrorResponse(new Exception("Unsupported type " + type, ie), Response.Status.BAD_REQUEST));
} catch (Throwable e) {
LOG.error("Unable to get types list", e);
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2b9b99f/webapp/src/main/java/org/apache/atlas/web/util/Servlets.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/util/Servlets.java b/webapp/src/main/java/org/apache/atlas/web/util/Servlets.java
index 8c6b616..480a232 100755
--- a/webapp/src/main/java/org/apache/atlas/web/util/Servlets.java
+++ b/webapp/src/main/java/org/apache/atlas/web/util/Servlets.java
@@ -104,7 +104,8 @@ public final class Servlets {
}
public static Response getErrorResponse(Throwable e, Response.Status status) {
- Response response = getErrorResponse(e.getMessage(), status);
+ String message = e.getMessage() == null ? "Failed with " + e.getClass().getName() : e.getMessage();
+ Response response = getErrorResponse(message, status);
JSONObject responseJson = (JSONObject) response.getEntity();
try {
responseJson.put(AtlasClient.STACKTRACE, printStackTrace(e));
@@ -122,7 +123,7 @@ public final class Servlets {
public static Response getErrorResponse(String message, Response.Status status) {
JSONObject errorJson = new JSONObject();
- Object errorEntity = Servlets.escapeJsonString(message);
+ Object errorEntity = escapeJsonString(message);
try {
errorJson.put(AtlasClient.ERROR, errorEntity);
errorEntity = errorJson;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2b9b99f/webapp/src/test/java/org/apache/atlas/web/util/ServletsTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/util/ServletsTest.java b/webapp/src/test/java/org/apache/atlas/web/util/ServletsTest.java
new file mode 100644
index 0000000..e732dbf
--- /dev/null
+++ b/webapp/src/test/java/org/apache/atlas/web/util/ServletsTest.java
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.atlas.web.util;
+
+import org.apache.atlas.AtlasClient;
+import org.codehaus.jettison.json.JSONObject;
+import org.testng.annotations.Test;
+
+import javax.ws.rs.core.Response;
+import static org.testng.Assert.*;
+
+@Test
+public class ServletsTest {
+
+ public void testEmptyMessage() throws Exception {
+ //This shouldn't throw exception
+ Response response =
+ Servlets.getErrorResponse(new NullPointerException(), Response.Status.INTERNAL_SERVER_ERROR);
+ assertNotNull(response);
+ JSONObject responseEntity = (JSONObject) response.getEntity();
+ assertNotNull(responseEntity);
+ assertNotNull(responseEntity.getString(AtlasClient.ERROR));
+ }
+}