This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 252308 - org.openide.awt.SwingBrowserImpl.run() performs UI operation on non AWT thread
Summary: org.openide.awt.SwingBrowserImpl.run() performs UI operation on non AWT thread
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7
: P1 normal (vote)
Assignee: Jan Stola
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-08 16:53 UTC by jijwang
Modified: 2015-07-10 01:17 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jijwang 2015-05-08 16:53:17 UTC
org.openide.awt.SwingBrowserImpl.run() will do some UI operation on non AWT thread. In an application with EDT violation monitoring (e.g JDEV debug version), it would trigger exception:
EDT Violations:May 01, 2015 9:08:45 AM oracle.javatools.internal.ui.SwingThreadViolationDetector$Violation report
  INFO: Call to Swing component not from the EDT Thread - in violation of Swing's single threaded policy.
  javax.swing.JLabel[,0,586,400x14,alignmentX=0.0,alignmentY=0.0,border=,flags=8388608,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,horizontalAlignment=LEADING,horizontalTextPosition=TRAILING,iconTextGap=4,labelFor=org.openide.awt.HtmlBrowser[,0,0,400x600,invalid,layout=java.awt.BorderLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=9,maximumSize=,minimumSize=,preferredSize=],text=Document: Done,verticalAlignment=CENTER,verticalTextPosition=CENTER]
  	at javax.swing.JComponent.repaint(JComponent.java:4802)
  	at java.awt.Component.repaint(Component.java:3303)
  	at javax.swing.JLabel.setText(JLabel.java:345)
  	at org.openide.awt.HtmlBrowser$BrowserListener.propertyChange(HtmlBrowser.java:703)
  	at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
  	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
  	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
  	at org.openide.awt.SwingBrowserImpl.setStatusText(SwingBrowserImpl.java:372)
  	at org.openide.awt.SwingBrowserImpl.run(SwingBrowserImpl.java:348)
  	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1425)
  	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
  	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
  	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2038)

 Click a button whose actionListener would perform the following code:
  HtmlBrowser browser = new HtmlBrowser();
          browser.setURL(url);
  
          JFrame frame = new JFrame();
          frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
          frame.getContentPane().add(browser);
          frame.pack();
          frame.setVisible(true);
  
  url points to a html file inside jar: url = MyClass.class.getClassLoader().getResource("com/oracle/.../MyPage.html");
  The html did get displayed but it also throw the EDT violation.
Comment 1 Tomas Stupka 2015-05-11 11:09:29 UTC
afaik bugtracking calls only
HtmlBrowser.URLDisplayer.getDefault.showURL(url);

please evaluate
Comment 2 Jan Stola 2015-07-09 11:35:56 UTC
Fixed by https://hg.netbeans.org/web-main/rev/24a64a0d8d6c
Comment 3 Quality Engineering 2015-07-10 01:17:17 UTC
Integrated into 'main-silver', will be available in build *201507100001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/24a64a0d8d6c
User: Jan Stola <jstola@netbeans.org>
Log: #252308: org.openide.awt.SwingBrowserImpl.run() performs UI operation on non AWT thread