You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gilles Sadowski (Jira)" <ji...@apache.org> on 2020/12/11 18:43:00 UTC

[jira] [Commented] (MATH-1565) Fix included: MatrixUtils.checkColumnIndex() uses COLUMN_INDEX instead of COLUMN_INDEX_OUT_OF_RANGE

    [ https://issues.apache.org/jira/browse/MATH-1565?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17248111#comment-17248111 ] 

Gilles Sadowski commented on MATH-1565:
---------------------------------------

Unit tests added in commit a2c3868fb8115bccb2920d89388927ff889f619c ("master" branch).

bq. MatrixUtils.checkColumnIndex() uses COLUMN_INDEX instead of COLUMN_INDEX_OUT_OF_RANGE

As it should be.
Instead of using many, many message templates, exceptions classes can use a feature ({{ExceptionContext}}) that allows stacking of additional information about the failure.  The problem was in class {{OutOfRangeException}} (see [commit 323f6d71531599127e3b8edd5e13da2ea2c23c97|https://gitbox.apache.org/repos/asf?p=commons-math.git;a=commit;h=323f6d71531599127e3b8edd5e13da2ea2c23c97]).

Thanks for the report, and the tests.


> Fix included: MatrixUtils.checkColumnIndex() uses COLUMN_INDEX instead of COLUMN_INDEX_OUT_OF_RANGE
> ---------------------------------------------------------------------------------------------------
>
>                 Key: MATH-1565
>                 URL: https://issues.apache.org/jira/browse/MATH-1565
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.6.1
>            Reporter: Randy Strauss
>            Priority: Trivial
>         Attachments: MatrixUtils.java, MatrixUtilsTest.java, diff.txt
>
>
> MatrixUtils.checkColumnIndex() uses COLUMN_INDEX instead of COLUMN_INDEX_OUT_OF_RANGE
>  similarly for checkRowIndex
> Note that testing could run a script that searches the code for all the LocalizedFormats, and complains if any of them are not used.  In this case, it would have caught this error.
> Another test that would have caught it is parsing the code and checking that the number of arguments matches the number of percent signs.
> =====
> Attached is a fix and a test, both a diff and the 2 files.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)