jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r397939 - /jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
Date Fri, 28 Apr 2006 16:02:17 GMT
Author: angela
Date: Fri Apr 28 09:02:15 2006
New Revision: 397939

URL: http://svn.apache.org/viewcvs?rev=397939&view=rev
Log:
use prefix/uri of EMPTY_NAMESPACE constant instead of ""

Modified:
    jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java

Modified: jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java?rev=397939&r1=397938&r2=397939&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
(original)
+++ jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
Fri Apr 28 09:02:15 2006
@@ -922,25 +922,26 @@
     private String getJcrName(DavPropertyName propName) throws RepositoryException {
         // remove any encoding necessary for xml compliance
         String pName = ISO9075.decode(propName.getName());
-        String uri = propName.getNamespace().getURI();
-        if (uri != null && !"".equals(uri)) {
+        Namespace propNamespace = propName.getNamespace();
+        if (!Namespace.EMPTY_NAMESPACE.equals(propNamespace)) {
             Session s = getJcrSession();
             String prefix;
+            String emptyPrefix = Namespace.EMPTY_NAMESPACE.getPrefix();
             try {
                 // lookup 'prefix' in the session-ns-mappings / namespace-registry
-                prefix = s.getNamespacePrefix(uri);
+                prefix = s.getNamespacePrefix(propNamespace.getURI());
             } catch (NamespaceException e) {
                 // namespace uri has not been registered yet
                 NamespaceRegistry nsReg = s.getWorkspace().getNamespaceRegistry();
-                prefix = propName.getNamespace().getPrefix();
+                prefix = propNamespace.getPrefix();
                 // avoid trouble with default namespace
-                if (prefix == null || "".equals(prefix)) {
+                if (emptyPrefix.equals(prefix)) {
                     prefix = "_pre" + nsReg.getPrefixes().length + 1;
                 }
                 // NOTE: will fail if prefix is already in use in the namespace registry
-                nsReg.registerNamespace(prefix, uri);
+                nsReg.registerNamespace(prefix, propNamespace.getURI());
             }
-            if (prefix != null && !"".equals(prefix)) {
+            if (prefix != null && !emptyPrefix.equals(prefix)) {
                 pName = prefix + ":" + pName;
             }
         }



Mime
View raw message