Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6310376

javax.swing.DefaultRowSorter.getSortKeys() method throws unspecified exception

XMLWordPrintable

    • b92
    • generic
    • generic

      In spec is written:

      public java.util.List<RowSorter.SortKey> getSortKeys()

          Returns the current sort keys. This must not return null.

          Specified by:
              getSortKeys in class RowSorter

          Returns:
              the current sort order


      If I run the following code:
      TableModel dataModel = new DefaultTableModel(5,3);
      TableRowSorter rs = new TableRowSorter(dataModel);
      LinkedList<RowSorter.SortKey> keys =
      new LinkedList<RowSorter.SortKey>();
      keys.add(new RowSorter.SortKey(0, SortOrder.DESCENDING));
      rs.setSortKeys(keys);
      rs.getSortKeys().add( new RowSorter.SortKey(0, SortOrder.DESCENDING));

      I get:
      java.lang.UnsupportedOperationException
      at java.util.Collections$UnmodifiableCollection.add(Collections.java:1021)
      at SorterChanged.convertRowIndexToModel0002(SorterChanged.java:265)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at javasoft.sqe.javatest.lib.MultiTest.invokeTestCase(MultiTest.java:399)
      at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:195)
      at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:127)
      at SorterChanged.main(SorterChanged.java:74)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:86)

      This exception is not specified.

            svioletsunw Scott Violet (Inactive)
            ynovozhi Yulia Novozhilova (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: