Rare whizzing background NullPointerException cripples UI

Issue #360 resolved
Christopher Keil repo owner created an issue

USE CASE: WHAT DO YOU WANT TO DO?

Display a matrix file in the main TreeView3 UI.

STEPS TO REPRODUCE AN ISSUE (OR TRIGGER A NEW FEATURE)

Seemingly random to reproduce (I am sure it's not though).

  1. Load a file OR cluster a file
  2. Wait for clustered file to load

CURRENT BEHAVIOR

Upon setting up the UI, a NullPointerException occurs in TRView.drawWhizBackground(). The UI stops being drawn / set up. It becomes unresponsive and most elements are not displayed. Hovering over elements (invisible) causes a revalidate/ repaint to be triggered upon which elements are finally displayed, but not all.

EXPECTED BEHAVIOR

No Exception blocks the UI layout setup and application remains responsive.

DEVELOPERS ONLY SECTION

SUGGESTED CHANGE (Pseudocode optional)

Use Eclipse debugger and break points to find out why some variable is null. If null case cannot be avoided 100%, handle null case elegantly (by drawing an alternative or no background).

FILES AFFECTED (where the changes will be implemented) - developers only

TRView.java, RowTreeView.java, ColumnTreeView.java

LEVEL OF EFFORT - developers only

minor

COMMENTS

null_tree.PNG

Comments (5)

  1. Robert Leach

    I am unable to reproduce this error given the steps you've provided in the current master. Is there a specific file you are loading/clustering? Line 86 of RowTreeView has:

    (double) map.getNumVisibleLabels()

    which is a part of this entire statements:

            g.fillRect(0,(int) scaleEq.transform((double) map.getFirstVisibleLabel()),
                getSecondaryPaneSize(offscreenSize),
                (int) scaleEq.transform((double) map.getFirstVisible() +
                    (double) map.getNumVisibleLabels()));
    

    I'm not sure if this line 86 is the same as when you got the error. Do you know if that's the case?

    All I can guess from this is that perhaps the map variable is still null by the time this method gets called...

    I do have this check at the top of the method where the error occurs:

            if(map.getFirstVisibleLabel() < 0) {
                return;
            }
    

    I could add a check on map to make sure it's not null... That's all I can think of to do.

  2. Log in to comment