Re: [PATCH 2.3.1 1/1] Common: variable expansion in property value on the last line of properties file fails


Guy <guy.tal@...>
 

Hi Damian,

A week ago I published a patch that fix the mama.properties parser failure to expand a variable on the last line.
Can you or anyone else review that fix?

Regards,
Guy Tal
Tick42


On 03/09/2014 19:32, Guy wrote:

Hi,

The properties file parser fails to expand variable if such exists in a value that is also at the last line in the properties file.
For example, Consider <EOF> as the last character in file, if the last property in the file is as follows:
my.property=$(SOME_VALUE)<EOF>
and $(SOME_VALUE)=Hello World, we would expect my.property to be "Hello World", but it doesn't, it remains $(SOME_VALUE)

The properties file parser expands environment variable if such exists inside a property value, but not if the value is the last one before end-of-file.

The solution is to check if there are key and value already parsed also when reaching end of file.
Plese look at common/c_cpp/src/c/properties.l from line 159:
<<EOF>>                         { /* Handle EOF right at the end of a */
                                    /* value string */
                                    if ( curKey && curValue )
                                    {
                                        replaceValue = propertiesImpl_ReplaceEnvironmentVariable(curValue); //<- beginning of the missing part
                                        if(replaceValue != NULL)
                                        {
                                           /* Delete the original value */
                                           free(curValue);

                                           /* Copy the replaced value into the
                                            * current value pointer. */
                                           curValue = replaceValue;
}                                   //<- that is all

I opened a bug at:
http://bugs.openmama.org/show_bug.cgi?id=156

I provide here a patch of the lex file for review.

Regards,
Guy Tal
Tick42


_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
https://lists.openmama.org/mailman/listinfo/openmama-dev

Join {Openmama-dev@lists.openmama.org to automatically receive all group messages.