You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Steeg Werkmans <we...@gmail.com> on 2012/04/24 18:26:04 UTC

CND notation: default values don't seem to work for unquoted string?

All,

I 'm wondering why the CND notation specs,
http://jackrabbit.apache.org/node-type-notation.html, says you can you
quoted and unquoted string for default values, but yet this leads to a
parsing expection when I programmatically import the CND file.

Here's is my cnd file that works:

<'demo'='http://www.iddi.com/demo/1.0'>
[demo:mynode]
> nt:base
- longField (LONG) = "0" MANDATORY



And here is one that doesn't:


<'demo'='http://www.iddi.com/demo/1.0'>
[demo:mynode]
> nt:base
- longField (LONG) = 0 MANDATORY


Relevant part of the stacktrace, should this be a bug and someone needs to
fix it. Btw the same error also occurs if I use CRX developers edition and
try to import custom nodes.


Caused by: org.apache.jackrabbit.commons.cnd.ParseException: Error adding
default value for numberOfSubjects to default value 0:
java.lang.NumberFormatException
: For input string: "default value 0" (cnd input stream, line 23)
        at org.apache.jackrabbit.commons.cnd.Lexer.fail(Lexer.java:209)
        at
org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.doPropertyDefaultValue(CompactNodeTypeDefReader.java:574)
        at
org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.doPropertyDefinition(CompactNodeTypeDefReader.java:409)
        at
org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.doItemDefs(CompactNodeTypeDefReader.java:362)
        at
org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.parse(CompactNodeTypeDefReader.java:214)
        at
org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.<init>(CompactNodeTypeDefReader.java:163)
        at
org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl.registerNodeTypes(NodeTypeManagerImpl.java:255)


My problem is solved by using the quoted string version. But it would be
nice to hear some feedback (I need more default values). And I worry for
the jackrabbit community that there are more things like this in the
parser. The string declaration in the CND notation syntax is quite heavily
used as you can imagine:

string ::= quoted_string | unquoted_string



Cheers,

Steeg