jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1419345 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/IdentityNameMapper.java
Date Mon, 10 Dec 2012 11:23:45 GMT
Author: jukka
Date: Mon Dec 10 11:23:44 2012
New Revision: 1419345

URL: http://svn.apache.org/viewvc?rev=1419345&view=rev
Log:
OAK-189: Swallowed exceptions

Correct handling of the {}name special case

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/IdentityNameMapper.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/IdentityNameMapper.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/IdentityNameMapper.java?rev=1419345&r1=1419344&r2=1419345&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/IdentityNameMapper.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/IdentityNameMapper.java
Mon Dec 10 11:23:44 2012
@@ -44,10 +44,12 @@ public class IdentityNameMapper implemen
     @Override @CheckForNull
     public String getOakName(String jcrName) {
         if (jcrName.startsWith("{")) { // Could it be an expanded name?
-            int colon = jcrName.indexOf(':');
-            int brace = jcrName.indexOf('}');
-            if (0 < colon && colon < brace) { // Yes, it looks like one
-                String uri = jcrName.substring(1, brace);
+            int brace = jcrName.indexOf('}', 1);
+            String uri = jcrName.substring(1, brace);
+            if (uri.isEmpty()) {
+                return jcrName.substring(2); // special case: {}name
+            } else if (uri.indexOf(':') != -1) {
+                // It's an expanded name, look up the namespace prefix
                 String name = jcrName.substring(brace + 1);
                 for (Map.Entry<String, String> entry
                         : Namespaces.getNamespaceMap(root).entrySet()) {



Mime
View raw message