Le dim. 27 juin 2021 à 21:15, Stefan Bodewig <bode...@apache.org> a écrit : > > On 2021-06-27, Gilles Sadowski wrote: > > > Hi. > > >> [...] > > >> it seemed Gilles was opposed to this idea > > > Rather (IIRC) my last comment was that it was your choice as to > > what the API should look like. > > Sorry, I didn't mean to misrepresent your POV.
You didn't misrepresent my opinion; just that it doesn't count if the requirement is to not depart from what was done in the past in [Compress]. > > > My opinion on the matter was along Gary's lines (which is J. Bloch's > > rationale provided in "Effective Java"). > > Indeed I personally would indeed *not* pick option 1 because it puts > > the onus on the Commons library whereas input that does not comply > > with preconditions (i.e. a supported format) should unsurprisingly > > throw an IAE. > > In which case we need to catch all the other RuntimeExceptions and turn > them into IAEs, right? :-) Well, yes, if the code has detected illegal input! But, again, if prefer to throw an "IOException"... There is no arguing about taste and/or backward compatibility/ > Some if we want to throws any other specific RuntimeException following > Matt's suggestion. > > We are already throwing checked IOExceptions for invalid archives in > many many cases today. Our users expect us to do so for all invalid > archives - well some of them. Then fine (so to speak). :-} > As I said, we can as well document that each method could throw > arbitrary RuntimeExceptions, but I don't believe we can list the kinds > of RuntimeExceptions exhaustively Why not? Listing all runtime exceptions is considered part of good documentation. > - if we knew which exceptions can be > thrown, then we could as well check the error conditions ourselves > beforehand. I don't follow... Regards, Gilles > > Stefan --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org