Commit d2b9b99f by Shwetha GS

ATLAS-452 Exceptions while running HiveHookIT#testAlterTableRename (shwethags)

parent 6ec94374
......@@ -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)
......
......@@ -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);
}
}
}
......
......@@ -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));
......
......@@ -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;
......
/**
* 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));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment