Does not store avatar image in disk cache
I think there is a bug in the AvatarManager, but I need your judgement before sending a pull request:
// From AvatarManager.java:
userHashes.put(contact, hash1);
if (!Arrays.equals(avatar, new byte[0])) {
storeToCache(hash, avatar);
}
In case there is no local avatar existing, variable 'hash' (without suffix '1') is 'null'. So an avatar image is pulled from server. A new hash of that downloaded image is then stored in 'hash1', and we remember it in 'userHashes'. But in the next line (see above) we try to store the OLD hash (whithout suffix '1'), which still is 'null'. Hence, we end up with a silent com.sun exception because we cannot store 'null'.
I assume this is a bug...? I can fix it, but I need your opinion first.
Comments (5)
-
repo owner -
reporter Files pull request #36 to fix this. Take care when merging, Bitbucket always replaces the selected target branch (weird!)
One more question. Once I fixed that I noticed that the roster manager tells me that I have a contact with "BOTH" subscription indicated, but I have to pull the avatar of that contact manually, while my own avatar is pushed from the server automatically at login. Is that normal? I thought either I have to pull both avatars on my own, OR get pushed BOTH.
-
reporter - changed status to open
Filed PR #36
-
reporter - changed status to resolved
Fixed since PR #36
-
repo owner - changed status to closed
Fixed with 0.8.0
- Log in to comment
Yes, I am pretty sure it's a bug. This code used to be synchronous, only one
hash
variable was used. When lamddas and asynchronous code was introducedhash
needed to be final and a newhash1
was introduced (maybe even automatically by IntelliJ?). ThestoreToCache
has been overlooked here.