From: Oskar Wiksten Date: Thu, 2 Aug 2012 11:44:38 +0000 (+0200) Subject: Provide whole stacktrace in log when a savegame fails to load. X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=f21b0c85b9b50cdb770dae2a643bd0d990b694ec;p=users%2Fmchehab%2Fandors-trail.git Provide whole stacktrace in log when a savegame fails to load. --- diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/Savegames.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/Savegames.java index 8c2ea49..ea91a53 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/Savegames.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/Savegames.java @@ -10,6 +10,8 @@ import java.io.FilenameFilter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -59,8 +61,14 @@ public final class Savegames { fos.close(); return result; } catch (IOException e) { - L.log("Error loading world: " + e.toString()); - return LOAD_RESULT_UNKNOWN_ERROR; + if (AndorsTrailApplication.DEVELOPMENT_DEBUGMESSAGES) { + L.log("Error loading world: " + e.toString()); + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + e.printStackTrace(pw); + L.log("Load error: " + sw.toString()); + } + return LOAD_RESULT_UNKNOWN_ERROR; } }