NullPointerException at javax.swing.JTable.prepareRenderer

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

NullPointerException at javax.swing.JTable.prepareRenderer

Michael Heuer
All,

I am running into this exception in a moderately complex multithreaded
app with glazedlists 1.9.0 using TableFormat, SortedList,
GlazedListsSwing.eventTableModelWithThreadProxyList, and
TableComparatorChooser.

It happens only on JDK 6 and not on JDK 7.  As far as I can tell via
OpenJDK there aren't significant differences in the JTable source code
in this method.

http://hg.openjdk.java.net/jdk6/jdk6/jdk/file/f5cd977fb920/src/share/classes/javax/swing/JTable.java
http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/23fd99021d35/src/share/classes/javax/swing/JTable.java

Screen cast is here

http://youtu.be/rMWwFPChCoM

although it may not be that helpful.  I believe the UI redraw problems
are caused by many of these exceptions being thrown.

Has anyone seen this before?


Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at javax.swing.JTable.prepareRenderer(JTable.java:5718)
    at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:2072)
    at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:1974)
    at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:1770)
    at javax.swing.plaf.ComponentUI.update(ComponentUI.java:153)
    at javax.swing.JComponent.paintComponent(JComponent.java:760)
    at javax.swing.JComponent.paint(JComponent.java:1037)
    at javax.swing.JComponent.paintChildren(JComponent.java:870)
    at javax.swing.JComponent.paint(JComponent.java:1046)
    at javax.swing.JViewport.paint(JViewport.java:795)
    at javax.swing.JComponent.paintChildren(JComponent.java:870)
    at javax.swing.JComponent.paint(JComponent.java:1046)
    at javax.swing.JComponent.paintChildren(JComponent.java:870)
    at javax.swing.JComponent.paint(JComponent.java:1046)
    at javax.swing.JComponent.paintChildren(JComponent.java:870)
    at javax.swing.JComponent.paint(JComponent.java:1046)
    at javax.swing.JComponent.paintChildren(JComponent.java:870)
    at javax.swing.JComponent.paint(JComponent.java:1046)
    at javax.swing.JComponent.paintChildren(JComponent.java:870)
    at javax.swing.JComponent.paint(JComponent.java:1046)
    at javax.swing.JComponent.paintChildren(JComponent.java:870)
    at javax.swing.JComponent.paint(JComponent.java:1046)
    at javax.swing.JComponent.paintChildren(JComponent.java:870)
    at javax.swing.JComponent.paint(JComponent.java:1046)
    at javax.swing.JLayeredPane.paint(JLayeredPane.java:567)
    at javax.swing.JComponent.paintChildren(JComponent.java:870)
    at javax.swing.JComponent.paint(JComponent.java:1046)
    at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:34)
    at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
    at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
    at java.awt.Container.paint(Container.java:1792)
    at java.awt.Window.paint(Window.java:3393)
    at javax.swing.RepaintManager$3.run(RepaintManager.java:836)
    at javax.swing.RepaintManager$3.run(RepaintManager.java:802)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:802)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:745)
    at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:725)
    at javax.swing.RepaintManager.access$1000(RepaintManager.java:46)
    at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1680)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715)
    at java.awt.EventQueue.access$400(EventQueue.java:82)
    at java.awt.EventQueue$2.run(EventQueue.java:676)
    at java.awt.EventQueue$2.run(EventQueue.java:674)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:685)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


Thanks in advance,

   michael
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: NullPointerException at javax.swing.JTable.prepareRenderer

James Lemieux
Hmmm, tough to nail this down from the stack trace and the source code links as line 5718 in both source files is completely innocuous:
 
JDK 6: boolean hasFocus = false;
JDK 7: Object value = getValueAt(row, column);

Is it possible you're using a different minor version of OpenJDK and the line numbers aren't lining up perfectly?

I'd recommend setting a breakpoint in prepareRenderer and start examining some stuff.

Note: if that's difficult because there are a lot of tables in play, a simple trick is to temporarily make a subclass of JTable, override prepareRenderer and set breakpoints within the overridden method. This will filter out the meaningless calls from all the other tables.

James


On Mon, Oct 21, 2013 at 3:13 PM, Michael Heuer <[hidden email]> wrote:
All,

I am running into this exception in a moderately complex multithreaded
app with glazedlists 1.9.0 using TableFormat, SortedList,
GlazedListsSwing.eventTableModelWithThreadProxyList, and
TableComparatorChooser.

It happens only on JDK 6 and not on JDK 7.  As far as I can tell via
OpenJDK there aren't significant differences in the JTable source code
in this method.

http://hg.openjdk.java.net/jdk6/jdk6/jdk/file/f5cd977fb920/src/share/classes/javax/swing/JTable.java
http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/23fd99021d35/src/share/classes/javax/swing/JTable.java

Screen cast is here

http://youtu.be/rMWwFPChCoM

although it may not be that helpful.  I believe the UI redraw problems
are caused by many of these exceptions being thrown.

Has anyone seen this before?


Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at javax.swing.JTable.prepareRenderer(JTable.java:5718)
    at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:2072)
    at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:1974)
    at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:1770)
    at javax.swing.plaf.ComponentUI.update(ComponentUI.java:153)
    at javax.swing.JComponent.paintComponent(JComponent.java:760)
    at javax.swing.JComponent.paint(JComponent.java:1037)
    at javax.swing.JComponent.paintChildren(JComponent.java:870)
    at javax.swing.JComponent.paint(JComponent.java:1046)
    at javax.swing.JViewport.paint(JViewport.java:795)
    at javax.swing.JComponent.paintChildren(JComponent.java:870)
    at javax.swing.JComponent.paint(JComponent.java:1046)
    at javax.swing.JComponent.paintChildren(JComponent.java:870)
    at javax.swing.JComponent.paint(JComponent.java:1046)
    at javax.swing.JComponent.paintChildren(JComponent.java:870)
    at javax.swing.JComponent.paint(JComponent.java:1046)
    at javax.swing.JComponent.paintChildren(JComponent.java:870)
    at javax.swing.JComponent.paint(JComponent.java:1046)
    at javax.swing.JComponent.paintChildren(JComponent.java:870)
    at javax.swing.JComponent.paint(JComponent.java:1046)
    at javax.swing.JComponent.paintChildren(JComponent.java:870)
    at javax.swing.JComponent.paint(JComponent.java:1046)
    at javax.swing.JComponent.paintChildren(JComponent.java:870)
    at javax.swing.JComponent.paint(JComponent.java:1046)
    at javax.swing.JLayeredPane.paint(JLayeredPane.java:567)
    at javax.swing.JComponent.paintChildren(JComponent.java:870)
    at javax.swing.JComponent.paint(JComponent.java:1046)
    at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:34)
    at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
    at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
    at java.awt.Container.paint(Container.java:1792)
    at java.awt.Window.paint(Window.java:3393)
    at javax.swing.RepaintManager$3.run(RepaintManager.java:836)
    at javax.swing.RepaintManager$3.run(RepaintManager.java:802)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:802)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:745)
    at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:725)
    at javax.swing.RepaintManager.access$1000(RepaintManager.java:46)
    at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1680)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715)
    at java.awt.EventQueue.access$400(EventQueue.java:82)
    at java.awt.EventQueue$2.run(EventQueue.java:676)
    at java.awt.EventQueue$2.run(EventQueue.java:674)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:685)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


Thanks in advance,

   michael

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: NullPointerException at javax.swing.JTable.prepareRenderer

Michael Heuer
James Lemieux <[hidden email]> wrote:
> Hmmm, tough to nail this down from the stack trace and the source code links
> as line 5718 in both source files is completely innocuous:
>
> JDK 6: boolean hasFocus = false;
> JDK 7: Object value = getValueAt(row, column);
>
> Is it possible you're using a different minor version of OpenJDK and the
> line numbers aren't lining up perfectly?

Yep, I didn't go looking for release tags in those source links.  My
guess is the null is the selection or column model, although I
couldn't explain either.


> I'd recommend setting a breakpoint in prepareRenderer and start examining
> some stuff.
>
> Note: if that's difficult because there are a lot of tables in play, a
> simple trick is to temporarily make a subclass of JTable, override
> prepareRenderer and set breakpoints within the overridden method. This will
> filter out the meaningless calls from all the other tables.

I would like to do so, but my code is an app loaded via OSGi into a
much larger app (Cytoscape) and is running on a task thread separate
from the AWT event thread and relies on other libraries I wrote and
yeah it is complicated to debug.  :)

I will start trying to isolate a test case.

   michael


> On Mon, Oct 21, 2013 at 3:13 PM, Michael Heuer <[hidden email]> wrote:
>>
>> All,
>>
>> I am running into this exception in a moderately complex multithreaded
>> app with glazedlists 1.9.0 using TableFormat, SortedList,
>> GlazedListsSwing.eventTableModelWithThreadProxyList, and
>> TableComparatorChooser.
>>
>> It happens only on JDK 6 and not on JDK 7.  As far as I can tell via
>> OpenJDK there aren't significant differences in the JTable source code
>> in this method.
>>
>>
>> http://hg.openjdk.java.net/jdk6/jdk6/jdk/file/f5cd977fb920/src/share/classes/javax/swing/JTable.java
>>
>> http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/23fd99021d35/src/share/classes/javax/swing/JTable.java
>>
>> Screen cast is here
>>
>> http://youtu.be/rMWwFPChCoM
>>
>> although it may not be that helpful.  I believe the UI redraw problems
>> are caused by many of these exceptions being thrown.
>>
>> Has anyone seen this before?
>>
>>
>> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
>>     at javax.swing.JTable.prepareRenderer(JTable.java:5718)
>>     at
>> javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:2072)
>>     at
>> javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:1974)
>>     at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:1770)
>>     at javax.swing.plaf.ComponentUI.update(ComponentUI.java:153)
>>     at javax.swing.JComponent.paintComponent(JComponent.java:760)
>>     at javax.swing.JComponent.paint(JComponent.java:1037)
>>     at javax.swing.JComponent.paintChildren(JComponent.java:870)
>>     at javax.swing.JComponent.paint(JComponent.java:1046)
>>     at javax.swing.JViewport.paint(JViewport.java:795)
>>     at javax.swing.JComponent.paintChildren(JComponent.java:870)
>>     at javax.swing.JComponent.paint(JComponent.java:1046)
>>     at javax.swing.JComponent.paintChildren(JComponent.java:870)
>>     at javax.swing.JComponent.paint(JComponent.java:1046)
>>     at javax.swing.JComponent.paintChildren(JComponent.java:870)
>>     at javax.swing.JComponent.paint(JComponent.java:1046)
>>     at javax.swing.JComponent.paintChildren(JComponent.java:870)
>>     at javax.swing.JComponent.paint(JComponent.java:1046)
>>     at javax.swing.JComponent.paintChildren(JComponent.java:870)
>>     at javax.swing.JComponent.paint(JComponent.java:1046)
>>     at javax.swing.JComponent.paintChildren(JComponent.java:870)
>>     at javax.swing.JComponent.paint(JComponent.java:1046)
>>     at javax.swing.JComponent.paintChildren(JComponent.java:870)
>>     at javax.swing.JComponent.paint(JComponent.java:1046)
>>     at javax.swing.JLayeredPane.paint(JLayeredPane.java:567)
>>     at javax.swing.JComponent.paintChildren(JComponent.java:870)
>>     at javax.swing.JComponent.paint(JComponent.java:1046)
>>     at
>> java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:34)
>>     at
>> sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
>>     at
>> sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
>>     at java.awt.Container.paint(Container.java:1792)
>>     at java.awt.Window.paint(Window.java:3393)
>>     at javax.swing.RepaintManager$3.run(RepaintManager.java:836)
>>     at javax.swing.RepaintManager$3.run(RepaintManager.java:802)
>>     at java.security.AccessController.doPrivileged(Native Method)
>>     at
>> java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
>>     at
>> javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:802)
>>     at
>> javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:745)
>>     at
>> javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:725)
>>     at javax.swing.RepaintManager.access$1000(RepaintManager.java:46)
>>     at
>> javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1680)
>>     at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
>>     at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715)
>>     at java.awt.EventQueue.access$400(EventQueue.java:82)
>>     at java.awt.EventQueue$2.run(EventQueue.java:676)
>>     at java.awt.EventQueue$2.run(EventQueue.java:674)
>>     at java.security.AccessController.doPrivileged(Native Method)
>>     at
>> java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
>>     at java.awt.EventQueue.dispatchEvent(EventQueue.java:685)
>>     at
>> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
>>     at
>> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
>>     at
>> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
>>     at
>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
>>     at
>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
>>     at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
>>
>>
>> Thanks in advance,
>>
>>    michael
>
>
Loading...