Premature end of Content-Length delimited message body (expected:

I might be replying on it late. But I also encounter the same problem. And I got the resolution of it.
In my case I was closing the client before utilizing the HttpEntity. And after closing the client I was trying to download the file. Below code is similar to what I was doing:

HttpEntity httpEntity = null;
try (final CloseableHttpClient client = createHttpClient()) {
     httpEntity = getEntity(client);
}

return downloadFile(httpEntity, targetDirectory, fileName);

After adjusting my code to download the file before closing the client, Its working now for me. Below code is similar to what I did now:

try (final CloseableHttpClient client = createHttpClient()) {
     HttpEntity httpEntity = getEntity(client);
     return downloadFile(httpEntity, targetDirectory, fileName);
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)