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