jobject jnode = env->AllocObject(JavaDOMGlobals::nodeClass); if (!jnode) { JavaDOMGlobals::ThrowException(env, "NodeMap.item: failed to allocate object"); return NULL; }  env->SetLongField(jnode, JavaDOMGlobals::nodePtrFID, (jlong) node); if (env->ExceptionOccurred()) { JavaDOMGlobals::ThrowException(env, "NamedNodeMap.item: failed to set node ptr"); return NULL; }  node->AddRef(); return jnode;
return JavaDOMGlobals::CreateNodeSubtype(env, node);
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NamedNodeMapImpl_item  (JNIEnv *env, jobject jthis, jint jindex){  nsIDOMNamedNodeMap* map = (nsIDOMNamedNodeMap*)     env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);  if (!map) {    JavaDOMGlobals::ThrowException(env,      "NodeMap.item: NULL pointer");    return NULL;  }    nsIDOMNode* node = nsnull;  nsresult rv = map->Item((PRUint32) jindex, &node);  if (NS_FAILED(rv) || !node) {    JavaDOMGlobals::ThrowException(env,      "NodeMap.item: failed", rv);    return NULL;  }  jobject jnode = env->AllocObject(JavaDOMGlobals::nodeClass);  if (!jnode) {    JavaDOMGlobals::ThrowException(env,      "NodeMap.item: failed to allocate object");    return NULL;  }  env->SetLongField(jnode, JavaDOMGlobals::nodePtrFID, (jlong) node);  if (env->ExceptionOccurred()) {    JavaDOMGlobals::ThrowException(env,      "NamedNodeMap.item: failed to set node ptr");    return NULL;  }  node->AddRef();  return jnode;}