jobject jnode = env->AllocObject(JavaDOMGlobals::nodeClass); if (!jnode) { JavaDOMGlobals::ThrowException(env, "NamedNodeMap.removeNamedItem: failed to allocate object"); return NULL; }  env->SetLongField(jnode, JavaDOMGlobals::nodePtrFID, (jlong) node); if (env->ExceptionOccurred()) { JavaDOMGlobals::ThrowException(env, "NamedNodeMap.removeNamedItem: failed to set node ptr"); return NULL; }  node->AddRef(); return jnode;
return JavaDOMGlobals::CreateNodeSubtype(env, node);
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NamedNodeMapImpl_removeNamedItem  (JNIEnv *env, jobject jthis, jstring jname){  nsIDOMNamedNodeMap* map = (nsIDOMNamedNodeMap*)     env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);  if (!map) {    JavaDOMGlobals::ThrowException(env,      "NodeMap.removeNamedItem: NULL pointer");    return NULL;  }    nsIDOMNode* node = nsnull;  jboolean iscopy = JNI_FALSE;  const char* name = env->GetStringUTFChars(jname, &iscopy);  if (!name) {    JavaDOMGlobals::ThrowException(env,      "NamedNodeMap.removeNamedItem: GetStringUTFChars failed");    return NULL;  }  nsresult rv = map->RemoveNamedItem(name, &node);  if (iscopy == JNI_TRUE)    env->ReleaseStringUTFChars(jname, name);  if (NS_FAILED(rv) || !node) {    JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;    if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&        NS_ERROR_GET_CODE(rv) == NS_ERROR_DOM_NOT_FOUND_ERR) {      exceptionType = JavaDOMGlobals::EXCEPTION_DOM;    }    JavaDOMGlobals::ThrowException(env,      "NodeMap.removeNamedItem: failed", rv, exceptionType);    return NULL;  }  jobject jnode = env->AllocObject(JavaDOMGlobals::nodeClass);  if (!jnode) {    JavaDOMGlobals::ThrowException(env,      "NamedNodeMap.removeNamedItem: failed to allocate object");    return NULL;  }  env->SetLongField(jnode, JavaDOMGlobals::nodePtrFID, (jlong) node);  if (env->ExceptionOccurred()) {    JavaDOMGlobals::ThrowException(env,      "NamedNodeMap.removeNamedItem: failed to set node ptr");    return NULL;  }  node->AddRef();  return jnode;}