Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE in BlocksTableModel.getValueAt() during JSwing repaint #71

Open
catbref opened this issue Dec 7, 2017 · 3 comments
Open

NPE in BlocksTableModel.getValueAt() during JSwing repaint #71

catbref opened this issue Dec 7, 2017 · 3 comments
Labels

Comments

@catbref
Copy link
Collaborator

catbref commented Dec 7, 2017

2017-12-04 14:34:58 ERROR DBMap:119 - 
java.lang.ArrayIndexOutOfBoundsException
2017-12-04 14:34:58 ERROR BlocksTableModel:109 - 
java.lang.NullPointerException
        at gui.models.BlocksTableModel.getValueAt(BlocksTableModel.java:82)
        at javax.swing.JTable.getValueAt(Unknown Source)
        at javax.swing.JTable.prepareRenderer(Unknown Source)
        at javax.swing.plaf.basic.BasicTableUI.paintCell(Unknown Source)
        at javax.swing.plaf.basic.BasicTableUI.paintCells(Unknown Source)
        at javax.swing.plaf.basic.BasicTableUI.paint(Unknown Source)
        at javax.swing.plaf.ComponentUI.update(Unknown Source)
        at javax.swing.JComponent.paintComponent(Unknown Source)
        at javax.swing.JComponent.paint(Unknown Source)
        at javax.swing.JComponent.paintChildren(Unknown Source)
        at javax.swing.JComponent.paint(Unknown Source)
        at javax.swing.JViewport.paint(Unknown Source)
        at javax.swing.JComponent.paintChildren(Unknown Source)
        at javax.swing.JComponent.paint(Unknown Source)
        at javax.swing.JComponent.paintChildren(Unknown Source)
        at javax.swing.JComponent.paint(Unknown Source)
        at javax.swing.JComponent.paintChildren(Unknown Source)
        at javax.swing.JComponent.paint(Unknown Source)
        at javax.swing.JComponent.paintToOffscreen(Unknown Source)
        at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
        at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
        at javax.swing.RepaintManager.paint(Unknown Source)
        at javax.swing.JComponent._paintImmediately(Unknown Source)
        at javax.swing.JComponent.paintImmediately(Unknown Source)
        at javax.swing.RepaintManager$4.run(Unknown Source)
        at javax.swing.RepaintManager$4.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
        at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
        at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
        at javax.swing.RepaintManager.access$1200(Unknown Source)
        at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.awt.EventQueue.access$500(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

Note that the DBMap frame may/may not be relevant!

@catbref
Copy link
Collaborator Author

catbref commented Dec 7, 2017

There are several similar errors but looks like the common root is BlocksTableModel.java line 76:
Block block = blocks.get(row).getB();
where block is assigned null.

Both blocks.get(row) and then .getB() don't throw so there is an entry in blocks at index row but why is it null?

@catbref catbref added the bug label Dec 7, 2017
@ghost
Copy link

ghost commented Apr 4, 2018

Just tried to reproduce this bug but wasn't able to.
Is there any more information about the use case that leads to this exception?

@ghost
Copy link

ghost commented Apr 4, 2018

I didn't follow every single control path yet and I'm not sure if this can even occur, so please bear with me, given my limited understanding of the code. Anyhow, I guess it might be a threading problem:

As far as I saw, SortableList is not thread safe (or I didn't grasp the concept :) ).

A list of this type is returned from BlocksTableModel.getSortableList() and sorted in QoraRowSorter (l.45):
this.model.getSortableList().sort(this.indexes.get(column), order.equals(SortOrder.DESCENDING));

If another thread calls BlocksTableModel.getValueAt(..) at the same time the list is sorted, this could lead to almost any result, including a null value.

A similar problem could be the cause for issue #70.

Possible or complete nonsense?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant