diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-07-07 10:38:11 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-07-07 10:38:11 -0700 |
commit | 9501ca530dfbe3f97917c5488167d20518492c24 (patch) | |
tree | ce7dc778c204a0e28549a55c64475256b46f1e9f /src/github/daneren2005 | |
parent | 2cd841bcd2c3017a2d3ee865661eeab432ad382e (diff) | |
download | dsub-9501ca530dfbe3f97917c5488167d20518492c24.tar.gz dsub-9501ca530dfbe3f97917c5488167d20518492c24.tar.bz2 dsub-9501ca530dfbe3f97917c5488167d20518492c24.zip |
Just refresh data by default, use serialization if fails
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r-- | src/github/daneren2005/dsub/service/CachedMusicService.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/github/daneren2005/dsub/service/CachedMusicService.java b/src/github/daneren2005/dsub/service/CachedMusicService.java index bd43fbed..31280b19 100644 --- a/src/github/daneren2005/dsub/service/CachedMusicService.java +++ b/src/github/daneren2005/dsub/service/CachedMusicService.java @@ -511,13 +511,15 @@ public class CachedMusicService implements MusicService { public User getUser(boolean refresh, String username, Context context, ProgressListener progressListener) throws Exception { User result = null; - if(!refresh) { - result = FileUtil.deserialize(context, getCacheName(context, "user-" + username), User.class); - } - - if(result == null) { + try { result = musicService.getUser(refresh, username, context, progressListener); FileUtil.serialize(context, result, getCacheName(context, "user-" + username)); + } catch(Exception e) { + // Don't care + } + + if(result == null && !refresh) { + result = FileUtil.deserialize(context, getCacheName(context, "user-" + username), User.class); } return result; |