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.
I'm using DiffController in a Netbeans module suite project. After switching to Netbeans 6.8M1 the JComponent created by DiffController.create() throws NPEs when the component is painted. java.lang.NullPointerException at org.netbeans.modules.diff.builtin.visualizer.editable.LineNumbersActionsBar.paintComponent(LineNumbersActionsBar.java:333) at javax.swing.JComponent.paint(JComponent.java:1029) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1038) at javax.swing.JViewport.paint(JViewport.java:747) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1038) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1038) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1038) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JSplitPane.paintChildren(JSplitPane.java:1030) at javax.swing.JComponent.paint(JComponent.java:1038) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1038) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1038) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1038) at org.netbeans.swing.tabcontrol.TabbedContainer.paint(TabbedContainer.java:968) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1038) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1038) at org.netbeans.core.windows.view.ui.MultiSplitPane.paint(MultiSplitPane.java:325) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1038) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1038) at javax.swing.JLayeredPane.paint(JLayeredPane.java:567) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1038) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1038) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1038) at javax.swing.JLayeredPane.paint(JLayeredPane.java:567) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paintToOffscreen(JComponent.java:5131) at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1475) at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1406) at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:294) at javax.swing.RepaintManager.paint(RepaintManager.java:1220) at javax.swing.JComponent.paint(JComponent.java:1015) at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21) at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60) at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97) at java.awt.Container.paint(Container.java:1780) at org.netbeans.core.windows.view.ui.MainWindow.paint(MainWindow.java:593) at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:814) at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:714) at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:694) [catch] at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:117) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Created attachment 86376 [details] Module suite project showing the issue
In order to reproduce the bug please compile and run the attached module suite project.
You also need to add at least a dependency on Plain Editor. Diff uses some functionality from that module (not directly but through lookup). Add dependency on ide11/Plain Editor, that should help and eliminate the NPE. This is a WA, i'm lowering the priority to P3, but leaving this open. We will try to find a way to eliminate the dependency.
*** Issue 170047 has been marked as a duplicate of this issue. ***
fix: cdev #3f465a28133c
The NPE was thrown because a default editor returned an unsupported TextUI (BaseTextUI is needed). When diff doesn't get an instance of BaseTextUI, it displays a warning message in both panes. In order to make diff working properly it suffices to enable the Plain Editor module (can be found in ide11 cluster - or ide12 for 6.8)
If the Plain Editor module is required for the diff module to work properly, the diff module should have a dependency on the Plain Editor module. Otherwise you will get runtime errors which is not acceptable.
Integrated into 'main-golden', will be available in build *200909151512* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/3f465a28133c User: Ondrej Vrabec <ovrabec@netbeans.org> Log: #170527 - JComponent created by DiffController throws NPE when component is painted Showing a warning message instead the NPE