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.
Because Nimbus look and feel isn't thread safe there are random exceptions when UI components are instantiated outside the EDT thread.
*** Bug 234151 has been marked as a duplicate of this bug. ***
*** Bug 233857 has been marked as a duplicate of this bug. ***
*** Bug 232786 has been marked as a duplicate of this bug. ***
*** Bug 230584 has been marked as a duplicate of this bug. ***
*** Bug 229752 has been marked as a duplicate of this bug. ***
*** Bug 226902 has been marked as a duplicate of this bug. ***
*** Bug 226531 has been marked as a duplicate of this bug. ***
*** Bug 235427 has been marked as a duplicate of this bug. ***
*** Bug 235837 has been marked as a duplicate of this bug. ***
*** Bug 238425 has been marked as a duplicate of this bug. ***
*** Bug 241061 has been marked as a duplicate of this bug. ***
*** Bug 242433 has been marked as a duplicate of this bug. ***
*** Bug 242683 has been marked as a duplicate of this bug. ***
*** Bug 248795 has been marked as a duplicate of this bug. ***
This issue has 14 duplicates, so according to http://wiki.netbeans.org/BugPriorityGuidelines it's P2.
*** Bug 248792 has been marked as a duplicate of this bug. ***
Sample exception which occurs quite often with Nimbus: java.lang.NullPointerException at javax.swing.plaf.nimbus.NimbusStyle.validate(NimbusStyle.java:298) at javax.swing.plaf.nimbus.NimbusStyle.getValues(NimbusStyle.java:806) at javax.swing.plaf.nimbus.NimbusStyle.getInsets(NimbusStyle.java:485) at javax.swing.plaf.synth.SynthStyle.installDefaults(SynthStyle.java:913) at javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(SynthLookAndFeel.java:265) at javax.swing.plaf.synth.SynthMenuItemUI.updateStyle(SynthMenuItemUI.java:96) at javax.swing.plaf.synth.SynthMenuItemUI.installDefaults(SynthMenuItemUI.java:80) at javax.swing.plaf.basic.BasicMenuItemUI.installUI(BasicMenuItemUI.java:107) at javax.swing.JComponent.setUI(JComponent.java:663) at javax.swing.AbstractButton.setUI(AbstractButton.java:1810) at javax.swing.JMenuItem.setUI(JMenuItem.java:241) at javax.swing.JMenuItem.updateUI(JMenuItem.java:250) at javax.swing.JMenuItem.init(JMenuItem.java:212) at javax.swing.JMenuItem.<init>(JMenuItem.java:151) at javax.swing.JMenuItem.<init>(JMenuItem.java:110) at org.openide.awt.Actions$MenuItem.<init>(Actions.java:1561) at org.netbeans.modules.openide.awt.DefaultAWTBridge.createMenuPresenter(DefaultAWTBridge.java:76) at org.openide.util.actions.CallableSystemAction.getMenuPresenter(CallableSystemAction.java:92) at org.openide.awt.DynaMenuModel.loadSubmenu(DynaMenuModel.java:101) at org.openide.awt.MenuBar$LazyMenu$MenuFolder.createInstance(MenuBar.java:808) at org.openide.loaders.FolderInstance.defaultProcessObjectsFinal(FolderInstance.java:888) at org.openide.loaders.FolderInstance$1R.run(FolderInstance.java:730) at org.openide.util.Task.run(Task.java:257) [catch] at org.netbeans.modules.openide.loaders.AWTTask.run(AWTTask.java:79) at org.netbeans.modules.openide.loaders.AWTTask$Processor.run(AWTTask.java:172) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744) at java.awt.EventQueue.access$400(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:697) at java.awt.EventQueue$3.run(EventQueue.java:691) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.awt.EventQueue.dispatchEvent(EventQueue.java:714) at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Another one: java.lang.NullPointerException at javax.swing.plaf.nimbus.NimbusStyle.validate(NimbusStyle.java:298) at javax.swing.plaf.nimbus.NimbusStyle.getValues(NimbusStyle.java:806) at javax.swing.plaf.nimbus.NimbusStyle.getInsets(NimbusStyle.java:485) at javax.swing.plaf.synth.SynthStyle.installDefaults(SynthStyle.java:913) at javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(SynthLookAndFeel.java:265) at javax.swing.plaf.synth.SynthProgressBarUI.updateStyle(SynthProgressBarUI.java:92) at javax.swing.plaf.synth.SynthProgressBarUI.installDefaults(SynthProgressBarUI.java:86) at javax.swing.plaf.basic.BasicProgressBarUI.installUI(BasicProgressBarUI.java:137) at javax.swing.JComponent.setUI(JComponent.java:666) at javax.swing.JProgressBar.setUI(JProgressBar.java:609) at javax.swing.JProgressBar.updateUI(JProgressBar.java:619) at javax.swing.JProgressBar.<init>(JProgressBar.java:334) at javax.swing.JProgressBar.<init>(JProgressBar.java:274) at javax.swing.JProgressBar.<init>(JProgressBar.java:251) at org.netbeans.modules.progress.ui.NbProgressBar.<init>(NbProgressBar.java:74) at org.netbeans.modules.progress.ui.StatusLineComponent.createBar(StatusLineComponent.java:185) at org.netbeans.modules.progress.ui.StatusLineComponent.<init>(StatusLineComponent.java:132) at org.netbeans.modules.progress.ui.ProviderImpl.getDefaultWorker(ProviderImpl.java:63) at org.netbeans.modules.progress.spi.Controller.getProgressUIWorker(Controller.java:125) at org.netbeans.modules.progress.spi.Controller.getVisualComponent(Controller.java:108) at org.netbeans.progress.module.ProgressVisualizerProvider.getStatusLineElement(ProgressVisualizerProvider.java:60) at org.netbeans.core.windows.view.ui.MainWindow$7.run(MainWindow.java:405) at org.netbeans.core.windows.view.ui.MainWindow.getStatusLineElements(MainWindow.java:417) at org.netbeans.core.windows.view.ui.MainWindow.decoratePanel(MainWindow.java:371) at org.netbeans.core.windows.view.ui.MainWindow.access$100(MainWindow.java:81) at org.netbeans.core.windows.view.ui.MainWindow$2.run(MainWindow.java:269) [catch] at org.netbeans.core.windows.WindowManagerImpl$Exclusive$1.run(WindowManagerImpl.java:1563) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:749) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:702) at java.awt.EventQueue$3.run(EventQueue.java:696) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.awt.EventQueue.dispatchEvent(EventQueue.java:719) at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
This is out of scope for 8.1 release...
As per the bug waiving process [1] can you please provide appropriate justification for the waiver request? Why the bug cannot be fixed for 8.1? What is the plan about it? We know about this issue for 28 months already. Thanks Fanis! [1] http://wiki.netbeans.org/WaiverProcess
According to the reports, this might be an issue on JDK 7 only. There are no reports from JDK 8. Can someone confirm please?
(In reply to Jiri Kovalsky from comment #20) > As per the bug waiving process [1] can you please provide appropriate > justification for the waiver request? Why the bug cannot be fixed for 8.1? > What is the plan about it? We know about this issue for 28 months already. > Thanks Fanis! > > [1] http://wiki.netbeans.org/WaiverProcess Well, it seems that this bug most probably is due to issue in Nimbus and/or jdk, which since all the duplicates are from users with jdk7, might mean that it got fixed in Nimbus and/or jdk side. There are no reports from users with jdk8 AFAICT. From the stack-traces it seems that the exception is coming from awt code. I am not sure where the issue might be in netbeans side, if indeed it is an issue with netbeans code in the first place. So, trying a fix this late is IMHO out of scope for this release. Thank you.
I have seen bugs like this in other projects and I find it very likely that this is a bug in NetBeans. That is, regardless of where the exception is thrown these kind of "ClassCastException"s were always caused by misusing Swing in my experience. However, pinpointing the cause in the NetBeans codebase seems close to impossible. The only way I see is to check all places where Swing components are created and/or accessed (which thread) and fix those places (this is quite a big task given how big the code base of NB is). Not to mention that third party plugins might be a cause for this as well. That it works with JDK 8 can be considered a coincidence (in my opinion). Though, I wouldn't be surprised that the JDK developers made some effort to avoid errors when the Swing components are misused.
I have seen these exact exceptions in my own NetBeans RCP-based application, and the culprits were often Actions that try to create or interact with Swing components from their constructors. Because NetBeans RCP typically constructs registered Actions off the EDT, this causes multiple threads to interact with Swing/Nimbus L&F concurrently. Altering these Actions to not interact with Swing at construction time (e.g. switching to lazy initialization or by using SwingUtilities.invokeLater(...)) has always fixed these exceptions for me. Perhaps there are some Actions in NetBeans RCP or IDE that have the same problem?
Bug waiver for 8.1 approved.
*** Bug 258779 has been marked as a duplicate of this bug. ***
I find this interesting: http://bugs.java.com/view_bug.do?bug_id=6718641 It says that "This is not expected to work since about 2003. The rules for threading in Swing were changed to say that all object contruction must be done on the event dispatching thread (EDT). Prior to then object contruction was allowed before the top level(Frame) was realised, but that is no longer the case. Almost all code in Swing assumes it is running on the EDT in a single threaded model, Nimbus LAF is no different. There is documented in the Swing Tutorial at http://java.sun.com/docs/books/tutorial/uiswing/concurrency/initial.html" In other words: It may be that Nimbus is more sensible to misuse from outside the EDT than are other L&Fs, but that is the symptom of the problem not the cause. The cause is the misuse.