javacommons/utils/javasrc/com/nokia/mj/impl/utils/DebugUtils.java
changeset 76 4ad59aaee882
parent 21 2a9601315dfc
child 72 1f0034e370aa
child 83 26b2b12093af
equal deleted inserted replaced
69:773449708c84 76:4ad59aaee882
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  ?Description
    14 * Description:
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 package com.nokia.mj.impl.utils;
    19 package com.nokia.mj.impl.utils;
       
    20 
       
    21 import java.io.PrintStream;
       
    22 import java.io.ByteArrayOutputStream;
    20 
    23 
    21 import com.nokia.mj.impl.rt.support.Jvm;
    24 import com.nokia.mj.impl.rt.support.Jvm;
    22 import com.nokia.mj.impl.utils.Logger;
    25 import com.nokia.mj.impl.utils.Logger;
    23 
    26 
    24 public final class DebugUtils
    27 public final class DebugUtils
    52     public static void closeThreadDumper()
    55     public static void closeThreadDumper()
    53     {
    56     {
    54         _closeThreadDumper();
    57         _closeThreadDumper();
    55     }
    58     }
    56 
    59 
       
    60     public static String getStackTrace(Throwable t)
       
    61     {
       
    62         if (t == null)
       
    63         {
       
    64             throw new NullPointerException("Null when getting stack trace");
       
    65         }
       
    66         ByteArrayOutputStream baos = new ByteArrayOutputStream();
       
    67         _getStackTrace(t, new PrintStream(baos));
       
    68         return baos.toString();
       
    69     }
       
    70 
       
    71     private static native void _getStackTrace(Throwable t, PrintStream printStream);
       
    72 
    57     private static native void _doThreadDump();
    73     private static native void _doThreadDump();
    58     private static native void _closeThreadDumper();
    74     private static native void _closeThreadDumper();
    59 }
    75 }