const char* data = env->GetStringUTFChars(jdata, &iscopy); if (!data) { JavaDOMGlobals::ThrowException(env, "Document.createComment: GetStringUTFChars failed"); return NULL;
if (jdata) { data = env->GetStringUTFChars(jdata, &iscopy); if (!data) { JavaDOMGlobals::ThrowException(env, "Document.createComment: GetStringUTFChars failed"); return NULL; }
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_DocumentImpl_createComment  (JNIEnv *env, jobject jthis, jstring jdata){  nsIDOMDocument* doc = (nsIDOMDocument*)     env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);  if (!doc) {    JavaDOMGlobals::ThrowException(env,      "Document.createComment: NULL pointer");    return NULL;  }  nsIDOMComment* ret = nsnull;  jboolean iscopy = JNI_FALSE;  const char* data = env->GetStringUTFChars(jdata, &iscopy);  if (!data) {    JavaDOMGlobals::ThrowException(env,      "Document.createComment: GetStringUTFChars failed");    return NULL;  }  nsresult rv = doc->CreateComment(data, &ret);  if (iscopy == JNI_TRUE)    env->ReleaseStringUTFChars(jdata, data);  if (NS_FAILED(rv) || !ret) {    JavaDOMGlobals::ThrowException(env,      "Document.createComment: failed", rv);    return NULL;  }  jobject jret = env->AllocObject(JavaDOMGlobals::commentClass);  if (!jret) {    JavaDOMGlobals::ThrowException(env,      "Document.createComment: failed to allocate object");    return NULL;  }  env->SetLongField(jret, JavaDOMGlobals::nodePtrFID, (jlong) ret);  if (env->ExceptionOccurred()) {    JavaDOMGlobals::ThrowException(env,      "Document.createComment: failed to set node ptr");    return NULL;  }  ret->AddRef();  return jret;}