You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Jukka Zitting (JIRA)" <ji...@apache.org> on 2006/04/23 14:41:07 UTC

[jira] Resolved: (JCR-409) Safe namespace registration

     [ http://issues.apache.org/jira/browse/JCR-409?page=all ]
     
Jukka Zitting resolved JCR-409:
-------------------------------

    Fix Version: 1.1
     Resolution: Fixed

Added NamespaceRegistryImp.safeRegisterNamespace() and a test case in revision 396265.

> Safe namespace registration
> ---------------------------
>
>          Key: JCR-409
>          URL: http://issues.apache.org/jira/browse/JCR-409
>      Project: Jackrabbit
>         Type: New Feature

>   Components: namespace
>     Versions: 1.0, 0.9
>     Reporter: Jukka Zitting
>     Assignee: Jukka Zitting
>     Priority: Minor
>      Fix For: 1.1

>
> The namespace registration methods provided by the JCR NamespaceRegistry API are cumbersome to use and vulnerable to race conditions in the event of conflicting prefix mappings. This problem was discussed lately on the mailing list (see http://article.gmane.org/gmane.comp.apache.jackrabbit.devel/6805) and one symptom of the problem is the new code in NodeTypeManagerImpl (see JCR-349):
>     //  Registers a namespace...
>     try {
>         nsReg.getPrefix(uri);
>     } catch (NamespaceException e1) {
>         String original = prefix;
>         for (int i = 2; true; i++) {
>             try {
>                 nsReg.registerNamespace(prefix, uri);
>                 return;
>             } catch (NamespaceException e2) {
>                 prefix = original + i;
>             }
>         }
>     }
> We should add an internal convenience method like NamespaceRegistryImpl.safeRegisterNamespace(String prefixHint, String uri) that, instead of throwing an exception, would automatically generate and use a unique prefix based on the given hint when a prefix conflict is detected.

-- 
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