Skip to content

thread will block forever when server not return all data #42

@WoodLewis

Description

@WoodLewis

the default conection timeout and read timeout of HttpURLConnection is -1 which means the socket will always wait to read data and block the user thread forever if server not finish the connect,so the user thread seems to stop running.
to fix this bug may change "load" method of "RSSReader" like below:

    ......
    private int readTimeout=30000;
    private int connectTimeout=30000;
    ......
    public RSSFeed load(String uri) throws RSSReaderException{
            ......
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestMethod("GET");
            conn.setConnectTimeout(readTimeout);
            conn.setReadTimeout(connectTimeout);
            conn.connect();
            ......
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions