aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/github/daneren2005/dsub/util/FileUtil.java8
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 {