jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1463951 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/LocalNameMapper.java
Date Wed, 03 Apr 2013 12:06:25 GMT
Author: jukka
Date: Wed Apr  3 12:06:25 2013
New Revision: 1463951

URL: http://svn.apache.org/r1463951
Log:
OAK-509: Item names starting with '{X}' cause RepositoryException

Make the assertion use the correct rule for expanded names. Thanks, Michi!

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

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/LocalNameMapper.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/LocalNameMapper.java?rev=1463951&r1=1463950&r2=1463951&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/LocalNameMapper.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/LocalNameMapper.java
Wed Apr  3 12:06:25 2013
@@ -28,11 +28,20 @@ import javax.annotation.CheckForNull;
  */
 public abstract class LocalNameMapper extends GlobalNameMapper {
 
+    private static boolean isExpandedName(String name) {
+        if (name.startsWith("{")) {
+            int brace = name.indexOf('}', 1);
+            return brace != -1 && name.substring(1, brace).indexOf(':') != -1;
+        } else {
+            return false;
+        }
+    }
+
     @Override @CheckForNull
     public String getJcrName(String oakName) {
         checkNotNull(oakName);
         checkArgument(!oakName.startsWith(":")); // hidden name
-        checkArgument(!oakName.startsWith("{")); // expanded name
+        checkArgument(isExpandedName(oakName));  // expanded name
 
         if (hasSessionLocalMappings()) {
             int colon = oakName.indexOf(':');



Mime
View raw message