swingx
  1. swingx
  2. SWINGX-1536

ListSortUI calling method with wrong argument

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.6.1
    • Fix Version/s: 1.6.5-1
    • Component/s: Sort/filter
    • Labels:
      None

      Description

      This is a straightforward bug and it's obvious within secs of checking.
      In ListSortUI class:
      private void prepareForChange(ModelChange change) there is a call to modelSelection.insertIndexInterval(change.startModelIndex, change.endModelIndex, true);

      The 2nd arg should be a length rather than an end index.

      The same bug exists in JTable.SortManager.cacheSelection. I reported to Oracle, but I couldn't get Oracle to fix it.

      Thanks.

        Activity

        Hide
        rmk_lp added a comment -

        Spotted by a colleague of mine:

        The fix seems to have introduced a new bug as the second argument of removeIndexInterval according to its javadoc is supposed to be an index and not the length as opposed to insertIndexInterval.

        case ListDataEvent.INTERVAL_REMOVED:
        modelSelection.removeIndexInterval(change.startModelIndex,
        // remove is fixed without test
        change.length);
        break;
        case ListDataEvent.INTERVAL_ADDED:
        modelSelection.insertIndexInterval(change.startModelIndex,
        // insert is tested
        change.length, true);
        break;

        Show
        rmk_lp added a comment - Spotted by a colleague of mine: The fix seems to have introduced a new bug as the second argument of removeIndexInterval according to its javadoc is supposed to be an index and not the length as opposed to insertIndexInterval. case ListDataEvent.INTERVAL_REMOVED: modelSelection.removeIndexInterval(change.startModelIndex, // remove is fixed without test change.length); break; case ListDataEvent.INTERVAL_ADDED: modelSelection.insertIndexInterval(change.startModelIndex, // insert is tested change.length, true); break;
        Hide
        kleopatra added a comment -

        darn ... guilty of not reading the api doc

        Thanks, will fix soon!
        Jeanette

        Show
        kleopatra added a comment - darn ... guilty of not reading the api doc Thanks, will fix soon! Jeanette
        Hide
        rmk_lp added a comment -

        Great, thank you!

        Robert

        Show
        rmk_lp added a comment - Great, thank you! Robert
        Hide
        kleopatra added a comment -
        • reverted incorrect change to removeInterval (note: api is different from insertInterval!)
        • added test and visual check

        Compliments to your colleague - good eyes

        Cheers
        Jeanette

        Show
        kleopatra added a comment - reverted incorrect change to removeInterval (note: api is different from insertInterval!) added test and visual check Compliments to your colleague - good eyes Cheers Jeanette
        Hide
        kleopatra added a comment -

        fyi: the table bug is fixed in core for jdk8 (and probably backported to 6/7, didn't verify)

        http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8005019

        Show
        kleopatra added a comment - fyi: the table bug is fixed in core for jdk8 (and probably backported to 6/7, didn't verify) http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8005019

          People

          • Assignee:
            kleopatra
            Reporter:
            nj1308
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1 hour
              1h
              Remaining:
              Remaining Estimate - 1 hour
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified