[
https://issues.apache.org/jira/browse/MSHARED-969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17256010#comment-17256010
]
Slawomir Jaranowski edited comment on MSHARED-969 at 12/29/20, 2:13 PM:
------------------------------------------------------------------------
In fixed code system environment is not set yet - it happens later.
[https://github.com/apache/maven-shared-utils/blob/360fd973130d4e80bbb0df2e6b30b7a54ec5f324/src/main/java/org/apache/maven/shared/utils/cli/Commandline.java#L408-L425]
by call:
{{}}
{code:java}
String[] environment = getEnvironmentVariables();
...
process = Runtime.getRuntime().exec( getShellCommandline(), environment );
{code}
{{}}I fixed method {{getEnvironmentVariables()}}
In original code we never have null as environment value
{code:java}
environmentVars[i] = name + "=" + value;{code}
if {{value}} was null - it was replaced by {{"null"}} string.
was (Author: slawekjaranowski):
In fixed code system environment is not set yet - it happens later.
https://github.com/apache/maven-shared-utils/blob/360fd973130d4e80bbb0df2e6b30b7a54ec5f324/src/main/java/org/apache/maven/shared/utils/cli/Commandline.java#L408-L425
by call:
{code}
String[] environment = getEnvironmentVariables();
...
process = Runtime.getRuntime().exec( getShellCommandline(), environment
);
{code}
I fixed method {{getEnvironmentVariables()}}
In original code we never have null as environment value
{{code}}
environmentVars[i] = name + "=" + value;
{{code}}
if {{value}} was null - it was replaced by {{"null"}} string.
> Environment variable with null value
> ------------------------------------
>
> Key: MSHARED-969
> URL: https://issues.apache.org/jira/browse/MSHARED-969
> Project: Maven Shared Components
> Issue Type: Bug
> Components: maven-shared-utils
> Affects Versions: maven-shared-utils-3.3.3
> Reporter: Slawomir Jaranowski
> Priority: Major
>
> When we add environment variable with {{null}} value then to executed process
> is pass variable with {{"null"}} as string.
> Variable with {{null}} value should not be set, when executed process will
> try to get this variable will receive {{null}} as we expect.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)