random memes }

White box programming

Inherited some code from a younger developer. Not real thrilled with the code, so went about cleaning up. This is the client side of a client/server application. Given this is at least my sixth iteration with a client/server application, the bits done badly are pretty obvious. From the general mash factored out much of the control and model code, but left the UI code mostly untouched. After getting much of the non-UI code cleaned up, started testing, then ran into:

    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at javax.swing.plaf.basic.BasicProgressBarUI.updateSizes(BasicProgressBarUI.java:470)
        at javax.swing.plaf.basic.BasicProgressBarUI.getBox(BasicProgressBarUI.java:427)
        at com.sun.java.swing.plaf.windows.WindowsProgressBarUI.getBox(WindowsProgressBarUI.java:225)
        at com.sun.java.swing.plaf.windows.WindowsProgressBarUI.paintIndeterminate(WindowsProgressBarUI.java:279)
        at javax.swing.plaf.basic.BasicProgressBarUI.paint(BasicProgressBarUI.java:392)
        at javax.swing.plaf.ComponentUI.update(ComponentUI.java:143)
        at javax.swing.JComponent.paintComponent(JComponent.java:763)
        at javax.swing.JComponent.paint(JComponent.java:1027)
        at javax.swing.JComponent.paintChildren(JComponent.java:864)
        at javax.swing.JComponent.paint(JComponent.java:1036)
        at javax.swing.JComponent.paintChildren(JComponent.java:864)
        at javax.swing.JComponent.paint(JComponent.java:1036)
        at javax.swing.JComponent.paintToOffscreen(JComponent.java:5122)
        at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:285)
        at javax.swing.RepaintManager.paint(RepaintManager.java:1128)
        at javax.swing.JComponent._paintImmediately(JComponent.java:5070)
        at javax.swing.JComponent.paintImmediately(JComponent.java:4880)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:723)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:679)
        at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:659)
        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 java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

Though the fault is in pure Sun code, I doubt very much the fault is Sun's. Rather somewhere in the mash of UI written by the local programmer there is most likely something not quite right.

The point is - this is a good example from which to argue for white-box programming. From Eclipse I cannot see the sources associated with the above stacktrace, and cannot guess what might be the root problem. Given sources I have at least some chance of figuring out the underlying problem.

Doubtless if I can obtain the Sun/Java sources there is some way to get Eclipse to pull in the sources (though getting and maintaining an exact match between libraries and sources may be a minor pain).