On Thu, 10 Mar 2022 15:10:42 GMT, Anton Litvinov <[email protected]> wrote:
>> src/java.desktop/share/classes/javax/swing/JTable.java line 8417:
>>
>>> 8415: if (ac != null) {
>>> 8416: return ac.getAccessibleAction();
>>> 8417: }
>>
>> This is the fix for possible NPE, right?
>
> Yes, correct, this "if" condition is a fix for possible NPE, the method
> "javax.swing.JTable.AccessibleJTable.AccessibleJTableCell.getCurrentAccessibleContext()"
> may return "null" according to its documentation and to its code. I already
> took into account this possible NPE in the 1st and 2nd versions of the fix
> for this bug, and saw it amoral not to take it into account in the 3rd
> version of the fix, therefore I added this "if (ac != null) {" block in the
> 3rd fix version.
Got it! Thanks.
>> test/jdk/javax/accessibility/JTable/BooleanRendererHasAccessibleActionTest.java
>> line 48:
>>
>>> 46: import javax.swing.table.TableCellRenderer;
>>> 47:
>>> 48: public class BooleanRendererHasAccessibleActionTest {
>>
>> Would `BooleanRendererHasNoAccessibleActionTest` be a better name? After
>> all, you test for *no* accessible action.
>
> For almost 10 years of fixing bugs in JDK, I have always given names to the
> regression tests to describe exactly the failing test scenario, rather then
> the expected and not failing behavior. So for me the test name
> "BooleanRendererHasNoAccessibleActionTest" would mean that the test should
> fail when BooleanRenderer does not have "AccessibleAction", and this is the
> opposite from what the bug and what I am fixing by the 3rd fix version. I am
> not going to change the test name.
Makes sense.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7416