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

jconsole.js includes misleading functions that may create Swing objects not from the EDT


    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 6
    • Fix Version/s: 6
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
    • CPU:
    • OS:


      The demo directory includes a demo of the functionality that allows users to define custom jconsole tabs. The demo creates a tab where you can execute JavaScript code interactively using the built-in JavaScript engine in Mustang. Since this demo is the only place where we include JavaScript source in the JDK (as far as I know), we can expect that users will look at it for good practices. So it is important that it define good practices.

      jconsole.js includes a set of functions that are preloaded in the JavaScript interaction tab. Among these functions are implementations of some standard JavaScript (DOM 0) functions such as error, warn, alert, prompt, and confirm. However, these functions create a JOptionPane directly in the calling thread. If that thread is not the EDT, then this is bad Swing practice. It happens that in the jconsole demo, all JavaScript code *is* executed in the EDT, but users risk copying these functions into their own JavaScript code and calling them from threads other than the EDT. (Besides, it would be better if the demo did not execute the JavaScript code in the EDT; see 6445511.)

      Ideally the functions should be rewritten to use the invokeLater functionality that is already present in jconsole.js. At the very least, they should be commented to say that they are only valid if called from the EDT.


          Issue Links



              • Assignee:
                sundar Sundararajan Athijegannathan
                emcmanus Eamonn McManus
              • Votes:
                0 Vote for this issue
                0 Start watching this issue


                • Created: