Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 48097 invoked from network); 24 Nov 2006 08:44:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Nov 2006 08:44:28 -0000 Received: (qmail 57038 invoked by uid 500); 24 Nov 2006 08:44:37 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 56678 invoked by uid 500); 24 Nov 2006 08:44:36 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 56669 invoked by uid 99); 24 Nov 2006 08:44:36 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Nov 2006 00:44:36 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Nov 2006 00:44:26 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id EE79071429F for ; Fri, 24 Nov 2006 00:44:05 -0800 (PST) Message-ID: <33285796.1164357845946.JavaMail.jira@brutus> Date: Fri, 24 Nov 2006 00:44:05 -0800 (PST) From: "Jukka Zitting (JIRA)" To: dev@jackrabbit.apache.org Subject: [jira] Commented: (JCR-644) Node.isNodeType() throws if namespace is not defined. In-Reply-To: <6812970.1164296704707.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ http://issues.apache.org/jira/browse/JCR-644?page=comments#action_12452391 ] Jukka Zitting commented on JCR-644: ----------------------------------- > I think that the would initially setup his namespaces to be mapped on a session basis to > whatever makes sense for the application and then use literals throughout the application. > [...] > With respect to the isNodeType() I would then expect it to fail without an exeception > specific to the unknown prefix The client should have received a NamespaceException already when trying to setup the "foo" prefix in this case, so I still think it's good form to throw an exception from isNodeType() when encountering an unknown prefix. > I guess from an application perspective I would even assume a getItem("/unknownprefix:bar") > to throw a PathNotFoundException. Without a preceding Session.setNamespacePrefix() call the repository has no way of knowing which namespace the client is referring to with "unknownprefix". There could well be a node "/{SomeNamespace}bar" that the client actually was trying to locate. If the method call allowed a full namespace, then I think a PathNotFoundException would be appropriate (much like I originally proposed in JCR-472 for invalid UUID strings), but since the repository can't tell what the client is really referring to, throwing a NamespaceException (or a more generic RepositoryException) is IMHO the right thing to do. > basically i think that a client that does not map its namespaces on a per session basis is broken. > From my perspective I would assume that once the namespaces are mapped, I would like to work > in my application code using "static/hardwired"-prefixes only. I think that this makes the code much > more readable. Agreed, and this actually avoids the whole problem here. Unfortunately the JSR 170 Session.setNamespacePrefix() is rather limited, making correct namespace remapping a rather complex process. Thus I believe that many applications simply assume a static set of namespace mappings and leave the details up to the administrator. JSR 283 is addressing this issue. > Node.isNodeType() throws if namespace is not defined. > ----------------------------------------------------- > > Key: JCR-644 > URL: http://issues.apache.org/jira/browse/JCR-644 > Project: Jackrabbit > Issue Type: Bug > Components: nodetype > Affects Versions: 1.0, 1.0.1, 1.1, 0.9 > Reporter: Tobias Bocanegra > Assigned To: Tobias Bocanegra > > eg: node.isNodeType("foo:MyNodeType") > throws an exception if 'foo' is not defined. this is incorrect since an application should not need to check if the namespace exists before checking for a nodetype. it should return false. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira