socrata / datasync

Desktop / Console application for updating Socrata datasets automatically.
http://socrata.github.io/datasync/
MIT License
80 stars 33 forks source link

EN-5650: Socket is closed #133

Closed spaceballone closed 8 years ago

spaceballone commented 8 years ago

When we leave the scope of the try block in DatasetUtils.get, the socket on the CloseableHttpResponse is automatically closed. This happens before we consume the contents. This leads to some conditions (not all) where reading the stream throws a socket closed exception.

The fix is to use a more common pattern with the HttpClient by passing a response handler to the client. This handler is executed in scope thus bypassing this issue.

catstavi commented 8 years ago

I like this change -- only questions: what was the reasoning for removing the UTF-8 encoding step, and the retry loop?

spaceballone commented 8 years ago

Talked wtih @catstavi in person. :shipit: