-
1. Re: jcr modeshape 3.2.0 getNodes by a name pattern
rhauch Oct 8, 2013 11:17 AM (in response to fazileh)That definitely is a bug - can you please log a bug in our JIRA? The problem may be in how the method you're calling, namely "getNodes( String nameGlobs)", tries to split the name globs on the '|' character. If that's the case, then a simple workaround would be to use the other form of the method that takes a String array:
root.getNodes( new String[]{"*[2]"} );
Let us know if that works.
UPDATE: See below for the resolution to this problem.
-
2. Re: jcr modeshape 3.2.0 getNodes by a name pattern
fazileh Oct 8, 2013 1:48 AM (in response to rhauch)Randall Hauch wrote:
- root.getNodes( new String[]{"*[2]"} );
This line throws an Exception: (javax.jcr.RepositoryException) javax.jcr.RepositoryException: The "*[2]" name pattern contained the '[' character, which is not allowed in a name pattern
-
4. Re: jcr modeshape 3.2.0 getNodes by a name pattern
fazileh Oct 8, 2013 2:59 AM (in response to hchiorean)Thank you.
I was involved in code. -
5. Re: jcr modeshape 3.2.0 getNodes by a name pattern
rhauch Oct 8, 2013 11:16 AM (in response to fazileh)The specification stipulates that only the node's names (which do not include the same-name-sibling index) are used to find a match with the "getNodes(...)" methods. Since node names themselves can contain characters such as '/', ':', '[', ']' and '|' only if they are escaped (see ModeShape's encode and decode methods), any pattern that uses these characters will never match any existing node.
To date, ModeShape would throw an exception if a name glob were created with such invalid characters, but this is actually not per the specification. Instead, ModeShape is expected to simply process the patterns without throwing an exception. This is what we will correct with MODE-2069 in 3.6.
Therefore, you cannot use a name glob to find nodes that have specific same-name-siblings.