RFR: 6218162: DefaultTableColumnModel.getColumn() method should mention ArrayIndexOutOfBoundsException
Alexey Ivanov
aivanov at openjdk.java.net
Wed Feb 23 16:49:50 UTC 2022
On Wed, 23 Feb 2022 11:20:55 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
> If invalid ie 0 or > getColumnCount() index is passed to DefaultTableColumnModel.getColumn() then it returns AIOBE in current implementation which should be documented in the spec. Fixed the spec to mention the exception.
This change probably requires a CSR.
src/java.desktop/share/classes/javax/swing/table/DefaultTableColumnModel.java line 294:
> 292: * at <code>columnIndex</code>
> 293: * @exception ArrayIndexOutOfBoundsException if <code>columnIndex</code>
> 294: * is not in valid range (< 0 or >= getColumnCount())
Suggestion:
* @exception ArrayIndexOutOfBoundsException if <code>columnIndex</code>
* is not in the valid range (< 0 or >= getColumnCount())
I find it confusing: the expression in parenthesis seems to clarify the meaning of *the valid range* but doesn't.
I think it's better to make it clearer:
Suggestion:
* @exception ArrayIndexOutOfBoundsException if <code>columnIndex</code>
* is out of range (<code>columnIndex < 0 || columnIndex >= getColumnCount()</code>)
-------------
Changes requested by aivanov (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/7587
More information about the client-libs-dev
mailing list