Le mer. 30 juin 2021 à 11:55, PeterLee <peter...@apache.org> a écrit :
>
> > (1) catch all RuntimeExceptions, wrap them in an IOException (possibly a
> >    subclass) and throw the IOException
>
> -1
>
> I agree with sebb about this option - this may accidentally convert a bug
> into
> something else.
>
> > (2) catch only a subset of all RuntimeExceptions, wrap them in an
> >     IOException (possibly a subclass) and throw the IOException - allow
> >     the remaining RuntimeExceptions to fly through
>
> +1
>
> It may take a lot of work to get the subset, but I think the work is worthy.

IIUC what has been said, the main "problem" is that (some) callers expect
a single exception (whatever the encountered issue with the input) out of
[Compress].  This option does not do them any good.
The task is ill-defined as long as the "subset" remains undefined.  And
furthermore, the same low-level exception could arise from either a bug or
a corrupt input (so, depending which case is uncovered first, bugs could
still go unnoticed).

> > (3) catch all RuntimeExceptions, wrap them in an specific unchecked
> >     exception (which one could be discussed later) and throw this one
>
> -1
>
> > (4) don't catch RuntimeExceptions at all, just document broken archives
> >     can cause arbitrary RuntimeExceptions and code that tries to read
> >     archives from untrusted sources is expected to deal with them
> >     itself.
>
> -0
>
>
> > [...]

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

Reply via email to