From db716c8b155428204dc12123bf2841c6e88b792b Mon Sep 17 00:00:00 2001 From: Jeff Zhang Date: Thu, 22 Mar 2018 15:51:52 +0800 Subject: [PATCH] ZEPPELIN-3357. Livy security mode is broken ### What is this PR for? Straightforward fix for livy security issue. ### What type of PR is it? [Bug Fix] ### Todos * [ ] - Task ### What is the Jira issue? * https://issues.apache.org/jira/browse/ZEPPELIN-3357 ### How should this be tested? * CI pass ### Screenshots (if appropriate) ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Jeff Zhang Closes #2887 from zjffdu/ZEPPELIN-3357 and squashes the following commits: 2fbbbeb [Jeff Zhang] ZEPPELIN-3357. Livy security mode is broken --- .../org/apache/zeppelin/livy/BaseLivyInterpreter.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/livy/src/main/java/org/apache/zeppelin/livy/BaseLivyInterpreter.java b/livy/src/main/java/org/apache/zeppelin/livy/BaseLivyInterpreter.java index 1eba9c2885e..de0fff21280 100644 --- a/livy/src/main/java/org/apache/zeppelin/livy/BaseLivyInterpreter.java +++ b/livy/src/main/java/org/apache/zeppelin/livy/BaseLivyInterpreter.java @@ -662,11 +662,12 @@ public Principal getUserPrincipal() { } else { restTemplate = new KerberosRestTemplate(keytabLocation, principal, httpClient); } - } - if (httpClient == null) { - restTemplate = new RestTemplate(); } else { - restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory(httpClient)); + if (httpClient == null) { + restTemplate = new RestTemplate(); + } else { + restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory(httpClient)); + } } restTemplate.getMessageConverters().add(0, new StringHttpMessageConverter(Charset.forName("UTF-8"))); return restTemplate;