Package com.atlassian.jira.rest.client.api

Examples of com.atlassian.jira.rest.client.api.RestClientException


      @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);
        }
      }
    };
  }
View Full Code Here


          public InputStream getInputStream() {
            try {
              return new ByteArrayInputStream(generator.generate(bean).toString().getBytes(Charset
                  .forName("UTF-8")));
            } catch (JSONException e) {
              throw new RestClientException(e);
            }
          }
        };
      }
    };
View Full Code Here

      if (fields != null) {
        postEntity.put(FIELDS_ATTRIBUTE, fields); // putOpt doesn't work with collections
      }
    } catch (JSONException e) {
      throw new RestClientException(e);
    }
    return postAndParse(searchUri, postEntity, searchResultJsonParser);
  }
View Full Code Here

    return new BaseMatcher<RestClientException>() {

      @Override
      public boolean matches(final Object item) {
        if (item instanceof RestClientException) {
          final RestClientException ex = (RestClientException) item;
          final Matcher<Iterable<? extends String>> errorMessageMatcher = Matchers
              .contains(expectedErrorMessage);
          return ex.getStatusCode().get().equals(statusCode)
              && ex.getErrorCollections().size() == 1
              && errorMessageMatcher.matches(ex.getErrorCollections().iterator().next().getErrorMessages());

        }
        return false;
      }

      @Override
      public void describeTo(final Description description) {
        final ErrorCollection expectedErrorCollection = ErrorCollection.builder()
            .errorMessage(expectedErrorMessage).status(statusCode) .build();

        final RestClientException expectedException = new RestClientException(
            ImmutableList.of(expectedErrorCollection), statusCode);

        description.appendText("<"+expectedException.toString()+">");
      }
    };
  }
View Full Code Here

  public static URI parseURI(final String str) {
    try {
      return new URI(str);
    } catch (URISyntaxException e) {
      throw new RestClientException(e);
    }
  }
View Full Code Here

  public static DateTime parseDateTime(final String str) {
    try {
      return JIRA_DATE_TIME_FORMATTER.parseDateTime(str);
    } catch (Exception e) {
      throw new RestClientException(e);
    }
  }
View Full Code Here

      return JIRA_DATE_TIME_FORMATTER.parseDateTime(str);
    } catch (Exception ignored) {
      try {
        return JIRA_DATE_FORMATTER.parseDateTime(str);
      } catch (Exception e) {
        throw new RestClientException(e);
      }
    }
  }
View Full Code Here

  public static DateTime parseDate(final String str) {
    try {
      return JIRA_DATE_FORMATTER.parseDateTime(str);
    } catch (Exception e) {
      throw new RestClientException(e);
    }
  }
View Full Code Here

TOP

Related Classes of com.atlassian.jira.rest.client.api.RestClientException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.