throw new RequestTrackerException(e); } finally { getClientWrapper().close(response);
throw new RequestTrackerException(e); } finally { getClientWrapper().close(response);
return null; } finally { getClientWrapper().close(response);
return null; } finally { getClientWrapper().close(response);
public RTUser getUserInfo(final String username) { getSession(); Map<String, String> attributes = Collections.emptyMap(); final HttpGet get = new HttpGet(m_baseURL + "/REST/1.0/user/" + username); CloseableHttpResponse response = null; try { response = getClientWrapper().execute(get); int responseCode = response.getStatusLine().getStatusCode(); if (responseCode != HttpStatus.SC_OK) { throw new RequestTrackerException("Received a non-200 response code from the server: " + responseCode); } else { if (response.getEntity() != null) { attributes = parseResponseStream(response.getEntity().getContent()); } } } catch (final Exception e) { LOG.error("An exception occurred while getting user info for {}", username, e); return null; } finally { getClientWrapper().close(response); } final String id = attributes.get("id"); final String realname = attributes.get("realname"); final String email = attributes.get("emailaddress"); if (id == null || "".equals(id)) { LOG.error("Unable to retrieve ID from user info."); return null; } return new RTUser(Long.parseLong(id.replace("user/", "")), username, realname, email); }
public RTUser getUserInfo(final String username) { getSession(); Map<String, String> attributes = Collections.emptyMap(); final HttpGet get = new HttpGet(m_baseURL + "/REST/1.0/user/" + username); CloseableHttpResponse response = null; try { response = getClientWrapper().execute(get); int responseCode = response.getStatusLine().getStatusCode(); if (responseCode != HttpStatus.SC_OK) { throw new RequestTrackerException("Received a non-200 response code from the server: " + responseCode); } else { if (response.getEntity() != null) { attributes = parseResponseStream(response.getEntity().getContent()); } } } catch (final Exception e) { LOG.error("An exception occurred while getting user info for {}", username, e); return null; } finally { getClientWrapper().close(response); } final String id = attributes.get("id"); final String realname = attributes.get("realname"); final String email = attributes.get("emailaddress"); if (id == null || "".equals(id)) { LOG.error("Unable to retrieve ID from user info."); return null; } return new RTUser(Long.parseLong(id.replace("user/", "")), username, realname, email); }
LOG.error("HTTP exception attempting to get ticket.", e); } finally { getClientWrapper().close(response);
return null; } finally { getClientWrapper().close(response);
LOG.error("HTTP exception attempting to get ticket.", e); } finally { getClientWrapper().close(response);
return null; } finally { getClientWrapper().close(response);
LOG.warn("Unable to get session (by requesting user details)", e); } finally { m_clientWrapper.close(response);
LOG.warn("Unable to get session (by requesting user details)", e); } finally { m_clientWrapper.close(response);
} finally { IOUtils.closeQuietly(responseStream); m_clientWrapper.close(response);
} finally { IOUtils.closeQuietly(responseStream); m_clientWrapper.close(response);