You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[MSHARED-969] Environment variable with null value #282
At least on Windows it is impossible to store null in env vars. According to Windows API description doing so will remove the variable from the environment. Can other OS experts confirm that this is the same on Linux, MacOS, etc? If so, I would be +1 for fixing this issue.
After my fix we have another feature, we can remove some variable from system environment.
In method getEnvironmentVariables first is called addSystemEnvironment which copied current system variable to local list, and when variable with the same name exist it is not copied from system.
Next in getEnvironmentVariables we filter variables wich have null value and in consequence we can filter system variables.
Activity
jira-importer commentedon Dec 29, 2020
Markus Karg commented
At least on Windows it is impossible to store null in env vars. According to Windows API description doing so will remove the variable from the environment. Can other OS experts confirm that this is the same on Linux, MacOS, etc? If so, I would be +1 for fixing this issue.
jira-importer commentedon Dec 29, 2020
Slawomir Jaranowski commented
In fixed code system environment is not set yet - it happens later.
maven-shared-utils/src/main/java/org/apache/maven/shared/utils/cli/Commandline.java
Lines 408 to 425 in 360fd97
by call:
{{}}
}}I fixed method {{getEnvironmentVariables()In original code we never have null as environment value
if
valuewas null - it was replaced by"null"string.jira-importer commentedon Dec 29, 2020
Slawomir Jaranowski commented
After my fix we have another feature, we can remove some variable from system environment.
In method
getEnvironmentVariablesfirst is calledaddSystemEnvironmentwhich copied current system variable to local list, and when variable with the same name exist it is not copied from system.Next in
getEnvironmentVariableswe filter variables wich havenullvalue and in consequence we can filter system variables.I added unit test to confirm this behavior.
jira-importer commentedon Dec 29, 2020
Slawomir Jaranowski commented
and some other discovery MSHARED-971