javacommons/utils/javasrc/com/nokia/mj/impl/utils/DebugUtils.java
changeset 76 4ad59aaee882
parent 21 2a9601315dfc
child 72 1f0034e370aa
child 83 26b2b12093af
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/DebugUtils.java	Thu Sep 02 20:20:40 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/DebugUtils.java	Fri Sep 17 08:28:21 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -11,13 +11,16 @@
 *
 * Contributors:
 *
-* Description:  ?Description
+* Description:
 *
 */
 
 
 package com.nokia.mj.impl.utils;
 
+import java.io.PrintStream;
+import java.io.ByteArrayOutputStream;
+
 import com.nokia.mj.impl.rt.support.Jvm;
 import com.nokia.mj.impl.utils.Logger;
 
@@ -54,6 +57,19 @@
         _closeThreadDumper();
     }
 
+    public static String getStackTrace(Throwable t)
+    {
+        if (t == null)
+        {
+            throw new NullPointerException("Null when getting stack trace");
+        }
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        _getStackTrace(t, new PrintStream(baos));
+        return baos.toString();
+    }
+
+    private static native void _getStackTrace(Throwable t, PrintStream printStream);
+
     private static native void _doThreadDump();
     private static native void _closeThreadDumper();
 }