diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-08-31 16:28:21 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-08-31 16:28:21 +0200 |
commit | 1ac5be485502e7d6d4c117335e083c684739e6af (patch) | |
tree | 279c22e269158dde838f31ebcf3daf4272573583 /src/eu/siacs/conversations/utils/ExceptionHandler.java | |
parent | 8d456085e57334dc34707a49666006619e2c77c6 (diff) |
some code cleanup
Diffstat (limited to '')
-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 |