Back to index

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

Go to the source code of this file.


 JNI_OJIAPITest (JNIEnv_NewObjectArray_5)

Function Documentation

JNI_OJIAPITest ( JNIEnv_NewObjectArray_5  )

Definition at line 40 of file NewObjectArray_5.cpp.

  jclass clazz = env->FindClass("Ljava/lang/String;");
  jclass clazz_incor = env->FindClass("Test1");
  jmethodID methodID = env->GetMethodID(clazz_incor, "<init>", "(Ljava/lang/String;)V");
  jobject obj_incor = env->NewObject(clazz_incor, methodID, NULL);
  jobject obj = env->AllocObject(clazz);

  jarray arr = env->NewObjectArray(5, clazz, obj_incor);

  if(arr != NULL){ //NULL is returned only if OutOfMemoryException is thrown
     return TestResult::PASS("NewObjectArray(obj is incorrect) returns correct value");
     return TestResult::FAIL("NewObjectArray(obj is incorrect) returns incorrect value");


Here is the call graph for this function: