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

Java Access Bridge, regression, NPE, occurs randomly




        Since 8u20 there are NPEs coming from the JAB code, most likely due to the fix for JDK-8037477. The NPE happens in many different scenarios but the one that can cause it quicker than the rest is to press Alt+F to bring up the menu system and then left/right arrow between the first pulldown and the second pulldown. The problem appears to be due to a mismatch between the reported number of accessible children and the actual number of accessible children. In com.sun.java.accessibility.AccessBridge._getVisibleChild there is this code:

                    final AccessibleContext ac2=InvocationUtils.invokeAndWait(new Callable<AccessibleContext>() {
                        public AccessibleContext call() throws Exception {
                            Accessible a = ac.getAccessibleChild(idx);
                            return a.getAccessibleContext();
                    }, ac);

        That callable is later called in invokeAndWait this try/catch:

                    try {
                        SunToolkit.postEvent(targetAppContext, event);
                        T result = wrapper.getResult();
                        updateAppContextMap(result, targetAppContext);
                        return result;
                    } catch (final Exception e) {
                        throw new RuntimeException(e);

        If there is no accessible for one of the items being iterated through in _getVisibleChild the prior code block will throw an NPE on the line with a.getAccessibleContext(); That NPE will be caught in the second code block and rethrown out to the console.

        A null check could be added to the first block but this should not be needed because there is a call to getAccessibleChildrenCount prior to the first block and each of the children should have a valid accessible.

        This is not an issue with 8u11.


            Issue Links



                • Assignee:
                  ptbrunet Pete Brunet (Inactive)
                  ptbrunet Pete Brunet (Inactive)
                • Votes:
                  0 Vote for this issue
                  3 Start watching this issue


                  • Created: