Continuous exceptions thrown on hover when matrix is small

Issue #368 duplicate
Robert Leach created an issue

USE CASE: WHAT DO YOU WANT TO DO?

Open a file with a very small matrix without errors.

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

  1. Open the new test file named "test_label_case.txt" (available on the downloads page as of 2/22/2016)
  2. Hover the cursor over the matrix

CURRENT BEHAVIOR

A continuous stream of errors like this:

error: tried to retrieve header for  index 43 but max is 4
null
null

EXPECTED BEHAVIOR

No errors and/or console output.

DEVELOPERS ONLY SECTION

SUGGESTED CHANGE (Pseudocode optional)

There's got to be a place where an index out of range of small data is being sent. The size of the data should be checked & adjusted if necessary before making the call.

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

unknown

LEVEL OF EFFORT - developers only

minor

COMMENTS

Went to open a new file with command-o (while the test_label_case.txt was already open) and the console went crazy:

error: tried to retrieve header for  index 43 but max is 4
null
null
error: tried to retrieve header for  index 43 but max is 4
null
null
error: tried to retrieve header for  index 43 but max is 4
null
null
error: tried to retrieve header for  index 43 but max is 4
null
null
error: tried to retrieve header for  index 43 but max is 4
null
null
error: tried to retrieve header for  index 43 but max is 4
null
null

I edited the error message to remove the double space in "for index" in another branch.

Comments (5)

  1. Christopher Keil repo owner

    Issue #213 has me deep down in the trenches because it reveals so much that is going wrong with Preferences and resetting the states of all ModelViews and the MapContainers upon loading a new file.

    This error is caused in LabelView's

    getMaxStringLength(FontMetrics metrics)
    

    by

    longest_str_index 
    

    being far out of bounds despite the HeaderInfo and HeaderSummary being up to date. It's never recalculated / reset when a new model loads and frankly I can't even figure it out due to the massive complexity in LabelView (over 3000 lines of code...; 48 member variables describing the state... (without the inherited ones...)). Line number is not important, but it indicates that the LabelView class might handle too many responsibilities... idk.

    The problematic line(s):

    longest_str.equals(headerSummary.getSummary(headerInfo, longest_str_index))
    

    It's trying to retrieve a header at an index that doesn't even exist anymore (eg. longest_str_index = 89 although the number of labels is only 31).

    In order to make #213 work in any sort of stable and reliable way I have to do A LOT and the process constantly keeps revealing issues such as the one posted here, continuously digging the trench deeper.

  2. Robert Leach reporter
    • removed milestone

    Removing milestone: Coding Convention Adherence (automated comment)

  3. Log in to comment