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

The exception messages printed by jcmd ManagementAgent.start are corrupted on Japanese Windows

    XMLWordPrintable

Details

    • b05
    • generic
    • generic

    Backports

      Description

        On English Windows environment, jcmd prints "Invalid agent state" as RuntimeException message if ManagementAgent.start is executed twice.
        But the message is corrupted on Japanese Windows environment.

        English Windows environment:

        jcmd Test ManagementAgent.start jmxremote.port=50082 jmxremote.authenticate=false jmxremote.ssl=false
        16942:
        java.lang.RuntimeException: Invalid agent state: Agent already started

        Japanese Windows environment:

        jcmd Test ManagementAgent.start jmxremote.port=50082 jmxremote.authenticate=false jmxremote.ssl=false
        7368:
        java.lang.RuntimeException: 繧ィ繝シ繧ク繧ァ繝ウ繝医?ョ迥カ諷九′辟。蜉ケ縺ァ縺?: Agent already started

        The java process throws RuntimeException at jdk.management.agent/jdk.internal.agent.Agent.startRemoteManagementAgent(Agent.java:340).

            throw new RuntimeException(getText(INVALID_STATE, "Agent already started"));

        The japanese exception message is defined in ./jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_ja.properties
        with utf8 charset, and it is built in jdk/internal/agent/resources/agent_ja.class.

            agent.err.invalid.state = \u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u306E\u72B6\u614B\u304C\u7121\u52B9\u3067\u3059: {0}

        On the other hand,
        the jcmd reads the message at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.readErrorMessage(HotSpotVirtualMachine.java:360).

                BufferedReader br = new BufferedReader(new InputStreamReader(in));
                while ((s = br.readLine()) != null) {

        The message is read without specifying a charset and the default charset is not utf8.

        This is the reason why the exception message of jcmd ManagementAgent.start is corrupted in Japanese Windows.

        This does not occur since jdk18 owing to JEP 400: UTF-8 by Default.

        Attachments

          Issue Links

            Activity

              People

                kyukihiro Kimura Yukihiro
                kyukihiro Kimura Yukihiro
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: