vtkJavaUtils needs NULL checking
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
a number of functions in vtkJavaUtils need to check input parameters for NULL. for instance, the beginning of vtkJavaUTFToChar should look like this:
JNIEXPORT char *vtkJavaUTFToChar(JNIEnv *env, jstring in) { char *result; const char *inBytes; int length, i; int resultLength = 1;
if( in == NULL ) return NULL;
length = env->GetStringUTFLength(in); inBytes = env->GetStringUTFChars(in,NULL);
vtkJavaGetId should check for null input 'obj'. it's not clear to me what should be returned for the id in that case. the bug here is that the input to env->GetObjectClass must not be null.
vtkJavaSetId should probably just return if the input 'obj' is null.
it looks like the vtkJavaMakeJArray* series of functions are okay with input of a null array and a length of zero. something bad probably happens on a null array and a non-zero length (the input array "ptr" is read later in the function).
(this probably has some implication for the java-wrapped code, where null tests aren't performed).