Avoiding property substitution by escaping does not remove escape character
---------------------------------------------------------------------------

                 Key: FELIX-2366
                 URL: https://issues.apache.org/jira/browse/FELIX-2366
             Project: Felix
          Issue Type: Bug
          Components: File Install
    Affects Versions: fileinstall-3.0.0
            Reporter: Bengt Rodehav


To avoid property substitution, an escape character was introduced in version 
3.0.0 of File Install. The idea is that if I want to send the configuration 
value

  ${propkey}

to my application without property substitution to take place, I can escape the 
START_DELIM (${) and STOP_DELIM (}) with a backslash as follows:

  $\{propkey\}

However, when doing this the escape character is not removed from the string. 
The reason is as follows:

The method of interest is substVars in class 
org.apache.felix.fileinstall.internal.Util. The logic tries to find matching 
DELIM_START (${) and DELIM_STOP (}). When you escape either of these (by 
specifying a backslash before "${" and/or "}"), the logic will never find 
matching DELIM_START and DELIM_STOP which causes the method to immediately 
return without performing property substitution. The logic at the end of the 
method (that removes the backslashes) is never reached.

A workarount is to add an unnecessary property at the end of the value just to 
make sure some property substitution will take place since then the logic at 
the end of the substVars() method (that removes the escape character) will be 
reached. Thus, this works:

  $\{propkey\}${#}


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to