felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Felix Meschberger (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (FELIX-3542) Incorrect rendering of default property values with backslashes in property editor
Date Wed, 03 Apr 2013 08:15:16 GMT

     [ https://issues.apache.org/jira/browse/FELIX-3542?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Felix Meschberger resolved FELIX-3542.

    Resolution: Not A Problem
      Assignee: Felix Meschberger

The problem is, that we need double escaping: Once for Java and once for the Metatype attribute's
default value.

So the actual property definition in your case must be:

    static private final String DEFAULT_FILE_PATTERN = "(?i)index\\\\.html";

with 4 (four) backslash characters in Java to actually get 2 (two) characters in the XML file
and thus finally get the single backslash in the default value from the Metatype service.

Metatype service escaping is described in the JavaDoc of the AttributeDefinition.validate(String)
method (or section of the OSGi Enterprise R5 specification):

    Commas ( ‘,’ \u002C) and spaces (‘ ‘ \u0020) and backslashes (‘\’ \u005C)
can be escaped with
    another backslash. Escaped spaces must not be trimmed. For example:
          value=”  a\,b,b\,c,\ c\\,d   “ => [ “a,b”, “b,c”, “ c\”, “d”

Hence resolving this as not being a problem.
> Incorrect rendering of default property values with backslashes in property editor
> ----------------------------------------------------------------------------------
>                 Key: FELIX-3542
>                 URL: https://issues.apache.org/jira/browse/FELIX-3542
>             Project: Felix
>          Issue Type: Bug
>          Components: Web Console
>            Reporter: Ankur Pathela
>            Assignee: Felix Meschberger
>            Priority: Minor
> For a component property defined as below:
> ~~~~~~~~~~~~
> static private final String DEFAULT_FILE_PATTERN = "(?i)index\\.html";
> @Property(value=DEFAULT_FILE_PATTERN)
> static private final String PN_FILE_PATTERN = "file.pattern"; 
> ~~~~~~~~~~~~
> The backslash gets eaten up in the felix web console. The default value should appear
as (?i)index\.html but ends up looking like (?i)index.html. This regex has a different meaning
than the one intended.
> The component gets the correct initial value. But things fail when you open the property
editor and save without making any changes(because the editor loaded up with an incorrect
default value). Note that the property values when saved from the property editor render correctly
the next time the editor loads.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message