Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-6811105

Potentially malicious code in com.sun.javatest.exec.ContextManager.refreshTests()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • jt4.2.1
    • None
    • tools
    • b03
    • x86
    • windows_xp
    • Verified

    Description

      Javatest 4.2

      https://jtharness.dev.java.net/svn/jtharness/trunk/code/src/com/sun/javatest/exec/ContextManager.java (current revision is 1267)

      See method .refreshTests():
      public void refreshTests() {
              synchronized (this) {
                  if (pendingRefresh)
                      return;
                  pendingRefresh = true;
              } // sync
              // start the task on a new thread if needed to release
              // the GUI
              if (EventQueue.isDispatchThread()) {
                  Runnable cmd = new Runnable() {
                      public void run() {
                          refreshTestsImpl();
                      } // run()
                  };
                  Thread t = new Thread(cmd, "ContextMgr Refresh Defer");
                  t.start();
                  return;
              }

              try {
                  Thread.currentThread().sleep(4000);
              }
              catch (InterruptedException e) {
              }
              refreshTestsImpl();
          }

      If method is called from Event Dispatch Thread everything looks OK - refreshTestsImpl() is submitted with a separate thread and then method quits.
      However if it's already a different thread - then the code looks very suspicious - why there's a need to do a Thread.currentThread().sleep(4000) before calling to actual refreshTestsImpl()? It may cause unpredictable response time for the user.

      Is there a hidden problem behind this .sleep()?

      Attachments

        Activity

          People

            bkurotsu Brian Kurotsuchi (Inactive)
            kromanovorcl Konstantin Romanovskiy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: