if (offset < 0 || offset > JavaDOMGlobals::javaMaxInt || count < 0 || count > JavaDOMGlobals::javaMaxInt) { JavaDOMGlobals::ThrowException(env, "", NS_ERROR_DOM_INDEX_SIZE_ERR, JavaDOMGlobals::EXCEPTION_DOM); return; }
JNIEXPORT void JNICALL Java_org_mozilla_dom_CharacterDataImpl_replaceData  (JNIEnv *env, jobject jthis, jint offset, jint count, jstring jvalue){  nsIDOMCharacterData* data = (nsIDOMCharacterData*)     env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);  if (!data) {    JavaDOMGlobals::ThrowException(env,        "CharacterData.replaceData: NULL pointer");    return;  }    jboolean iscopy = JNI_FALSE;  const char* value = env->GetStringUTFChars(jvalue, &iscopy);  if (!value) {    JavaDOMGlobals::ThrowException(env,        "CharacterData.replaceData: GetStringUTFChars failed");    return;  }  nsresult rv = data->ReplaceData((PRUint32) offset, (PRUint32) count, value);  if (iscopy == JNI_TRUE)    env->ReleaseStringUTFChars(jvalue, value);  if (NS_FAILED(rv)) {    JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;    if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&        (NS_ERROR_GET_CODE(rv) == NS_ERROR_DOM_INDEX_SIZE_ERR ||         NS_ERROR_GET_CODE(rv) == NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR)) {      exceptionType = JavaDOMGlobals::EXCEPTION_DOM;    }    JavaDOMGlobals::ThrowException(env,      "CharacterData.replaceData: failed", rv, exceptionType);    return;  }}