src/share/native/java/lang/Throwable.c

Print this page




  27  *      Implementation of class Throwable
  28  *
  29  *      former classruntime.c, Wed Jun 26 18:43:20 1991
  30  */
  31 
  32 #include <stdio.h>
  33 #include <signal.h>
  34 
  35 #include "jni.h"
  36 #include "jvm.h"
  37 
  38 #include "java_lang_Throwable.h"
  39 
  40 /*
  41  * Fill in the current stack trace in this exception.  This is
  42  * usually called automatically when the exception is created but it
  43  * may also be called explicitly by the user.  This routine returns
  44  * `this' so you can write 'throw e.fillInStackTrace();'
  45  */
  46 JNIEXPORT jobject JNICALL
  47 Java_java_lang_Throwable_fillInStackTrace(JNIEnv *env, jobject throwable)
  48 {
  49     JVM_FillInStackTrace(env, throwable);
  50     return throwable;
  51 }
  52 
  53 JNIEXPORT jint JNICALL
  54 Java_java_lang_Throwable_getStackTraceDepth(JNIEnv *env, jobject throwable)
  55 {
  56     return JVM_GetStackTraceDepth(env, throwable);
  57 }
  58 
  59 JNIEXPORT jobject JNICALL
  60 Java_java_lang_Throwable_getStackTraceElement(JNIEnv *env,
  61                                               jobject throwable, jint index)
  62 {
  63     return JVM_GetStackTraceElement(env, throwable, index);
  64 }


  27  *      Implementation of class Throwable
  28  *
  29  *      former classruntime.c, Wed Jun 26 18:43:20 1991
  30  */
  31 
  32 #include <stdio.h>
  33 #include <signal.h>
  34 
  35 #include "jni.h"
  36 #include "jvm.h"
  37 
  38 #include "java_lang_Throwable.h"
  39 
  40 /*
  41  * Fill in the current stack trace in this exception.  This is
  42  * usually called automatically when the exception is created but it
  43  * may also be called explicitly by the user.  This routine returns
  44  * `this' so you can write 'throw e.fillInStackTrace();'
  45  */
  46 JNIEXPORT jobject JNICALL
  47 Java_java_lang_Throwable_fillInStackTrace(JNIEnv *env, jobject throwable, int dummy)
  48 {
  49     JVM_FillInStackTrace(env, throwable);
  50     return throwable;
  51 }
  52 
  53 JNIEXPORT jint JNICALL
  54 Java_java_lang_Throwable_getStackTraceDepth(JNIEnv *env, jobject throwable)
  55 {
  56     return JVM_GetStackTraceDepth(env, throwable);
  57 }
  58 
  59 JNIEXPORT jobject JNICALL
  60 Java_java_lang_Throwable_getStackTraceElement(JNIEnv *env,
  61                                               jobject throwable, jint index)
  62 {
  63     return JVM_GetStackTraceElement(env, throwable, index);
  64 }