JDK-4209604 : ProgressMonitorInputStream updates ProgressMonitor outside event thread
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 1999-02-08
  • Updated: 2003-08-22
  • Resolved: 2003-08-22
Description

Name: clC74495			Date: 02/08/99


The read(), skip(), and reset() methods of ProgressMonitorInputStream update
the ProgressMonitor associated to it outside of the event thread.

For instance:
    public long skip(long n) throws IOException {
        long nr = in.skip(n);
        if (nr>0) monitor.setProgress(nread+=nr);
        return nr;
    }

I realize that ProgressMonitor isn't itself a Swing component, however, I think
its setProgress() method needs to be called from the event thread, as this
accesses a JProgressBar.

I could possibly see why it might be okay outside the event thread (it only does
a set, no gets). However, it seems like if it is okay, then there should be a comment
added.
(Review ID: 53802)
======================================================================

Comments
EVALUATION The call to setValue in the JProgressBar shouldn't cause any problems since it only sets the value in the data model and doesn't touch the UI. But the call to setProgress in ProgressMonitor can possibly create a dialog. Therefore, I believe we should be doing this on the AWT event queue. ###@###.### 2001-11-15
2001-11-15