@Test public void getHadoopAuthCookieValueWitEmptylHeaders() { assertNull(AppCookieManager.getHadoopAuthCookieValue(new Header[0])); }
static String getHadoopAuthCookieValue(Header[] headers) { if (headers == null) { return null; } for (Header header : headers) { HeaderElement[] elements = header.getElements(); for (HeaderElement element : elements) { String cookieName = element.getName(); if (cookieName.equals(HADOOP_AUTH)) { if (element.getValue() != null) { String trimmedVal = element.getValue().trim(); if (!trimmedVal.isEmpty()) { return trimmedVal; } } } } } return null; }
AppCookieManager { static String getHadoopAuthCookieValue(Header[] headers) { if (headers == null) { return null; } for (Header header : headers) { HeaderElement[] elements = header.getElements(); for (HeaderElement element : elements) { String cookieName = element.getName(); if (cookieName.equals(HADOOP_AUTH)) { if (element.getValue() != null) { String trimmedVal = element.getValue().trim(); if (!trimmedVal.isEmpty()) { return trimmedVal; } } } } } return null; } }
AppCookieManager { static String getHadoopAuthCookieValue(Header[] headers) { if (headers == null) { return null; } for (Header header : headers) { HeaderElement[] elements = header.getElements(); for (HeaderElement element : elements) { String cookieName = element.getName(); if (cookieName.equals(HADOOP_AUTH)) { if (element.getValue() != null) { String trimmedVal = element.getValue().trim(); if (!trimmedVal.isEmpty()) { return trimmedVal; } } } } } return null; } AppCookieManager(); }
AppCookieManager { static String getHadoopAuthCookieValue(Header[] headers) { if (headers == null) { return null; } for (Header header : headers) { HeaderElement[] elements = header.getElements(); for (HeaderElement element : elements) { String cookieName = element.getName(); if (cookieName.equals(HADOOP_AUTH)) { if (element.getValue() != null) { String trimmedVal = element.getValue().trim(); if (!trimmedVal.isEmpty()) { return trimmedVal; } } } } } return null; } AppCookieManager(); static void main(String[] args); String getAppCookie(String endpoint, boolean refresh); String getCachedAppCookie(String endpoint); }
AppCookieManager { static String getHadoopAuthCookieValue(Header[] headers) { if (headers == null) { return null; } for (Header header : headers) { HeaderElement[] elements = header.getElements(); for (HeaderElement element : elements) { String cookieName = element.getName(); if (cookieName.equals(HADOOP_AUTH)) { if (element.getValue() != null) { String trimmedVal = element.getValue().trim(); if (!trimmedVal.isEmpty()) { return trimmedVal; } } } } } return null; } AppCookieManager(); static void main(String[] args); String getAppCookie(String endpoint, boolean refresh); String getCachedAppCookie(String endpoint);  }