if (joffset < 0 || joffset > JavaDOMGlobals::javaMaxInt) { JavaDOMGlobals::ThrowException(env, "", NS_ERROR_DOM_INDEX_SIZE_ERR, JavaDOMGlobals::EXCEPTION_DOM); return NULL; }
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_TextImpl_splitText  (JNIEnv *env, jobject jthis, jint joffset){  nsIDOMText* text = (nsIDOMText*)     env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);  if (!text) {    JavaDOMGlobals::ThrowException(env,      "Text.splitText: NULL pointer");    return NULL;  }  nsIDOMText* ret = nsnull;  nsresult rv = text->SplitText((PRUint32) joffset, &ret);  if (NS_FAILED(rv) || !ret) {    JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;    if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&        (NS_ERROR_GET_CODE(rv) == NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR ||         NS_ERROR_GET_CODE(rv) == NS_ERROR_DOM_INDEX_SIZE_ERR)) {      exceptionType = JavaDOMGlobals::EXCEPTION_DOM;    }    JavaDOMGlobals::ThrowException(env,      "Text.splitText: failed", rv, exceptionType);    return NULL;  }  jobject jret = env->AllocObject(JavaDOMGlobals::textClass);  if (!jret) {    JavaDOMGlobals::ThrowException(env,      "Text.splitText: failed to allocate object");    return NULL;  }  env->SetLongField(jret, JavaDOMGlobals::nodePtrFID, (jlong) ret);  if (env->ExceptionOccurred()) {    JavaDOMGlobals::ThrowException(env,      "Text.splitText: failed to set node ptr");    return NULL;  }  ret->AddRef();  return jret;}