Examples of DropboxParseException


Examples of com.dropbox.client2.exception.DropboxParseException

            if (DropboxServerException.isValidWithNullBody(response)) {
                // We have something from Dropbox, but it's an error with no reason
                throw new DropboxServerException(response);
            } else {
                // This is from Dropbox, and we shouldn't be getting it
                throw new DropboxParseException(bin);
            }
        } catch (OutOfMemoryError e) {
            throw new DropboxException(e);
        } finally {
            if (bin != null) {
View Full Code Here

Examples of com.dropbox.client2.exception.DropboxParseException

    public static Map<String, String> parseAsQueryString(HttpResponse response)
            throws DropboxException {
        HttpEntity entity = response.getEntity();

        if (entity == null) {
            throw new DropboxParseException("Bad response from Dropbox.");
        }

        Scanner scanner;
        try {
            scanner = new Scanner(entity.getContent()).useDelimiter("&");
        } catch (IOException e) {
            throw new DropboxIOException(e);
        }

        Map<String, String> result = new HashMap<String, String>();

        while (scanner.hasNext()) {
            String nameValue = scanner.next();
            String[] parts = nameValue.split("=");
            if (parts.length != 2) {
                throw new DropboxParseException("Bad query string from Dropbox.");
            }
            result.put(parts[0], parts[1]);
        }

        return result;
View Full Code Here

Examples of com.dropbox.client2.exception.DropboxParseException

        String url = (String)map.get("url");
        Date expires = RESTUtility.parseDate((String)map.get("expires"));

        if (url == null || expires == null) {
            throw new DropboxParseException("Could not parse share response.");
        }

        return new DropboxLink(map);
    }
View Full Code Here

Examples of com.dropbox.client2.exception.DropboxParseException

        Object json = RESTUtility.request(RequestMethod.POST,
                session.getAPIServer(), "/delta", VERSION, params, session);
        try {
            return DeltaPage.extractFromJson(new JsonThing(json), Entry.JsonExtractor);
        } catch (JsonExtractionException ex) {
            throw new DropboxParseException("Error parsing /delta results: " + ex.getMessage());
        }
    }
View Full Code Here

Examples of com.dropbox.client2.exception.DropboxParseException

                session.getAPIServer(), url_path, VERSION, params, session);

        try {
            return CreatedCopyRef.extractFromJson(new JsonThing(result));
        } catch (JsonExtractionException ex) {
            throw new DropboxParseException("Error parsing /copy_ref results: " + ex.getMessage());
        }
    }
View Full Code Here

Examples of com.dropbox.client2.exception.DropboxParseException

        // fileSize and metadata are guaranteed to be valid if the constructor
        // doesn't throw an exception.
        private DropboxFileInfo(HttpResponse response) throws DropboxException {
            metadata = parseXDropboxMetadata(response);
            if (metadata == null) {
                throw new DropboxParseException("Error parsing metadata.");
            }

            fileSize = parseFileSize(response, metadata);
            if (fileSize == -1) {
                throw new DropboxParseException("Error determining file size.");
            }

            // Parse mime type and charset.
            Header contentType = response.getFirstHeader("Content-Type");
            if (contentType != null) {
View Full Code Here

Examples of com.dropbox.client2.exception.DropboxParseException

                this).response;
        Map<String, String> result = RESTUtility.parseAsQueryString(response);

        if (!result.containsKey("oauth_token") ||
                !result.containsKey("oauth_token_secret")) {
            throw new DropboxParseException("Did not get tokens from Dropbox");
        }

        setAccessTokenPair(new AccessTokenPair(
            result.get("oauth_token"), result.get("oauth_token_secret")));
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.