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