public RestClientException(final RestClientException exception) { super(exception.getMessage(), exception); this.statusCode = exception.getStatusCode(); this.errorCollections = exception.errorCollections; }
public static URI parseURI(final String str) { try { return new URI(str); } catch (URISyntaxException e) { throw new RestClientException(e); } }
public void submitFields(JiraSession session, String issueId, List<JiraIssueField> fields, PrintStream logger) { try { session.addFields(issueId, fields); } catch (RestClientException e) { if (e.getStatusCode().or(0).equals(404)) { logger.println(issueId + " - JIRA issue not found"); } if (e.getStatusCode().or(0).equals(403)) { logger.println(issueId + " - Jenkins JIRA user does not have permissions to comment on this issue"); } if (e.getStatusCode().or(0).equals(401)) { logger.println( issueId + " - Jenkins JIRA authentication problem"); } logger.println(Messages.FailedToUpdateIssue(issueId)); logger.println(e.getLocalizedMessage()); } }
public static DateTime parseDate(final String str) { try { return JIRA_DATE_FORMATTER.parseDateTime(str); } catch (Exception e) { throw new RestClientException(e); } }
public RestClientException(final RestClientException exception) { super(exception.getMessage(), exception); this.statusCode = exception.getStatusCode(); this.errorCollections = exception.errorCollections; }
if (e.getStatusCode().or(0).equals(404)) { logger.println(issue.getKey() + " - JIRA issue not found. Dropping comment from update queue."); if (e.getStatusCode().or(0).equals(403)) { logger.println(issue.getKey() + " - Jenkins JIRA user does not have permissions to comment on this issue. Preserving comment for future update."); continue; if (e.getStatusCode().or(0).equals(401)) { logger.println(issue.getKey() + " - Jenkins JIRA authentication problem. Preserving comment for future update."); continue; logger.println(e.getLocalizedMessage());
public static DateTime parseDateTime(final String str) { try { return JIRA_DATE_TIME_FORMATTER.parseDateTime(str); } catch (Exception e) { throw new RestClientException(e); } }
public static DateTime parseDate(final String str) { try { return JIRA_DATE_FORMATTER.parseDateTime(str); } catch (Exception e) { throw new RestClientException(e); } }
public static URI parseURI(final String str) { try { return new URI(str); } catch (URISyntaxException e) { throw new RestClientException(e); } }
public static DateTime parseDateTime(final String str) { try { return JIRA_DATE_TIME_FORMATTER.parseDateTime(str); } catch (Exception e) { throw new RestClientException(e); } }
@Override public T apply(@Nullable Response input) { try { return responseHandler.handle(input); } catch (JSONException e) { throw new RestClientException(e); } catch (IOException e) { throw new RestClientException(e); } } };
@Override public T apply(@Nullable Response input) { try { return responseHandler.handle(input); } catch (JSONException e) { throw new RestClientException(e); } catch (IOException e) { throw new RestClientException(e); } } };
/** * Tries to parse date and time and return that. If fails then tries to parse date only. * * @param str String contains either date and time or date only * @return date and time or date only */ public static DateTime parseDateTimeOrDate(final String str) { try { return JIRA_DATE_TIME_FORMATTER.parseDateTime(str); } catch (Exception ignored) { try { return JIRA_DATE_FORMATTER.parseDateTime(str); } catch (Exception e) { throw new RestClientException(e); } } }
/** * Tries to parse date and time and return that. If fails then tries to parse date only. * * @param str String contains either date and time or date only * @return date and time or date only */ public static DateTime parseDateTimeOrDate(final String str) { try { return JIRA_DATE_TIME_FORMATTER.parseDateTime(str); } catch (Exception ignored) { try { return JIRA_DATE_FORMATTER.parseDateTime(str); } catch (Exception e) { throw new RestClientException(e); } } }
@Override public T claim() { try { return delegate.claim(); } catch (RestClientException e) { throw new RestClientException(e); } }
@Override public T claim() { try { return delegate.claim(); } catch (RestClientException e) { throw new RestClientException(e); } }
@Override public BasicProjectRole apply(@Nullable final String key) { try { return new BasicProjectRole(JsonParseUtil.parseURI(json.getString(key)), key); } catch (JSONException e) { throw new RestClientException(e); } } }
@Override public BasicProjectRole apply(@Nullable final String key) { try { return new BasicProjectRole(JsonParseUtil.parseURI(json.getString(key)), key); } catch (JSONException e) { throw new RestClientException(e); } } }
@Override public T apply(Response response) { try { final String body = response.getEntity(); final Collection<ErrorCollection> errorMessages = extractErrors(response.getStatusCode(), body); throw new RestClientException(errorMessages, response.getStatusCode()); } catch (JSONException e) { throw new RestClientException(e, response.getStatusCode()); } } };
@Override public JSONObject generate(VersionPosition versionPosition) throws JSONException { final JSONObject res = new JSONObject(); final String posValue; switch (versionPosition) { case FIRST: posValue = "First"; break; case LAST: posValue = "Last"; break; case EARLIER: posValue = "Earlier"; break; case LATER: posValue = "Later"; break; default: throw new RestClientException("Unsupported position [" + versionPosition + "]", null); } res.put("position", posValue); return res; } }