0
try {
fis = context.openFileInput("Stores");
ObjectInputStream oi = new ObjectInputStream(fis);
toReturn = (ArrayList<Store>) oi.readObject();
oi.close();
} catch (FileNotFoundException e) {
Log.e("InternalStorage", e.getMessage());
} catch (IOException e) {
Log.e("InternalStorage", e.getMessage());
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
我對IOException異常範圍創建系統崩潰,說IOException異常返回空的GET消息
java.lang.NullPointerException: println needs a message
爲什麼會出現這種情況?
你可以使用'將String.valueOf(e.getMessage())' –
或者相反,您可以用'Log.e(字符串標籤,絃樂味精,Throwable的TR)' –
你的問題是'e.getMessage'返回'null',你不能打印。 如果你想要完整的堆棧跟蹤,你也可以使用'Log.getStackTraceStrin(e)'。 – fbwnd