Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
6.4.0
-
None
Description
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"
<constant name="struts.devMode" value="${env.STRUTS_DEV_MODE:false}"/>
The code:
String substituted = sysStrSubstitutor.replace(value); return envStrSubstitutor.replace(substituted);
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".
Attachments
Issue Links
- links to