Back to index

lightning-sunbird  0.9+nobinonly
SetIntArrayRegion_4.cpp File Reference
#include "JNIEnvTests.h"
#include "ArrayOperations.h"

Go to the source code of this file.


 JNI_OJIAPITest (JNIEnv_SetIntArrayRegion_4)

Function Documentation

JNI_OJIAPITest ( JNIEnv_SetIntArrayRegion_4  )

Definition at line 40 of file SetIntArrayRegion_4.cpp.


  jintArray arr = env->NewIntArray(3);
  jsize start = -1;
  jsize leng = 3;
  jint buf[3];
  buf[0] = MAX_JINT;
  buf[1] = MIN_JINT;
  buf[2] = 0;
  jclass clazz = env->FindClass("Ljava/lang/ArrayIndexOutOfBoundsException;");
  env->SetIntArrayRegion(arr, start, leng, buf);
  jthrowable excep  = env->ExceptionOccurred();
  if(env->IsInstanceOf(excep, clazz)){
    printf("ArrayIndexOutOfBoundsException is thrown. It is correct!\n");
    return TestResult::PASS("SetIntArrayRegion(where start is -1) returns correct value");
    return TestResult::FAIL("SetIntArrayRegion(where start is -1) does not thrown ArrayIndexOutOfBoundsException");

Here is the call graph for this function: