mcxiaoke / android-volley

DEPRECATED
4.29k stars 1.56k forks source link

find a bug in Imageloader #99

Open ttkk0000 opened 9 years ago

ttkk0000 commented 9 years ago

there is bug in function batchResponse().

I have add some logs to track this issue, such as follow: if(mBatchedResponses.containsKey(cacheKey)) { Log.e("BatchedImageRequest", "_+" + cacheKey + "+_"); } mBatchedResponses.put(cacheKey, request);

    Log.e("BatchedImageRequest", "*************" + cacheKey + "***********");

when this bug happen , the log Log.e("BatchedImageRequest", "_+" + cacheKey + "+_") is executed. and the follow statement "mBatchedResponses.put(cacheKey, request); " cover the old cacheKey.

I have a suggestion for this issue, like this: if(mBatchedResponses.containsKey(cacheKey)) { mBatchedResponses.get(cacheKey).mContainers.addAll(request.mContainers) } else { mBatchedResponses.put(cacheKey, request); }

If you have any idea about this issue , pls send me a email. my email address is ttkk0000@gmail.com

ttkk0000 commented 9 years ago

when all the requests has the same cacheKey, the Cache is unvailable, and the delay time is enough long, a request is after the foregoing request have successfule response to be send out, when the request's response is returned , the new mBatchedResponses cachekey will cover the old. as a result, only one imageview is setted, others are default images.

ttkk0000 commented 9 years ago
2015-09-12 7 42 37 2015-09-12 7 44 35
ttkk0000 commented 9 years ago

the above pictures(the first is the issue, the second one is the normal situation) show that: the last request's returned batchresponse covered the old cachekey and result to the first picture's situation.