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

JTableHeader.AccessibleJTableHeader.getAccessibleChild/At() throw NPE if Win L&F installed

    Details

      Description

      Platform: Windows
      L&F: -Dswing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel
      PASSES: JDK6 all, JDK7 b10
      FAILS: JDK7 b20+
      JCK tests, exist in JCK6 :
      api/javax_swing/table/JTableHeader/AccessibleJTableHeader/index.html#AccessibleComponent[AccessibleJTableHeader0004]
      api/javax_swing/table/JTableHeader/AccessibleJTableHeader/index.html#AccessibleContext[AccessibleJTableHeader0003]

      Please see the following code sample as a combined extract from the tests above:
      --------------------------------------------------------------------------------
      import javax.accessibility.*;
      import javax.swing.*;
      import javax.swing.table.*;
      import java.awt.*;
      import java.lang.reflect.InvocationTargetException;

      public class Header {
          public static void main(String[] args) throws InvocationTargetException, InterruptedException {
              SwingUtilities.invokeAndWait(new Runnable() {
                  public void run() {
                      doTheTest();
                  }
              });
          }

          private static void doTheTest() {
              JTableHeader header = new JTableHeader();
              AccessibleContext accessibleContext = header.getAccessibleContext();
              header.getColumnModel().addColumn(new TableColumn(0));
              try {
                  //#AccessibleContext[AccessibleJTableHeader0003]
                  System.out.println("trying getAccessibleChild(..)");
                  accessibleContext.getAccessibleChild(0);
              } catch (Exception e) {
                  e.printStackTrace();
              }
              AccessibleComponent accessibleComponent = accessibleContext.getAccessibleComponent();

              try {
                  // #AccessibleComponent[AccessibleJTableHeader0004]
                  System.out.println("trying getAccessibleAt(..)");
                  accessibleComponent.getAccessibleAt(new Point());
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      }
      --------------------------------------------------------------------------------

      When executed on JDK7b20+ with -Dswing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel


      trying getAccessibleChild(..)
      java.lang.NullPointerException
      at sun.swing.table.DefaultTableCellHeaderRenderer.getColumnSortOrder(DefaultTableCellHeaderRenderer.java:122)
      at com.sun.java.swing.plaf.windows.WindowsTableHeaderUI$XPDefaultRenderer.getTableCellRendererComponent(WindowsTableHeaderUI.java:126)
      at javax.swing.table.JTableHeader$AccessibleJTableHeader.getAccessibleChild(JTableHeader.java:860)
      at Header.doTheTest(Header.java:23)
      at Header.access$000(Header.java:7)
      at Header$1.run(Header.java:11)
      at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:217)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:603)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:276)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:201)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:191)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:186)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
      trying getAccessibleAt(..)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:139)
      java.lang.NullPointerException
      at sun.swing.table.DefaultTableCellHeaderRenderer.getColumnSortOrder(DefaultTableCellHeaderRenderer.java:122)
      at com.sun.java.swing.plaf.windows.WindowsTableHeaderUI$XPDefaultRenderer.getTableCellRendererComponent(WindowsTableHeaderUI.java:126)
      at javax.swing.table.JTableHeader$AccessibleJTableHeader.getAccessibleAt(JTableHeader.java:818)
      at Header.doTheTest(Header.java:32)
      at Header.access$000(Header.java:7)
      at Header$1.run(Header.java:11)
      at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:217)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:603)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:276)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:201)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:191)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:186)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:139)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                dbessono Dmitry Bessonov
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: