commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benedikt Ritter <brit...@apache.org>
Subject Re: [CSV] CSVFormat validation - do this earlier?
Date Tue, 13 May 2014 15:53:17 GMT
Hi,


2014-05-13 12:06 GMT+02:00 sebb <sebbaz@gmail.com>:

> At present, validate() is not invoked until the format is used. This
> means that invalid arguments are not detected at the point they are
> provided.
>
> It would be possible to run validate as part of the withArgument()
> methods. This would allow earlier detection, and avoid the issue that
> currently some incorrect arguments may generate ISE rather than IAE.
>
> I think the only possible user problem is that escape must be set
> before using Quote.NONE as the policy, but this could be documented.
> Otherwise AFAICT the arguments can be set in any order.
>

Validating the format when it is constructed rather then when it is used is
a good idea. But I think the only way to do this in a usable way is to use
the builder pattern. There are several field that depend on each other
during the validation. We don't want end up having user to look up the
validate code in order to be able to create formats...

Benedikt


>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message