[ http://issues.apache.org/jira/browse/JCR-475?page=all ]
     
Tobias Bocanegra closed JCR-475:
--------------------------------

    Resolution: Invalid

the failing constraints is not a bug of the CNDReader. The JSR170 specification 
states:

6.7.16 Value Constraints:
[...]
The remaining types all have value constraints in the form of
inclusive or exclusive ranges: i.e., "[min, max]", "(min, max)",
"(min, max]" or "[min, max)". Where "[" and "]" indicate
"inclusive", while "(" and ")" indicate "exclusive". A missing min or
max value indicates no bound in that direction. For example [,5]
means no minimum but a maximum of 5 (inclusive) while [,]
means simply that any value will suffice. The meaning of the min
and max values themselves differ between types as follows:
• BINARY: min and max specify the allowed size range of the
  binary value in bytes.
• DATE: min and max are dates specifying the allowed date range.
  The date strings must be in the ISO 8601:2000-compliant
  format: sYYYY-MM-DDThh:mm:ss.sssTZD. See 6.2.5.1 Date.
• LONG, DOUBLE: min and max are numbers.
[...]

so you can't specify single values as constraints for numbers, only ranges. 
your definition sould read:

[cm:aclEntryNode] > nt:base
-cm:uid (string) mandatory copy
-cm:permission (long) mandatory multiple copy 
 < "[1,1]", "[2,2]", "[4,4]", "[8,8]", "[16,16]"

which is a bit silly, i agree :-) i will suggest to allow such contraints in 
the jsr283 (jcr 2.0)

btw: i agree, that there is a bug in the lexer that does not return number 
tokens correctly.

> CompactNodeTypeDefReader fails parsing 'long' value constraints
> ---------------------------------------------------------------
>
>          Key: JCR-475
>          URL: http://issues.apache.org/jira/browse/JCR-475
>      Project: Jackrabbit
>         Type: Bug

>     Reporter: Tobias Bocanegra
>      Fix For: 1.0, 1.1, 0.9

>
> [copied from email to user list]
> Hi,
> I got a ParseException when loading a CND file with
> CompactNodeTypeDefReader. The part of my CND file is listed below:
> [cm:aclEntryNode] > nt:base
> -cm:uid (string) mandatory copy
> -cm:permission (long) mandatory multiple copy
> <1,2,4,8,16
> The parsing code complained about the line of value constraints for property
> "cm:permission" with message "'?' is not a valid constraint expression for a
> value of type 3".
> I've been debugging through the source and it seems that the getNextToken()
> method is not handling TT_Number as expected.
> Did I miss anything? or is this a bug?
> Thanks,
> Dan
> Lexer.getNextToken() as below:
> public String getNextToken() throws ParseException {
>        try {
>            int tokenType = st.nextToken();
>            if (tokenType == StreamTokenizer.TT_EOF){
>                return EOF;
>            } else if(tokenType == StreamTokenizer.TT_WORD || tokenType ==
> SINGLE_QUOTE || tokenType == DOUBLE_QUOTE){
>                return st.sval;
>            } else {
>                return new String(new char[]{(char)tokenType});
>            }
>        } catch (IOException e){
>            fail("IOException while attempting to read input stream", e);
>            return null;
>        }
>    }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to