Back to index

lightning-sunbird  0.9+nobinonly
Functions
ThrowNew_3.cpp File Reference
#include "JNIEnvTests.h"
#include "Exceptions.h"

Go to the source code of this file.

Functions

 JNI_OJIAPITest (JNIEnv_ThrowNew_3)

Function Documentation

JNI_OJIAPITest ( JNIEnv_ThrowNew_3  )

Definition at line 40 of file ThrowNew_3.cpp.

{
  GET_JNI_FOR_TEST

  jclass clazz = env->FindClass("Ljava/lang/ArrayIndexOutOfBoundsException;");
  jthrowable obj = (jthrowable)env->AllocObject(clazz);
  jint res = env->ThrowNew(clazz, NULL);
  env->ExceptionDescribe();
  jthrowable excep  = env->ExceptionOccurred();
  if((env->IsInstanceOf(excep, clazz)) && (res == 0)){
    printf("ArrayIndexOutOfBoundsException is thrown. It is correct!\n");
    return TestResult::PASS("ThrowNew(java.lang.ArrayIndexOutOfBoundsException, mess= NULL) returns correct value and thrown ArrayIndexOutOfBoundsException");
  }else{
    return TestResult::FAIL("ThrowNew(java.lang.ArrayIndexOutOfBoundsException, mess= NULL) does not thrown ArrayIndexOutOfBoundsException");
  }
}

Here is the call graph for this function: