Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8224791

Value of jdk.boot.class.path.append system property has spurious separator before first element

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • tbd
    • 13
    • hotspot
    • None

      I've attached a sample JVMTI agent to demonstrate the issue.

      On macOS, the agent can be built with with
      gcc -dynamiclib -o libagent.dylib -I $JAVA_HOME/include -I$JAVA_HOME/include/darwin agent.c

      The agent does the following:

      1. calls GetSystemProperty to get the value of jdk.boot.class.path.append
      2. calls AddToBootClassLoadSearch to add to the "two.jar" to the boot class loader search
      3. calls GetSystemProperty again to get the updated value of jdk.boot.class.path.append

      Consider the following:

      $ java -agentlib:agent -Xbootclasspath/a:one.jar -version

      The initial value of the system property is ":one.jar". Note the spurious path separator.

      Now try:

      $ java -agentlib:agent -version

      The initial value of the property is the empty string. I expected the function would fail with JVMTI_ERROR_NOT_AVAILABLE because -Xbootclasspath/a was not specified.

      The value changes to ":two.jar" after AddToBootClasspathSearch has been called to append to the boot class path. Again, note the spurious path separator.

            dholmes David Holmes
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: