You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The image link does not necessarily contain a "Content-Length" header in their response header (at least in my test case on google finance chart like http://www.google.com/finance/chart?cht=c&q=INDEXDJX:.DJI,INDEXSP:.INX,INDEXNASDAQ:.IXIC&tlf=12h), while the ImageLoader.retrieveImageData will return null if the header does not exist.
I think the image data array could be initialized by the method doesn't involve testing the header field, here's my code (I didn't handle if the connection returning a HTTP status not equal to "OK", but that is out of the topic in this issue):
This issue also crops up when images are gzipped by the server. The content-length header (at least in the installation of Apache I'm working with) is the length of the compressed data, and the download code breaks on it.
The solution proposed here works, but unfortunately duplicates the image data in the call to out.toByteArray().
The image link does not necessarily contain a "Content-Length" header in their response header (at least in my test case on google finance chart like http://www.google.com/finance/chart?cht=c&q=INDEXDJX:.DJI,INDEXSP:.INX,INDEXNASDAQ:.IXIC&tlf=12h), while the ImageLoader.retrieveImageData will return null if the header does not exist.
I think the image data array could be initialized by the method doesn't involve testing the header field, here's my code (I didn't handle if the connection returning a HTTP status not equal to "OK", but that is out of the topic in this issue):
protected byte[] retrieveImageData() throws IOException {
URL url = new URL(imageUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
int BUFFER_SIZE = 1024*16;
byte[] imageData;
Sorry I am not familiar with Git, thus the coding part looks strange, i don't know why =_=??
The text was updated successfully, but these errors were encountered: