Package twitter4j

Examples of twitter4j.TwitterRuntimeException


    private void ensure() {
        if (actualResponse == null) {
            try {
                actualResponse = client.request(req);
            } catch (TwitterException e) {
                throw new TwitterRuntimeException(e);
            }
        }
    }
View Full Code Here


    private IDs getTarget() {
        if (target == null) {
            try {
                target = factory.createIDs(res);
            } catch (TwitterException e) {
                throw new TwitterRuntimeException(e);
            }
        }
        return target;
    }
View Full Code Here

    private SavedSearch getTarget() {
        if (target == null) {
            try {
                target = factory.createSavedSearch(res);
            } catch (TwitterException e) {
                throw new TwitterRuntimeException(e);
            }
        }
        return target;
    }
View Full Code Here

    private Relationship getTarget() {
        if (target == null) {
            try {
                target = factory.createRelationship(res);
            } catch (TwitterException e) {
                throw new TwitterRuntimeException(e);
            }
        }
        return target;
    }
View Full Code Here

    private UserList getTarget() {
        if (target == null) {
            try {
                target = factory.createAUserList(res);
            } catch (TwitterException e) {
                throw new TwitterRuntimeException(e);
            }
        }
        return target;
    }
View Full Code Here

    private AccountSettings getTarget() {
        if (target == null) {
            try {
                target = factory.createAccountSettings(res);
            } catch (TwitterException e) {
                throw new TwitterRuntimeException(e);
            }
        }
        return target;
    }
View Full Code Here

    private Trends getTarget() {
        if (target == null) {
            try {
                target = factory.createTrends(res);
            } catch (TwitterException e) {
                throw new TwitterRuntimeException(e);
            }
        }
        return target;
    }
View Full Code Here

    private TwitterAPIConfiguration getTarget() {
        if (target == null) {
            try {
                target = factory.createTwitterAPIConfiguration(res);
            } catch (TwitterException e) {
                throw new TwitterRuntimeException(e);
            }
        }
        return target;
    }
View Full Code Here

    private Place getTarget() {
        if (target == null) {
            try {
                target = factory.createPlace(res);
            } catch (TwitterException e) {
                throw new TwitterRuntimeException(e);
            }
        }
        return target;
    }
View Full Code Here

    private Throwable th = null;

    private void ensureResponseEvaluated() {
        if (th != null) {
            throw new TwitterRuntimeException(th);
        }
        if (responseGot) {
            return;
        }
        responseGot = true;
        if (future.isCancelled()) {
            th = new TwitterException("HttpResponse already disconnected.");
            throw new TwitterRuntimeException(th);
        }
        try {
            HTTPResponse r = future.get();
            statusCode = r.getResponseCode();
            headers = new HashMap<String, String>();
            for (HTTPHeader h : r.getHeaders()) {
                headers.put(h.getName(), h.getValue());
            }
            byte[] content = r.getContent();
            is = new ByteArrayInputStream(content);
            if ("gzip".equals(headers.get("Content-Encoding"))) {
                // the response is gzipped
                try {
                    is = new GZIPInputStream(is);
                } catch (IOException e) {
                    th = e;
                    throw new TwitterRuntimeException(th);
                }
            }
            responseAsString = inputStreamToString(is);
            if (statusCode < OK || (statusCode != FOUND && MULTIPLE_CHOICES <= statusCode)) {
                if (statusCode == ENHANCE_YOUR_CLAIM ||
                        statusCode == BAD_REQUEST ||
                        statusCode < INTERNAL_SERVER_ERROR) {
                    th = new TwitterException(responseAsString, null, statusCode);
                    throw new TwitterRuntimeException(th);
                }
            }
        } catch (ExecutionException e) {
            th = e.getCause();
        } catch (InterruptedException e) {
            th = e.getCause();
        }
        if (th != null) {
            throw new TwitterRuntimeException(th);
        }
    }
View Full Code Here

TOP

Related Classes of twitter4j.TwitterRuntimeException

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.