jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting (JIRA)" <j...@apache.org>
Subject [jira] Created: (JCR-409) Safe namespace registration
Date Sun, 23 Apr 2006 08:36:06 GMT
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
 Assigned to: Jukka Zitting 
    Priority: Minor


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


Mime
View raw message