You are viewing a plain text version of this content. The canonical link for it is here.
Posted to api@directory.apache.org by Radovan Semancik <ra...@evolveum.com> on 2015/02/06 16:17:17 UTC

Re: Client API Schema support

Hi,

After some delay I finally found a time to work on this. After few 
simple fixes I got to this:

java.text.ParseException: ERR_04243 Parser failure on matching rule 
description:
         ( 1.3.6.1.4.1.26027.1.4.6 NAME ( 'relativeTimeLTOrderingMatch' 
'relativeTimeOrderingMatch.lt' ) SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
Antlr message: unexpected token:
Antlr column: 33

  I'm quite new to antlr and I'm still tring to find my way around. But 
I'm sure that there is someone on the list that can save me a huge 
amount of time. I do not expect anyone to fix this for me ... but ... 
the grammar is not trivial and it is difficult to figure out what 
exactly is wrong. How do you usually debug the antlr rule? Is there any 
logging mode that can be turned on and which will dump the tokens and 
rules that antlr encoures? Or some other trick?

-- 

                                            Radovan Semancik
                                           Software Architect
                                              evolveum.com



On 01/27/2015 11:50 AM, Emmanuel Lécharny wrote:
> I have modified the DefaultSchemaLoader constructor to load the schema
> from teh rootDSE, even if it's not an ApacheDS server :
>
> http://svn.apache.org/r1655004
>
>
> There is a try...catch to deal with cases where what's in the rootDSE
> fails. This is most certainly the place where we want to add the code to
> try other approaches.
>
> At this point, I think we would like to have one module per server - if
> needed - when we have to use heavyly different code to read the schema,
> so that we can insolate each specific code. To be discussed further.



Re: Client API Schema support

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 06/02/15 16:17, Radovan Semancik a écrit :
> Hi,
>
> After some delay I finally found a time to work on this. After few
> simple fixes I got to this:
>
> java.text.ParseException: ERR_04243 Parser failure on matching rule
> description:
>         ( 1.3.6.1.4.1.26027.1.4.6 NAME ( 'relativeTimeLTOrderingMatch'
> 'relativeTimeOrderingMatch.lt' ) SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
> Antlr message: unexpected token:
> Antlr column: 33

Hmmm. What kind of object is it ? AttributeType ? If so, there must be
'attributetype' in from of the Struing, like in :

attributetype ( 1.3.6.1.4.1.26027.1.4.6 NAME (
'relativeTimeLTOrderingMatch' 'relativeTimeOrderingMatch.lt' ) SYNTAX
1.3.6.1.4.1.1466.115.121.1.24 )

>
>  I'm quite new to antlr and I'm still tring to find my way around. But
> I'm sure that there is someone on the list that can save me a huge
> amount of time. I do not expect anyone to fix this for me ... but ...
> the grammar is not trivial and it is difficult to figure out what
> exactly is wrong. How do you usually debug the antlr rule? 

> Is there any logging mode that can be turned on and which will dump
> the tokens and rules that antlr encoures? Or some other trick?
>
There is a trace mode, activated using -trace, or programatically,
calling setTrace( true ) on your java parser. It will trace a lot of
things, like the rules it enters in etc.


Re: Client API Schema support

Posted by Stefan Seelmann <ma...@stefan-seelmann.de>.
On 02/06/2015 10:35 PM, Stefan Seelmann wrote:
> On 02/06/2015 04:17 PM, Radovan Semancik wrote:
>> Hi,
>>
>> After some delay I finally found a time to work on this. After few
>> simple fixes I got to this:
>>
>> java.text.ParseException: ERR_04243 Parser failure on matching rule
>> description:
>>         ( 1.3.6.1.4.1.26027.1.4.6 NAME ( 'relativeTimeLTOrderingMatch'
>> 'relativeTimeOrderingMatch.lt' ) SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
>> Antlr message: unexpected token:
>> Antlr column: 33
>>
>>  I'm quite new to antlr and I'm still tring to find my way around. But
>> I'm sure that there is someone on the list that can save me a huge
>> amount of time. I do not expect anyone to fix this for me ... but ...
>> the grammar is not trivial and it is difficult to figure out what
>> exactly is wrong. How do you usually debug the antlr rule? Is there any
>> logging mode that can be turned on and which will dump the tokens and
>> rules that antlr encoures? Or some other trick?
> 
> Short answer: for all the schema parsers (in this case
> MatchingRuleDescriptionSchemaParser) enable the quirks mode with
> setQuirksMode(true). The 2nd name contains a dot which is not allowed
> according to RFC 4512, but the quirks mode relaxes that rule.
> 
> I don't think there is a way to dump the antlr state. In general you
> need to debug through the generated AntlrSchemaParser. Please look into
> MatchingRuleDescriptionSchemaParser line 99. There we catch the original
> exception thrown by antlr which contains the detailed stack trace,
> probably it's not good to swallow the original exception and stack trace.

Current trunk improves this a bit, the original exception is not added
as cause. But the error message is still not always very helpful...

Kind Regards,
Stefan




Re: Client API Schema support

Posted by Stefan Seelmann <ma...@stefan-seelmann.de>.
Resending

On 02/06/2015 10:35 PM, Stefan Seelmann wrote:
> On 02/06/2015 04:17 PM, Radovan Semancik wrote:
>> Hi,
>>
>> After some delay I finally found a time to work on this. After few
>> simple fixes I got to this:
>>
>> java.text.ParseException: ERR_04243 Parser failure on matching rule
>> description:
>>         ( 1.3.6.1.4.1.26027.1.4.6 NAME ( 'relativeTimeLTOrderingMatch'
>> 'relativeTimeOrderingMatch.lt' ) SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
>> Antlr message: unexpected token:
>> Antlr column: 33
>>
>>  I'm quite new to antlr and I'm still tring to find my way around. But
>> I'm sure that there is someone on the list that can save me a huge
>> amount of time. I do not expect anyone to fix this for me ... but ...
>> the grammar is not trivial and it is difficult to figure out what
>> exactly is wrong. How do you usually debug the antlr rule? Is there any
>> logging mode that can be turned on and which will dump the tokens and
>> rules that antlr encoures? Or some other trick?
> 
> Short answer: for all the schema parsers (in this case
> MatchingRuleDescriptionSchemaParser) enable the quirks mode with
> setQuirksMode(true). The 2nd name contains a dot which is not allowed
> according to RFC 4512, but the quirks mode relaxes that rule.
> 
> I don't think there is a way to dump the antlr state. In general you
> need to debug through the generated AntlrSchemaParser. Please look into
> MatchingRuleDescriptionSchemaParser line 99. There we catch the original
> exception thrown by antlr which contains the detailed stack trace,
> probably it's not good to swallow the original exception and stack trace.
> 
> Kind Regards,
> Stefan
> 


Re: Client API Schema support

Posted by Stefan Seelmann <ma...@stefan-seelmann.de>.
On 02/06/2015 04:17 PM, Radovan Semancik wrote:
> Hi,
> 
> After some delay I finally found a time to work on this. After few
> simple fixes I got to this:
> 
> java.text.ParseException: ERR_04243 Parser failure on matching rule
> description:
>         ( 1.3.6.1.4.1.26027.1.4.6 NAME ( 'relativeTimeLTOrderingMatch'
> 'relativeTimeOrderingMatch.lt' ) SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
> Antlr message: unexpected token:
> Antlr column: 33
> 
>  I'm quite new to antlr and I'm still tring to find my way around. But
> I'm sure that there is someone on the list that can save me a huge
> amount of time. I do not expect anyone to fix this for me ... but ...
> the grammar is not trivial and it is difficult to figure out what
> exactly is wrong. How do you usually debug the antlr rule? Is there any
> logging mode that can be turned on and which will dump the tokens and
> rules that antlr encoures? Or some other trick?

Short answer: for all the schema parsers (in this case
MatchingRuleDescriptionSchemaParser) enable the quirks mode with
setQuirksMode(true). The 2nd name contains a dot which is not allowed
according to RFC 4512, but the quirks mode relaxes that rule.

I don't think there is a way to dump the antlr state. In general you
need to debug through the generated AntlrSchemaParser. Please look into
MatchingRuleDescriptionSchemaParser line 99. There we catch the original
exception thrown by antlr which contains the detailed stack trace,
probably it's not good to swallow the original exception and stack trace.

Kind Regards,
Stefan