Skip to content

Commit 70915a2

Browse files
committed
use last JSESSIONID
1 parent 9cf09cc commit 70915a2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,13 +429,19 @@ private static String getCookie(String user, String password) throws IOException
429429
LOG.info("{} - {}", postMethod.getStatusCode(), postMethod.getStatusText());
430430
Pattern pattern = Pattern.compile("JSESSIONID=([a-zA-Z0-9-]*)");
431431
Header[] setCookieHeaders = postMethod.getResponseHeaders("Set-Cookie");
432+
String jsessionId = null;
432433
for (Header setCookie : setCookieHeaders) {
433434
java.util.regex.Matcher matcher = pattern.matcher(setCookie.toString());
434435
if (matcher.find()) {
435-
return matcher.group(1);
436+
jsessionId = matcher.group(1);
436437
}
437438
}
438-
return StringUtils.EMPTY;
439+
440+
if (jsessionId != null) {
441+
return jsessionId;
442+
} else {
443+
return StringUtils.EMPTY;
444+
}
439445
}
440446

441447
protected static boolean userAndPasswordAreNotBlank(String user, String pwd) {

0 commit comments

Comments
 (0)