env = VM_Thread.getCurrentThread().getJNIEnv(); Object sourceArray[] = (Object []) env.getJNIRef(arrayJREF); Object elem = (Object) env.getJNIRef(objectJREF);  if (sourceArray==null) return;  VM_Array arrayType = VM_Magic.getObjectType(sourceArray).asArray();  if (VM_Magic.getObjectType(elem) != arrayType.getElementType()) { env.recordException(new ArrayStoreException()); return; }  if (index >= VM_Magic.getArrayLength(sourceArray)) { env.recordException(new ArrayIndexOutOfBoundsException()); return; }  sourceArray[index] = elem;  } catch (Throwable unexpected) { env = VM_Thread.getCurrentThread().getJNIEnv(); env.recordException(unexpected); return;
env = VM_Thread.getCurrentThread().getJNIEnv();  Object sourceArray[] = (Object []) env.getJNIRef(arrayJREF); Object elem = (Object) env.getJNIRef(objectJREF);   sourceArray[index] = elem;  } catch (Throwable e) { env.recordException(e); return;
  private static void SetObjectArrayElement(int envJREF, int arrayJREF, int index,                                            int objectJREF) {    if (traceJNI) VM.sysWrite("JNI called: SetObjectArrayElement  \n");    VM_JNIEnvironment env;    try {      env = VM_Thread.getCurrentThread().getJNIEnv();      Object sourceArray[] = (Object []) env.getJNIRef(arrayJREF);      Object elem = (Object) env.getJNIRef(objectJREF);      if (sourceArray==null)        return;      VM_Array arrayType = VM_Magic.getObjectType(sourceArray).asArray();      if (VM_Magic.getObjectType(elem) != arrayType.getElementType()) {        env.recordException(new ArrayStoreException());        return;      }      if (index >= VM_Magic.getArrayLength(sourceArray)) {        env.recordException(new ArrayIndexOutOfBoundsException());        return;      }      sourceArray[index] = elem;    } catch (Throwable unexpected) {      env = VM_Thread.getCurrentThread().getJNIEnv();      env.recordException(unexpected);      return;    }  }