Fix RTE resulting from using wrong Json converter on RecordTemplate

This commit is contained in:
Kerem Sahin 2020-01-06 17:51:45 -08:00
parent f07f545df7
commit dd60454420

View File

@ -19,6 +19,8 @@ import utils.ControllerUtil;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import static com.linkedin.datahub.util.RestliUtil.*;
public class CorpUser extends Controller { public class CorpUser extends Controller {
private static final JsonNode EMPTY_RESPONSE = Json.newObject(); private static final JsonNode EMPTY_RESPONSE = Json.newObject();
@ -38,7 +40,7 @@ public class CorpUser extends Controller {
@Nonnull @Nonnull
public Result getCorpUser(@Nonnull String corpUserUrn) { public Result getCorpUser(@Nonnull String corpUserUrn) {
try { try {
return ok(Json.toJson(_corpUserViewDao.get(corpUserUrn))); return ok(toJsonNode(_corpUserViewDao.get(corpUserUrn)));
} catch (Exception e) { } catch (Exception e) {
if (e.toString().contains("Response status 404")) { if (e.toString().contains("Response status 404")) {
return notFound(EMPTY_RESPONSE); return notFound(EMPTY_RESPONSE);