directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Seelmann <seelm...@apache.org>
Subject Re: openldap.g schema parser prefixes double quotes with a backslash
Date Sun, 01 Jun 2008 17:44:19 GMT
Hi,

I know the reason why the parser add an additional backslash before each
double quote. The velocity templates of the apacheds-core-plugin
generate java classes and write the parsed DESC as String literal,
double qoutes in that literal must be escaped of course. I fixed that by
escaping double quotes locally in the velocity templates rather than in
the schema parser.

Kind Regards,
Stefan


Stefan Seelmann schrieb:
> Emmanuel Lecharny wrote
>> On Sun, Jun 1, 2008 at 11:11 AM, Stefan Seelmann <seelmann@apache.org> wrote:
>>> Hi,
>>>
>>> In testAttributeTypeParseWithDescQuotes() of OpenLdapSchemaParserTest
>>> (http://tinyurl.com/58nhpm) the DESC element contains two double quotes:
>>>
>>>  ... DESC 'RFC2256: \"knowledge\" information'\n" ...
> 
> Oh, I sould say that this is part of a Java String, so \" is transformed
> to a ". Here is the complete String:
> 
> String attributeTypeData = "# adding a comment  \n" + "attributetype (
> 2.5.4.2 NAME 'knowledgeInformation'\n"
>             + "        DESC 'RFC2256: \"knowledge\" information'\n" + "
>        EQUALITY caseIgnoreMatch\n"
>             + "        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )";
> 
>>> The parser in openldap.g adds a backslash before each double quote and
>>> this is also expected in the test:
>>>
>>>  assertEquals( "RFC2256: \\\"knowledge\\\" information",
>>> type.getDescription() );
>>>
>>> I just wonder what's the reason for adding a backslash?
>> Because otherwise, the two strings wont be equal :)
>>
>> The first \\ in the assert will be transformed into a \ internally.
>> The following \" is transformed to a "
>> This result to a \" internally, to be compared with the original DESC,
>> containing \".
>>
> 
> See my comment above. The DESC of attributeTypeData only contains a
> double quoute " without any backslash in front.


Mime
View raw message