jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r385512 - /incubator/jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/property/NamespacesProperty.java
Date Mon, 13 Mar 2006 11:14:49 GMT
Author: angela
Date: Mon Mar 13 03:14:45 2006
New Revision: 385512

URL: http://svn.apache.org/viewcvs?rev=385512&view=rev
Log:
minor improvement

Modified:
    incubator/jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/property/NamespacesProperty.java

Modified: incubator/jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/property/NamespacesProperty.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/property/NamespacesProperty.java?rev=385512&r1=385511&r2=385512&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/property/NamespacesProperty.java
(original)
+++ incubator/jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/property/NamespacesProperty.java
Mon Mar 13 03:14:45 2006
@@ -39,17 +39,23 @@
 
     private static Logger log = Logger.getLogger(NamespacesProperty.class);
 
-    private final Properties value;
+    private final Properties value = new Properties();
 
     public NamespacesProperty(NamespaceRegistry nsReg) throws RepositoryException {
         super(JCR_NAMESPACES, false);
-        String[] prefixes = nsReg.getPrefixes();
-        value = new Properties();
-        for (int i = 0; i < prefixes.length; i++) {
-            value.setProperty(prefixes[i], nsReg.getURI(prefixes[i]));
+        if (nsReg != null) {
+            String[] prefixes = nsReg.getPrefixes();
+            for (int i = 0; i < prefixes.length; i++) {
+                value.setProperty(prefixes[i], nsReg.getURI(prefixes[i]));
+            }
         }
     }
 
+    public NamespacesProperty(Properties namespaces) {
+        super(JCR_NAMESPACES, false);
+        value.putAll(namespaces);
+    }
+
     public NamespacesProperty(DavProperty property) throws DavException {
         super(JCR_NAMESPACES, false);
         Object v = property.getValue();
@@ -57,7 +63,6 @@
             log.warn("Unexpected structure of dcr:namespace property.");
             throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR);
         }
-        value = new Properties();
         // retrieve list of prefix/uri pairs that build the new values of
         // the ns-registry
         Iterator it = ((List)v).iterator();



Mime
View raw message