diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-09-24 21:27:54 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-09-24 21:27:54 -0700 |
commit | 36beac52466e86fe428c77101128c6ee7edb961d (patch) | |
tree | 9e956f5f12dc165266a90c262b0cdfa0116b8678 /src/github/daneren2005 | |
parent | 6f489bf69237b70bf211eb8c694a7a3f6427f067 (diff) | |
download | dsub-36beac52466e86fe428c77101128c6ee7edb961d.tar.gz dsub-36beac52466e86fe428c77101128c6ee7edb961d.tar.bz2 dsub-36beac52466e86fe428c77101128c6ee7edb961d.zip |
Give a different error message for when serialization doesn't exist
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r-- | src/github/daneren2005/dsub/util/FileUtil.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/util/FileUtil.java b/src/github/daneren2005/dsub/util/FileUtil.java index aefb24ea..d18bddb8 100644 --- a/src/github/daneren2005/dsub/util/FileUtil.java +++ b/src/github/daneren2005/dsub/util/FileUtil.java @@ -20,6 +20,7 @@ package github.daneren2005.dsub.util; import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.RandomAccessFile; import java.io.Serializable; @@ -397,11 +398,16 @@ public class FileUtil { Input in = null; try { RandomAccessFile file = new RandomAccessFile(context.getCacheDir() + "/" + fileName, "r"); + in = new Input(new FileInputStream(file.getFD())); T result = (T) kryo.readObject(in, tClass); Log.i(TAG, "Deserialized object from " + fileName); return result; - } catch (Throwable x) { + } catch(FileNotFoundException e) { + // Different error message + Log.w(TAG, "No serialization for object from " + fileName); + return null; + } catch (Throwable x) { Log.w(TAG, "Failed to deserialize object from " + fileName, x); return null; } finally { |