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

NPE in DefaultTableCellHeaderRenderer.getColumnSortOrder() with null table

XMLWordPrintable

    • b03
    • generic, x86
    • windows, windows_vista
    • Not verified

        FULL PRODUCT VERSION :


        A DESCRIPTION OF THE PROBLEM :
        Passing a null table to DefaultTableCellHeaderRenderer.getColumnSortOrder() causes a NullPointerException. This problem was probably introduced by a fix to 6668281 that came out in 1.6.0_10.



        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        java.lang.NullPointerException
        at sun.swing.table.DefaultTableCellHeaderRenderer.getColumnSortOrder(Unknown Source)
        at com.sun.java.swing.plaf.windows.WindowsTableHeaderUI$XPDefaultRenderer.getTableCellRendererComponent(Unknown Source)


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import javax.swing.*;
        import javax.swing.table.JTableHeader;
        import javax.swing.table.TableCellRenderer;

        public class Bug6668281 {

            private static void createGui() {

                try {
                    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                } catch (Exception e) {
                    e.printStackTrace();
                }
                JTable table = new JTable();
                JTableHeader header = table.getTableHeader();
                TableCellRenderer headerRenderer = header.getDefaultRenderer();
                headerRenderer.getTableCellRendererComponent(null, "test", false, true, -1, 0);
                System.out.println("end...");
            }

            public static void main(String[] args) throws Exception {
                Bug6668281.createGui();
            }
        }

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        Two workarounds listed for 6668281 worked for me too:

        Workaround #1
        1. Right-click on the application shortcut.
        2. Select "Property"
        3. Click on "Compatibility"
        4. Click on the box "Disable Visual Theme"

        Workaround #2
        1. Right click on an empty part of the desktop.
        2. Select "Personalize"
        3. Click "Window Color and Appearance"
        4. If currently using Aero, then click "Open classic appearance properties" link at bottom, OTHERWISE skip to step 5.
        5. In the Color scheme list, click "Windows Classic" and then click OK.
        6. Restart your broken Java app -- the exception should now not be thrown.

        Release Regression From : 6u10
        The above release value was the last known release where this
        bug was not reproducible. Since then there has been a regression.

              alexp Alexander Potochkin (Inactive)
              igor Igor Nekrestyanov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: