Skip to content

[: Illegal number: 09:52:08:460 when using JAVA_TOOL_OPTIONS with a java agent #68

Description

@froque

We are using Datadog java agent in JAVA_TOOL_OPTIONS environment variable:
export JAVA_TOOL_OPTIONS="-javaagent:dd-java-agent.jar -Ddd.writer.type=LoggingWriter"

This means that when stork tries to discover java versions, the java version parsing algorithm sometimes fails due to the extra output from datadog java agent:

❯ export JAVA_TOOL_OPTIONS="-javaagent:dd-java-agent.jar -Ddd.writer.type=LoggingWriter" 
❯ java -version 2>&1 | grep "version" | awk '{print $3}' | tr -d \" 
10:16:24:649
10:16:24:650
10:16:24:650
22.0.1

If the output from datadog java agent is the last and not the java version, the bash script fails with:

❯ ./stork-demo-hellod        
./stork-demo-hellod: 496: [: Illegal number: 14:14:03:228
./stork-demo-hellod: 496: [: Illegal number: 14:14:03:228
./stork-demo-hellod: 496: [: Illegal number: 14:14:03:228
./stork-demo-hellod: 496: [: Illegal number: 14:14:03:228
./stork-demo-hellod: 496: [: Illegal number: 14:14:03:228
./stork-demo-hellod: 496: [: Illegal number: 14:14:03:228
./stork-demo-hellod: 496: [: Illegal number: 14:14:03:228
./stork-demo-hellod: 496: [: Illegal number: 14:14:03:228
./stork-demo-hellod: 496: [: Illegal number: 14:14:03:228
./stork-demo-hellod: 496: [: Illegal number: 14:14:03:228
./stork-demo-hellod: 496: [: Illegal number: 14:14:03:228
./stork-demo-hellod: 496: [: Illegal number: 14:14:03:228
./stork-demo-hellod: 496: [: Illegal number: 14:14:03:228
Unable to find Java runtime on system with version >= 1.6
Try running 'sudo apt-get install openjdk-6-jre-headless' or
Visit http://java.com to download and install one for your system

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions