Hi Lillian,

On Wed, 2005-10-05 at 17:28 -0400, Lillian Angel wrote:
> Fixed up BasicTreeUI because it was not efficent when painting.
> 
> 2005-10-05  Lillian Angel  <[EMAIL PROTECTED]>
> 
>         * javax/swing/plaf/metal/MetalTreeUI.java
>         (installUI): Fixed to call toggleExpandState instead.
>         * javax/swing/plaf/basic/BasicTreeUI.java
>         (getPathForRow): Used currentVisiblePath to get Path.
>         (getRowForPath): Used currentVisiblePath to get row.
>         (getRowCount): Returned currentVisiblePath length.
>         (updateLayoutCacheExpandedNodes): Took out unneeded code.
>         (installUI): Fixed to call toggleExpandState instead.
>         (getPreferredSize): Made more efficent by using 
>       currentVisiblePath.
>         (toggleExpandState): Called updateCurrentVisiblePath.
>         (getCellLocation): Made more efficent.
>         (paintNode): Removed.
>         (paintRecursive): Made more efficent, changed paintNode calls to
>         paintRow.
>         (getNextVisibleNode): Reimplemented to use currentVisiblePath.
>         (getPreviousVisibleNode): Likewise.
>         (paintRow): Implemented.
>         (updateCurrentVisiblePath): New helper used to cache the current
>         visible path.

This broke junit for me (see stack trace below). The problem is that
newly introduces currentVisiblePath field can be NULL, but is used in
various places without checking whether or not it is NUll.

java.lang.NullPointerException
   at javax.swing.plaf.basic.BasicTreeUI.getPreferredSize 
(BasicTreeUI.java:1474)
   at javax.swing.plaf.basic.BasicTreeUI.getPreferredSize 
(BasicTreeUI.java:1457)
   at javax.swing.JComponent.getPreferredSize (JComponent.java:1083)
   at javax.swing.JViewport.getViewSize (JViewport.java:297)
   at javax.swing.plaf.basic.BasicScrollPaneUI.syncScrollPaneWithViewport 
(BasicScrollPaneUI.java:434)
   at 
javax.swing.plaf.basic.BasicScrollPaneUI$ViewportChangeHandler.stateChanged 
(BasicScrollPaneUI.java:160)
   at javax.swing.JViewport.fireStateChanged (JViewport.java:623)
   at javax.swing.JViewport.revalidate (JViewport.java:422)
   at javax.swing.JComponent$1.run (JComponent.java:2111)
   at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:191)
   at java.awt.EventQueue.dispatchEvent (EventQueue.java:465)
   at java.awt.EventDispatchThread.run (EventDispatchThread.java:75)

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to