commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <>
Subject [jira] Commented: (MATH-425) New exceptions to replace those in package "linear"
Date Tue, 05 Oct 2010 10:44:33 GMT


Gilles commented on MATH-425:

In the cases where {{MatrixIndexException}} is used as follows:
    throw new MatrixIndexException(LocalizedFormats.ROW_INDEX_OUT_OF_RANGE,
                               row, 0, getRowDimension() - 1);
I think that
    throw new OutOfRangeException(LocalizedFormats.ROW_INDEX,
                              row, 0, getRowDimension() - 1);
would be sufficient: The exception type describes the problem and together with the additional
specific context information, it provides the same level of information as in the former code.

An alternative would be to have both  {{MatrixRowIndexOutOfRangeException}} and {{MatrixColumnIndexOutOfRangeException}}.
This is indeed more focused (and has the advantage of hiding the "Localizable" context within
the classes). However this comes at the cost of two additional exceptions.
Since the direct usage of the exception (the "throw" statement) is mostly in the {{checkRowIndex}}
and {{checkColumnIndex}} methods, the gain in code clarity is marginal.

> New exceptions to replace those in package "linear"
> ---------------------------------------------------
>                 Key: MATH-425
>                 URL:
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Gilles
>            Assignee: Gilles
>            Priority: Minor
>             Fix For: 3.0
> This issue is about removing the current set of exceptions located in the package {{linear}}.
The new exceptions must be located in package {{exception}}.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message