[ https://issues.apache.org/jira/browse/WW-5437?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukasz Lenart updated WW-5437: ------------------------------ Fix Version/s: 6.5.0 > EnvsValueSubstitutor ignores Environment variables if default value is present > ------------------------------------------------------------------------------ > > Key: WW-5437 > URL: https://issues.apache.org/jira/browse/WW-5437 > Project: Struts 2 > Issue Type: Bug > Components: XML Configuration > Affects Versions: 6.4.0 > Reporter: Stefan Sielaff > Priority: Major > Fix For: 6.5.0 > > > According to the documentation at > [https://struts.apache.org/core-developers/constant-configuration] it should > be possible to use both system and environment variables in the constants > section. Currently environment variables are ignored if a default value is > defined. > The sysStrSubstitutor has a less specific prefix which also includes and > replaces those, which should be passed to the envStrSubstitutor later. > Given > System.getenv('STRUTS_DEV_MODE') is "true" > {code:java} > <constant name="struts.devMode" value="${env.STRUTS_DEV_MODE:false}"/> > {code} > The code: > {code:java} > String substituted = sysStrSubstitutor.replace(value); > return envStrSubstitutor.replace(substituted);{{}}{code} > The sysStrSubstitutor checks, if there is a system property with the key > "env.STRUTS_DEV_MODE" which is unset. It then replaces the expression with > its default. substituted is "false" now. Afterwards the envStrSubstitutor > doesn't find any expression to substitute, because the string is "false". -- This message was sent by Atlassian Jira (v8.20.10#820010)