diff options
Diffstat (limited to 'src/eu/siacs/conversations/utils/ExceptionHandler.java')
-rw-r--r-- | src/eu/siacs/conversations/utils/ExceptionHandler.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/eu/siacs/conversations/utils/ExceptionHandler.java b/src/eu/siacs/conversations/utils/ExceptionHandler.java index 01cfebbb..88fa18ff 100644 --- a/src/eu/siacs/conversations/utils/ExceptionHandler.java +++ b/src/eu/siacs/conversations/utils/ExceptionHandler.java @@ -11,22 +11,25 @@ import java.lang.Thread.UncaughtExceptionHandler; import android.content.Context; public class ExceptionHandler implements UncaughtExceptionHandler { - + private UncaughtExceptionHandler defaultHandler; private Context context; + public ExceptionHandler(Context context) { this.context = context; this.defaultHandler = Thread.getDefaultUncaughtExceptionHandler(); } + @Override public void uncaughtException(Thread thread, Throwable ex) { Writer result = new StringWriter(); - PrintWriter printWriter = new PrintWriter(result); - ex.printStackTrace(printWriter); - String stacktrace = result.toString(); - printWriter.close(); - try { - OutputStream os = context.openFileOutput("stacktrace.txt",Context.MODE_PRIVATE); + PrintWriter printWriter = new PrintWriter(result); + ex.printStackTrace(printWriter); + String stacktrace = result.toString(); + printWriter.close(); + try { + OutputStream os = context.openFileOutput("stacktrace.txt", + Context.MODE_PRIVATE); os.write(stacktrace.getBytes()); } catch (FileNotFoundException e) { // TODO Auto-generated catch block |