javacommons/utils/src/debugutils.cpp
branchRCL_3
changeset 83 26b2b12093af
parent 77 7cee158cb8cd
equal deleted inserted replaced
77:7cee158cb8cd 83:26b2b12093af
    37 (JNIEnv* /*aEnv*/, jclass)
    37 (JNIEnv* /*aEnv*/, jclass)
    38 {
    38 {
    39     ThreadDump::closeDumper();
    39     ThreadDump::closeDumper();
    40 }
    40 }
    41 
    41 
    42 /**
       
    43  * A utility for getting the stack trace for further processing.
       
    44  * @param th The throwable from where the stack trace should be get.
       
    45  * @param printStream Where to print the stack trace.
       
    46  */
       
    47 JNIEXPORT void JNICALL
       
    48 Java_com_nokia_mj_impl_utils_DebugUtils__1getStackTrace
       
    49 (JNIEnv* jniEnv, jclass, jthrowable th, jobject printStream)
       
    50 {
       
    51     /*
       
    52      * call Throwable.printStackTrace(java.io.PrintStream)
       
    53      * this method is not part of CLDC spec, but it's supported by VM vendor.
       
    54      */
       
    55     jclass classThrowable = jniEnv->GetObjectClass(th);
       
    56     if (classThrowable)
       
    57     {
       
    58         jmethodID methodId = jniEnv->GetMethodID(classThrowable,
       
    59                              "printStackTrace",
       
    60                              "(Ljava/io/PrintStream;)V");
       
    61         if (methodId)
       
    62         {
       
    63             jniEnv->CallVoidMethod(th, methodId, printStream);
       
    64         }
       
    65     }
       
    66 }