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

Fix for 6959252 broke JConsole mnemonic keys

    Details

    • Subcomponent:
    • Resolved In Build:
      b110
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        The mnemonic keys are not working in JConsole since b106 due to 6959252 fix.

        To easily reproduce the bug:

        1. Start JConsole
        2. Open "New connection..." dialog (or press Ctrl+N)
        3. The radio buttons "Local Process" and "Remote Process" in the dialog box should have underlined letters 'L' and 'R' respectively and user should be able to activate them by pressing Alt+L and Alt+R.

        Please see comments for more information.

          Issue Links

            Activity

            Hide
            yhuang Yong Huang added a comment -
            BT2:EVALUATION

            The problem is very likely to be caused by code listed below:


                    String ls = System.getProperty("line.separator");
                    for(int i=0;i<temp.length;i++) {
                        temp[i][1] = temp[i][1].toString().replaceAll("\n",ls);
                    }

            Oracle translation factory does not support variables and functions in message values.

            Source code like below can not be supported by WPTG

            private static String cr = System.getProperty("line.separator");

            private static Object[][] contents = {
                            {"Stack trace",cr + "Stack trace: " + cr},
                            ....
                };

            This is the case in jdk/src/share/classes/sun/tools/jconsole/resources/JConsoleResources.java

            The source file can be viewed here http://java-g11n.sfbay.sun.com/j2se/ws/1.7.0/ws/master_image/rootws/jdk/src/share/classes/sun/tools/jconsole/resources/JConsoleResources.java

            With the solution provided by WPTG, I changed newline to "\n" and use temp[i][1] = temp[i][1].toString().replaceAll("\n",ls), where ls is the detected line sepeartor on the OS.

            But after the operation, value in meassage like {"Local Process:.mnemonic", 'L'} is lost. It can not be loaded from resource bundle anymore, or it has incorrect value in the resource bundle.

            I assign the CR to Michal. He can find another solution or improve his solution, so that message like {"Local Process:.mnemonic", 'L'} will not be lost in resource bundle. Or WPTG can enhance the capability of Translation Factory. In that way, we can roll back the change in resource file and the problem will be solved automatically. Actully, a TF should be capabale enough to support variable in message value.
            Show
            yhuang Yong Huang added a comment - BT2:EVALUATION The problem is very likely to be caused by code listed below:         String ls = System.getProperty("line.separator");         for(int i=0;i<temp.length;i++) {             temp[i][1] = temp[i][1].toString().replaceAll("\n",ls);         } Oracle translation factory does not support variables and functions in message values. Source code like below can not be supported by WPTG private static String cr = System.getProperty("line.separator"); private static Object[][] contents = {                 {"Stack trace",cr + "Stack trace: " + cr},                 ....     }; This is the case in jdk/src/share/classes/sun/tools/jconsole/resources/JConsoleResources.java The source file can be viewed here http://java-g11n.sfbay.sun.com/j2se/ws/1.7.0/ws/master_image/rootws/jdk/src/share/classes/sun/tools/jconsole/resources/JConsoleResources.java With the solution provided by WPTG, I changed newline to "\n" and use temp[i][1] = temp[i][1].toString().replaceAll("\n",ls), where ls is the detected line sepeartor on the OS. But after the operation, value in meassage like {"Local Process:.mnemonic", 'L'} is lost. It can not be loaded from resource bundle anymore, or it has incorrect value in the resource bundle. I assign the CR to Michal. He can find another solution or improve his solution, so that message like {"Local Process:.mnemonic", 'L'} will not be lost in resource bundle. Or WPTG can enhance the capability of Translation Factory. In that way, we can roll back the change in resource file and the problem will be solved automatically. Actully, a TF should be capabale enough to support variable in message value.
            Hide
            yhuang Yong Huang added a comment -
            BT2:EVALUATION

            {"Local Process:.mnemonic", 'L'} , 'L' is an integer saved in Object array.

            After temp[i][1] = temp[i][1].toString().replaceAll("\n",ls), the Object array becomes a string array. As a result, the integer value 'L' is lost.

            We need to figure out some way to solve it.

            If Oracle TF could be enhanced to support varibles in list resource bundle, we can roll back to before. This is a possible solution.
            Show
            yhuang Yong Huang added a comment - BT2:EVALUATION {"Local Process:.mnemonic", 'L'} , 'L' is an integer saved in Object array. After temp[i][1] = temp[i][1].toString().replaceAll("\n",ls), the Object array becomes a string array. As a result, the integer value 'L' is lost. We need to figure out some way to solve it. If Oracle TF could be enhanced to support varibles in list resource bundle, we can roll back to before. This is a possible solution.
            Hide
            yhuang Yong Huang added a comment -
            BT2:EVALUATION

            --------------------------------------------
            temp[i][1] = temp[i][1].toString().replaceAll("\n",ls);
            --------------------------------------------

            --------------------------------------------
            if(temp[i][1] instanceof String) {
                temp[i][1] = temp[i][1].toString().replaceAll("\n",ls);
            }
            --------------------------------------------

            In this way, those mnemonic keys can be stored as Object.
            Show
            yhuang Yong Huang added a comment - BT2:EVALUATION -------------------------------------------- temp[i][1] = temp[i][1].toString().replaceAll("\n",ls); -------------------------------------------- -------------------------------------------- if(temp[i][1] instanceof String) {     temp[i][1] = temp[i][1].toString().replaceAll("\n",ls); } -------------------------------------------- In this way, those mnemonic keys can be stored as Object.

              People

              • Assignee:
                mtouzin Michal Toužín
                Reporter:
                kshiroko Kirill Shirokov (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: