commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benedikt Ritter (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CSV-113) Check whether ISE/IAE are being used appropriately
Date Tue, 06 May 2014 17:21:14 GMT

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

Benedikt Ritter commented on CSV-113:
-------------------------------------

bq. CSVFormat.validate() should throw IAE not ISE

CSVFormat.validate() doesn't take parameters. I guess that's the rational for not throwing
IAE. What sense does throwing IAE make if no arguments have been passed.

bq. CSVParser.initializeHeader() throws ISE. The header probably ought to be validated in
the CSVFormat constructor.

yes or in withHeader(String...) if possible

bq. Should null parameters throw IAE or NPE?

In my opinion if a null reference is passed to a method that can not handle null, this is
an illegal argument and IAE should be thrown. But since the JDK itself handles null inputs
by throwing NPE it may be better to align the design this way.

> Check whether ISE/IAE are being used appropriately
> --------------------------------------------------
>
>                 Key: CSV-113
>                 URL: https://issues.apache.org/jira/browse/CSV-113
>             Project: Commons CSV
>          Issue Type: Task
>            Reporter: Sebb
>
> The code throws a lot of IllegalStateExceptions (ISE).
> It also throws some IllegalArgumentExceptions (IAE).
> These need reviewing to check that ISE really does apply to the current state, and IAE
is used for reporting an incorrect argument.
> Generally if ISE applies, no argument values will be valid.
> IAE should be used when a specific argument or set of arguments is invalid.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message