[ https://issues.apache.org/jira/browse/WW-5437?focusedWorklogId=924605&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-924605 ]
ASF GitHub Bot logged work on WW-5437: -------------------------------------- Author: ASF GitHub Bot Created on: 05/Jul/24 04:52 Start Date: 05/Jul/24 04:52 Worklog Time Spent: 10m Work Description: lukaszlenart merged PR #977: URL: https://github.com/apache/struts/pull/977 Issue Time Tracking ------------------- Worklog Id: (was: 924605) Remaining Estimate: 0h Time Spent: 10m > 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 > > Time Spent: 10m > Remaining Estimate: 0h > > 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)