Skip to content

Fix JVM tool bootstrap check with program arguments containing slashes - #4602

Open
RaphaelFakhri wants to merge 2 commits into
elastic:mainfrom
RaphaelFakhri:fix/jvm-tool-check-args-with-slashes
Open

RaphaelFakhri wants to merge 2 commits into
elastic:mainfrom
RaphaelFakhri:fix/jvm-tool-check-args-with-slashes

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

What does this PR do?

Fixes #4269.

JvmToolBootstrapCheck splits the whole sun.java.command value on /, including the program arguments. Because of this:

  • An application started with an argument that contains a slash, such as java org.example.Main --file /my/path/file.txt, logs Unexpected JVM command line syntax.
  • A JVM tool started with a path argument, such as keytool -list -keystore /tmp/keystore.jks, is not detected as a JVM tool. The agent logs the same warning and instruments the tool.

The check now applies the / split to the main class or module part only, which is the first space-separated token. Commands without arguments behave as before, including the warning for unexpected main class syntax such as /my/app/Main.

The tests cover a JVM tool with a path argument, with and without a module prefix, and an application with a path argument, with and without a module prefix.

Checklist

  • This is an enhancement of existing features, or a new feature in existing plugins
    • I have updated CHANGELOG.next-release.md
    • I have added tests that prove my fix is effective or that my feature works
    • Added an API method or config option? Document in which version this will be introduced
    • I have made corresponding changes to the documentation
  • This is a bugfix
  • This is a new plugin
    • I have updated CHANGELOG.next-release.md
    • My code follows the style guidelines of this project
    • I have made corresponding changes to the documentation
    • I have added tests that prove my fix is effective or that my feature works
    • New and existing unit tests pass locally with my changes
    • I have updated supported-technologies.md
    • Added an API method or config option? Document in which version this will be introduced
    • Added an instrumentation plugin? Describe how you made sure that old, non-supported versions are not instrumented by accident.
  • This is something else

Copilot AI balanced review requested due to automatic review settings October 22, 2026 12:49
@RaphaelFakhri
RaphaelFakhri requested a review from a team as a code owner October 22, 2026 12:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@github-actions github-actions Bot added agent-java community Issues and PRs created by the community triage labels Oct 22, 2026
@RaphaelFakhri

Copy link
Copy Markdown
Author

The PayaraIT failures came from this change: the Payara main class com.sun.enterprise.glassfish.bootstrap.ASMain has slashes in its arguments, so it used to hit the "unexpected syntax" warning and is now matched by the com.sun. prefix as a JDK tool. The check now skips com.sun.enterprise.*, with a test using the Payara command line.

Copilot AI balanced review requested due to automatic review settings October 23, 2026 15:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused parsing change and regression coverage address the reported failure, with no blocking issues identified in static review.

No open issues 🎉

Review effort: Balanced

This branch has not been deployed

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

Labels

agent-java community Issues and PRs created by the community triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warning "Unexpected JVM command line syntax" when passing command line arguments containing slashes to instrumented application

2 participants