aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-07-07 10:38:11 -0700
committerScott Jackson <daneren2005@gmail.com>2014-07-07 10:38:11 -0700
commit9501ca530dfbe3f97917c5488167d20518492c24 (patch)
treece7dc778c204a0e28549a55c64475256b46f1e9f
parent2cd841bcd2c3017a2d3ee865661eeab432ad382e (diff)
downloaddsub-9501ca530dfbe3f97917c5488167d20518492c24.tar.gz
dsub-9501ca530dfbe3f97917c5488167d20518492c24.tar.bz2
dsub-9501ca530dfbe3f97917c5488167d20518492c24.zip
Just refresh data by default, use serialization if fails
-rw-r--r--src/github/daneren2005/dsub/service/CachedMusicService.java12
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;