You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Chetan Mehrotra <ch...@gmail.com> on 2015/09/14 11:47:44 UTC

JCR node name and non space whitespace chars like line break etc

Hi Team,

While looking into OAK-3395 it was realized that in Oak we allow node
name with non space whitespace chars like \t, \r etc. This is
currently causing problem in DocumentNodeStore logic (which can be
fixed).

However it might be better to prevent such node name to be created as
it can cause problem other. Specially when JR2 does not allow creation
of such node names [1]

So the question is

Should Oak allow node names with non space whitespace chars like \t, \r etc

Chetan Mehrotra
[1] https://github.com/apache/jackrabbit/blob/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java#L257

Re: JCR node name and non space whitespace chars like line break etc

Posted by Chetan Mehrotra <ch...@gmail.com>.
Opened OAK-3412 to track this issue.
Chetan Mehrotra


On Tue, Sep 15, 2015 at 3:24 PM, Julian Reschke <ju...@gmx.de> wrote:
> On 2015-09-15 10:03, Chetan Mehrotra wrote:
>>
>> If I change the code in Namespace#isValidLocalName to use
>> Character#isWhitespace then NameValidator starts objecting to node
>> names having non space whitespace chars. So looks like current impl
>> has a issue and we should fix it. But fixing it would be now a
>> backward incompatible change!
>>
>> Thoughts?
>> Chetan Mehrotra
>
>
> We should fix it in any case. It's compatible with the original code, and
> with Jackrabbit.
>
> Best regards, Julian

Re: JCR node name and non space whitespace chars like line break etc

Posted by Julian Reschke <ju...@gmx.de>.
On 2015-09-15 10:03, Chetan Mehrotra wrote:
> If I change the code in Namespace#isValidLocalName to use
> Character#isWhitespace then NameValidator starts objecting to node
> names having non space whitespace chars. So looks like current impl
> has a issue and we should fix it. But fixing it would be now a
> backward incompatible change!
>
> Thoughts?
> Chetan Mehrotra

We should fix it in any case. It's compatible with the original code, 
and with Jackrabbit.

Best regards, Julian

Re: JCR node name and non space whitespace chars like line break etc

Posted by Chetan Mehrotra <ch...@gmail.com>.
If I change the code in Namespace#isValidLocalName to use
Character#isWhitespace then NameValidator starts objecting to node
names having non space whitespace chars. So looks like current impl
has a issue and we should fix it. But fixing it would be now a
backward incompatible change!

Thoughts?
Chetan Mehrotra


On Mon, Sep 14, 2015 at 4:13 PM, Chetan Mehrotra
<ch...@gmail.com> wrote:
> Micheal Durig mentioned that this has been discussed earlier.  So
> going back in time this was discussed in OAK-1891 and thread [1]. Oak
> used to prevent such nodes from getting created earlier but that logic
> was changed as part of OAK-1174 and r1582804 [0] and check was moved
> to NameValidator class (see Namespace#isValidLocalName).
>
> However when that change was done the check initially used
> Character#isWhitespace and switched to using Character#isSpaceChar
> which is limited to very few checks. Now looks like isSpaceChar is
> returning false for '\n', '\r' etc not sure why.
>
> Chetan Mehrotra
> [0] https://github.com/apache/jackrabbit-oak/commit/342809f7f04221782ca6bbfbde9392ec4ff441c2
>
> [1] http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201406.mbox/%3CCAB+dfin-smO5EGc-M2ma_WwhaR8eMe+cZwwdoB1wJuvEJ+n7Mg@mail.gmail.com%3E
>
>
> On Mon, Sep 14, 2015 at 3:28 PM, Michael Marth <mm...@adobe.com> wrote:
>> Hi Chetan,
>>
>> Given that JR2 did not allow those characters I see no good reason why Oak should.
>>
>> my2c
>> Michael
>>
>>
>>
>>
>> On 14/09/15 11:47, "Chetan Mehrotra" <ch...@gmail.com> wrote:
>>
>>>Hi Team,
>>>
>>>While looking into OAK-3395 it was realized that in Oak we allow node
>>>name with non space whitespace chars like \t, \r etc. This is
>>>currently causing problem in DocumentNodeStore logic (which can be
>>>fixed).
>>>
>>>However it might be better to prevent such node name to be created as
>>>it can cause problem other. Specially when JR2 does not allow creation
>>>of such node names [1]
>>>
>>>So the question is
>>>
>>>Should Oak allow node names with non space whitespace chars like \t, \r etc
>>>
>>>Chetan Mehrotra
>>>[1] https://github.com/apache/jackrabbit/blob/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java#L257

Re: JCR node name and non space whitespace chars like line break etc

Posted by Chetan Mehrotra <ch...@gmail.com>.
Micheal Durig mentioned that this has been discussed earlier.  So
going back in time this was discussed in OAK-1891 and thread [1]. Oak
used to prevent such nodes from getting created earlier but that logic
was changed as part of OAK-1174 and r1582804 [0] and check was moved
to NameValidator class (see Namespace#isValidLocalName).

However when that change was done the check initially used
Character#isWhitespace and switched to using Character#isSpaceChar
which is limited to very few checks. Now looks like isSpaceChar is
returning false for '\n', '\r' etc not sure why.

Chetan Mehrotra
[0] https://github.com/apache/jackrabbit-oak/commit/342809f7f04221782ca6bbfbde9392ec4ff441c2

[1] http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201406.mbox/%3CCAB+dfin-smO5EGc-M2ma_WwhaR8eMe+cZwwdoB1wJuvEJ+n7Mg@mail.gmail.com%3E


On Mon, Sep 14, 2015 at 3:28 PM, Michael Marth <mm...@adobe.com> wrote:
> Hi Chetan,
>
> Given that JR2 did not allow those characters I see no good reason why Oak should.
>
> my2c
> Michael
>
>
>
>
> On 14/09/15 11:47, "Chetan Mehrotra" <ch...@gmail.com> wrote:
>
>>Hi Team,
>>
>>While looking into OAK-3395 it was realized that in Oak we allow node
>>name with non space whitespace chars like \t, \r etc. This is
>>currently causing problem in DocumentNodeStore logic (which can be
>>fixed).
>>
>>However it might be better to prevent such node name to be created as
>>it can cause problem other. Specially when JR2 does not allow creation
>>of such node names [1]
>>
>>So the question is
>>
>>Should Oak allow node names with non space whitespace chars like \t, \r etc
>>
>>Chetan Mehrotra
>>[1] https://github.com/apache/jackrabbit/blob/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java#L257

Re: JCR node name and non space whitespace chars like line break etc

Posted by Michael Marth <mm...@adobe.com>.
Hi Chetan,

Given that JR2 did not allow those characters I see no good reason why Oak should.

my2c
Michael




On 14/09/15 11:47, "Chetan Mehrotra" <ch...@gmail.com> wrote:

>Hi Team,
>
>While looking into OAK-3395 it was realized that in Oak we allow node
>name with non space whitespace chars like \t, \r etc. This is
>currently causing problem in DocumentNodeStore logic (which can be
>fixed).
>
>However it might be better to prevent such node name to be created as
>it can cause problem other. Specially when JR2 does not allow creation
>of such node names [1]
>
>So the question is
>
>Should Oak allow node names with non space whitespace chars like \t, \r etc
>
>Chetan Mehrotra
>[1] https://github.com/apache/jackrabbit/blob/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java#L257