Skip to content

Handle null PATH environment variable in UserAgent#763

Open
renaudhartert-db wants to merge 2 commits intomainfrom
fix/issue-550-useragent-null-path
Open

Handle null PATH environment variable in UserAgent#763
renaudhartert-db wants to merge 2 commits intomainfrom
fix/issue-550-useragent-null-path

Conversation

@renaudhartert-db
Copy link
Copy Markdown
Contributor

Summary

  • System.getenv("PATH") returns null in environments where PATH is not set (serverless runtimes, minimal containers, custom Docker images). This caused an NPE in UserAgent.env().
  • Fall back to an empty path array when PATH is null, so CI/CD and agent detection simply find nothing instead of crashing.

Test plan

  • Added testEnvWithNullPath test in UserAgentTest
  • All existing UserAgentTest tests pass
  • Formatted with fmt-maven-plugin

Fixes #550

System.getenv("PATH") returns null in environments where PATH is not
set (serverless runtimes, minimal containers). This caused an NPE in
UserAgent.env(). Fall back to an empty array when PATH is null.

Fixes #550
@github-actions
Copy link
Copy Markdown
Contributor

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-java

Inputs:

  • PR number: 763
  • Commit SHA: 2710949699812848eafa5d4ec86425d626a15faf

Checks will be approved automatically on success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ISSUE] NullPointerException in UserAgent.env() when PATH environment variable is missing

1 participant