On Sat, Feb 22, 2020 at 5:25 PM Gary Gregory <[email protected]> wrote:
> I would like to do the same in Lang as with Collections (see below.)\ > > We currently perform checks like: > > Validate.isTrue(foo != null, ...) > > Which should be IMO: > > Validate.notNull(foo, ...); > > The difference being that the former throws IAE and the later NPE. > > As with [collections], my argument is the same, the JRE uses > Objects.requireNonNull() to throw an NPE, so I'd like to keep normalizing > on that. > Any thoughts? Should I proceed? Gary > > Gary > > ---------- Forwarded message --------- > From: Gary Gregory <[email protected]> > Date: Tue, Dec 10, 2019 at 9:59 AM > Subject: Re: [collection] NPE vs IAE in > org.apache.commons.collections4.CollectionUtils > To: Commons Developers List <[email protected]>, Bruno P. Kinoshita < > [email protected]> > > > FTR, using requireNonNull is also an 'Effective Java' recommendation. > > Gary > > On Thu, Dec 5, 2019 at 4:54 PM Bruno P. Kinoshita > <[email protected]> wrote: > >> +1 for NPE >> >> On Friday, 6 December 2019, 5:22:34 am NZDT, Gary Gregory < >> [email protected]> wrote: >> >> Hi All: >> >> org.apache.commons.collections4.CollectionUtils contains a mix of checking >> for null inputs by throwing NullPointerExceptions in some methods and >> IllegalArgumentExceptions in others. >> >> I propose we standardized to NPE simply because the JRE provides >> Objects.requireNonNull() just for this purpose. >> >> Gary >> > >
