Examples of BoxServerException


Examples of com.box.boxjavalibv2.exceptions.BoxServerException

        try {
            result = requestBodyAndHeaders("direct://GETPREVIEW", null, headers);
        } catch (CamelExecutionException e) {
            boolean ignore = false;
            if (e.getCause().getCause() instanceof BoxServerException) {
                BoxServerException exception = (BoxServerException) e.getCause().getCause();
                if (PREVIEW_UNAVAILABLE.equals(exception.getMessage())) {
                    // ignore unavailable preview errors
                    result = new BoxPreview();
                    ignore = true;
                }
            }
View Full Code Here

Examples of com.box.boxjavalibv2.exceptions.BoxServerException

        DefaultBoxResponse response = (DefaultBoxResponse) getRestClient().execute(request);
        if (response.getExpectedResponseCode() != response.getResponseStatusCode()) {
            ErrorResponseParser errorParser = new ErrorResponseParser(getObjectMapper());
            BoxServerError error = (BoxServerError) errorParser.parse(response);
            if (error == null) {
                throw new BoxServerException("Unexpected response code:" + response.getResponseStatusCode() + ", expecting:"
                                             + response.getExpectedResponseCode(), response.getResponseStatusCode());
            }
            else {
                throw new BoxServerException(error);
            }
        }
    }
View Full Code Here

Examples of com.box.boxjavalibv2.exceptions.BoxServerException

     *             exception
     */
    @SuppressWarnings("rawtypes")
    public Object tryCastObject(final BoxResourceType expectedType, final Object obj) throws BoxServerException, BoxRestException {
        if (obj instanceof BoxServerError) {
            throw new BoxServerException((BoxServerError) obj);
        }
        else if (obj instanceof BoxUnexpectedStatus) {
            throw new BoxUnexpectedHttpStatusException((BoxUnexpectedStatus) obj);
        }
        else {
View Full Code Here

Examples of com.box.boxjavalibv2.exceptions.BoxServerException

        DefaultBoxResponse response = (DefaultBoxResponse) mRestClient.execute(request);
        DefaultFileResponseParser parser = new DefaultFileResponseParser();
        ErrorResponseParser errorParser = new ErrorResponseParser(objectMapper);
        Object result = response.parseResponse(parser, errorParser);
        if (result instanceof BoxServerError) {
            throw new BoxServerException((BoxServerError) result);
        }
        return (InputStream) result;
    }
View Full Code Here

Examples of com.box.boxjavalibv2.exceptions.BoxServerException

        try {
            if (response.getExpectedResponseCode() != response.getResponseStatusCode()) {
                ErrorResponseParser errorParser = new ErrorResponseParser(getJSONParser());
                BoxServerError error = (BoxServerError) errorParser.parse(response);
                if (error == null) {
                    throw new BoxServerException("Unexpected response code:" + response.getResponseStatusCode() + ", expecting:"
                                                 + response.getExpectedResponseCode(), response.getResponseStatusCode());
                }
                else {
                    throw new BoxServerException(error);
                }
            }
        }
        finally {
            Utils.consumeHttpEntityQuietly(response.getHttpResponse().getEntity());
View Full Code Here

Examples of com.box.boxjavalibv2.exceptions.BoxServerException

     * Try to cast an object into a specific class.
     */
    @SuppressWarnings("rawtypes")
    public Object tryCastObject(final IBoxType expectedType, final Object obj) throws BoxServerException, BoxRestException {
        if (obj instanceof BoxServerError) {
            throw new BoxServerException((BoxServerError) obj);
        }
        else if (obj instanceof BoxUnexpectedStatus) {
            throw new BoxUnexpectedHttpStatusException((BoxUnexpectedStatus) obj);
        }
        else {
View Full Code Here

Examples of com.box.boxjavalibv2.exceptions.BoxServerException

            if (o instanceof BoxServerError) {
                if (o instanceof BoxUnexpectedStatus) {
                    throw new BoxUnexpectedHttpStatusException((BoxUnexpectedStatus) o);
                }
                else {
                    throw new BoxServerException((BoxServerError) o);
                }
            }
        }
        return (InputStream) (new DefaultFileResponseParser()).parse(response);
    }
View Full Code Here

Examples of com.box.boxjavalibv2.exceptions.BoxServerException

        DefaultBoxResponse response = (DefaultBoxResponse) mRestClient.execute(request);
        DefaultFileResponseParser responseParser = new DefaultFileResponseParser();
        ErrorResponseParser errorParser = new ErrorResponseParser(parser);
        Object result = response.parseResponse(responseParser, errorParser);
        if (result instanceof BoxServerError) {
            throw new BoxServerException((BoxServerError) result);
        }
        return (InputStream) result;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.