jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1374999 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: PropertyImpl.java value/ValueFactoryImpl.java
Date Mon, 20 Aug 2012 12:53:50 GMT
Author: reschke
Date: Mon Aug 20 12:53:49 2012
New Revision: 1374999

URL: http://svn.apache.org/viewvc?rev=1374999&view=rev
Log:
OAK-23: additional fixes for identifier property values

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java?rev=1374999&r1=1374998&r2=1374999&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
Mon Aug 20 12:53:49 2012
@@ -462,10 +462,17 @@ public class PropertyImpl extends ItemIm
                     case PropertyType.PATH:
                     case PropertyType.NAME:
                         String path = value.getString();
-                        try {
-                            return (path.charAt(0) == '/') ? getSession().getNode(path) :
getParent().getNode(path);
-                        } catch (PathNotFoundException e) {
-                            throw new ItemNotFoundException(path);
+                        if (path.startsWith("[") && path.endsWith("]")) {
+                            // identifier path
+                            String identifier = path.substring(1, path.length() - 1);
+                            return getSession().getNodeByIdentifier(identifier);
+                        }
+                        else {
+                            try {
+                                return (path.charAt(0) == '/') ? getSession().getNode(path)
: getParent().getNode(path);
+                            } catch (PathNotFoundException e) {
+                                throw new ItemNotFoundException(path);
+                            }
                         }
 
                     case PropertyType.STRING:

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java?rev=1374999&r1=1374998&r2=1374999&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java
Mon Aug 20 12:53:49 2012
@@ -163,7 +163,12 @@ public class ValueFactoryImpl implements
                     break;
 
                 case PropertyType.PATH:
-                    String oakValue = namePathMapper.getOakPath(value);
+                    String oakValue = value;
+                    if (value.startsWith("[") && value.endsWith("]")) {
+                        // identifier path; do no change
+                    } else {
+                        oakValue = namePathMapper.getOakPath(value);
+                    }
                     if (oakValue == null) {
                         throw new ValueFormatException("Invalid path: " + value);
                     }



Mime
View raw message