[
https://issues.apache.org/jira/browse/MATH-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12917937#action_12917937
]
Gilles commented on MATH-425:
-----------------------------
In the cases where {{MatrixIndexException}} is used as follows:
{code}
throw new MatrixIndexException(LocalizedFormats.ROW_INDEX_OUT_OF_RANGE,
row, 0, getRowDimension() - 1);
{code}
I think that
{code}
throw new OutOfRangeException(LocalizedFormats.ROW_INDEX,
row, 0, getRowDimension() - 1);
{code}
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: https://issues.apache.org/jira/browse/MATH-425
> 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.