Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

InputStream is instantly closed when response size is larger than fileStreamCacheSize #10

@kelgon

Description

@kelgon

line 267 of Connection.java:
EntityUtils.consume(entity);

this line of code will close the InputStream of reponse entity instantly, which cause the InputStream returned throw Exception when read.
So you simply cannot read a file if reponse body is larger than fileStreamCacheSize!

It won't work if you just delete this line of code. The connection is closed in the finally clause. So the InputStream returned by FileTemplate.getFileStream will always be closed when you try to read it.

The fix is to determine whether the reponse is cacheable(smaller than fileStreamCacheSize), if is not, read the response body into memory and return a InputStream point to the memory.

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