You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Michael Dürig <md...@apache.org> on 2012/09/07 00:35:33 UTC

JSR-283: character case mismatch between property type names and node type definitions

Hi,

While working on property value constraints I stumbled on the following:

[nt:propertyDefinition]
   ...
- jcr:requiredType (STRING) protected mandatory
     < 'STRING', 'URI', 'BINARY', 'LONG', 'DOUBLE',
       'DECIMAL', 'BOOLEAN', 'DATE', 'NAME', 'PATH',
       'REFERENCE', 'WEAKREFERENCE', 'UNDEFINED'

The type names are defined in javax.jcr.PropertyType. For example

TYPENAME_STRING = "String";

Now JSR-283 says about string constraints (3.7.3.6.1): "For STRING and 
URI properties, the constraint string is a regular expression pattern 
according to the syntax of java.util.regex.Pattern."

So jcr:requiredType can be for example "STRING" but not "String". The 
former however results in an IllegalArgumentException when passed to 
PropertyType.valueFromName().

Michael





Re: JSR-283: character case mismatch between property type names and node type definitions

Posted by Julian Reschke <ju...@gmx.de>.
On 2012-09-07 11:01, Michael Dürig wrote:
>
>
> On 7.9.12 9:50, Julian Reschke wrote:
>> On 2012-09-07 00:35, Michael Dürig wrote:
>>>
>>> Hi,
>>>
>>> While working on property value constraints I stumbled on the following:
>>>
>>> [nt:propertyDefinition]
>>>    ...
>>> - jcr:requiredType (STRING) protected mandatory
>>>      < 'STRING', 'URI', 'BINARY', 'LONG', 'DOUBLE',
>>>        'DECIMAL', 'BOOLEAN', 'DATE', 'NAME', 'PATH',
>>>        'REFERENCE', 'WEAKREFERENCE', 'UNDEFINED'
>>>
>>> The type names are defined in javax.jcr.PropertyType. For example
>>>
>>> TYPENAME_STRING = "String";
>>>
>>> Now JSR-283 says about string constraints (3.7.3.6.1): "For STRING and
>>> URI properties, the constraint string is a regular expression pattern
>>> according to the syntax of java.util.regex.Pattern."
>>>
>>> So jcr:requiredType can be for example "STRING" but not "String". The
>>> former however results in an IllegalArgumentException when passed to
>>> PropertyType.valueFromName().
>>> ...
>>
>> That looks like a spec inconsistency to me.
>>
>> It appears the simplest way to fix this would be to change predefined
>> values in nt:propertyDefinition.
>>
>> Open a JSR-333 bug?
>
> Yes I think so. And while we are at it, there is potentially a similar
> problem with jcr:onParentVersion. But that needs checking.
>
> Michael
> ...

For now, I have opened

   http://java.net/jira/browse/JSR_283-811

Best regards, Julian

Re: JSR-283: character case mismatch between property type names and node type definitions

Posted by Michael Dürig <md...@apache.org>.

On 7.9.12 9:50, Julian Reschke wrote:
> On 2012-09-07 00:35, Michael Dürig wrote:
>>
>> Hi,
>>
>> While working on property value constraints I stumbled on the following:
>>
>> [nt:propertyDefinition]
>>    ...
>> - jcr:requiredType (STRING) protected mandatory
>>      < 'STRING', 'URI', 'BINARY', 'LONG', 'DOUBLE',
>>        'DECIMAL', 'BOOLEAN', 'DATE', 'NAME', 'PATH',
>>        'REFERENCE', 'WEAKREFERENCE', 'UNDEFINED'
>>
>> The type names are defined in javax.jcr.PropertyType. For example
>>
>> TYPENAME_STRING = "String";
>>
>> Now JSR-283 says about string constraints (3.7.3.6.1): "For STRING and
>> URI properties, the constraint string is a regular expression pattern
>> according to the syntax of java.util.regex.Pattern."
>>
>> So jcr:requiredType can be for example "STRING" but not "String". The
>> former however results in an IllegalArgumentException when passed to
>> PropertyType.valueFromName().
>> ...
>
> That looks like a spec inconsistency to me.
>
> It appears the simplest way to fix this would be to change predefined
> values in nt:propertyDefinition.
>
> Open a JSR-333 bug?

Yes I think so. And while we are at it, there is potentially a similar 
problem with jcr:onParentVersion. But that needs checking.

Michael

>
> Best regards, Julian

Re: JSR-283: character case mismatch between property type names and node type definitions

Posted by Julian Reschke <ju...@gmx.de>.
On 2012-09-07 00:35, Michael Dürig wrote:
>
> Hi,
>
> While working on property value constraints I stumbled on the following:
>
> [nt:propertyDefinition]
>    ...
> - jcr:requiredType (STRING) protected mandatory
>      < 'STRING', 'URI', 'BINARY', 'LONG', 'DOUBLE',
>        'DECIMAL', 'BOOLEAN', 'DATE', 'NAME', 'PATH',
>        'REFERENCE', 'WEAKREFERENCE', 'UNDEFINED'
>
> The type names are defined in javax.jcr.PropertyType. For example
>
> TYPENAME_STRING = "String";
>
> Now JSR-283 says about string constraints (3.7.3.6.1): "For STRING and
> URI properties, the constraint string is a regular expression pattern
> according to the syntax of java.util.regex.Pattern."
>
> So jcr:requiredType can be for example "STRING" but not "String". The
> former however results in an IllegalArgumentException when passed to
> PropertyType.valueFromName().
> ...

That looks like a spec inconsistency to me.

It appears the simplest way to fix this would be to change predefined 
values in nt:propertyDefinition.

Open a JSR-333 bug?

Best regards, Julian

Re: JSR-283: character case mismatch between property type names and node type definitions

Posted by Thomas Mueller <mu...@adobe.com>.
Hi,

I have the same 'character case mismatch' problem in the Query Engine,
where the syntax is:

CAST(x AS STRING)

The same problem arises with the newly introduced syntax PROPERTY(..,
'REFERENCE'). What I did was write a case insensitive version of
PropertyType.valueFromName. If it's in oak-core, I guess we should share
the code. What package / class to you propose we should use?

Regards,
Thomas


On 9/7/12 12:35 AM, "Michael Dürig" <md...@apache.org> wrote:

>
>Hi,
>
>While working on property value constraints I stumbled on the following:
>
>[nt:propertyDefinition]
>   ...
>- jcr:requiredType (STRING) protected mandatory
>     < 'STRING', 'URI', 'BINARY', 'LONG', 'DOUBLE',
>       'DECIMAL', 'BOOLEAN', 'DATE', 'NAME', 'PATH',
>       'REFERENCE', 'WEAKREFERENCE', 'UNDEFINED'
>
>The type names are defined in javax.jcr.PropertyType. For example
>
>TYPENAME_STRING = "String";
>
>Now JSR-283 says about string constraints (3.7.3.6.1): "For STRING and
>URI properties, the constraint string is a regular expression pattern
>according to the syntax of java.util.regex.Pattern."
>
>So jcr:requiredType can be for example "STRING" but not "String". The
>former however results in an IllegalArgumentException when passed to
>PropertyType.valueFromName().
>
>Michael
>
>
>
>