On Thu, 19 Mar 2026 20:52:06 GMT, Eirik Bjørsnøs <[email protected]> wrote:
>> ZipOutputStream::setComment and other setXXf methods throw >> IllegalArgumentException vs ZipException per the javadocs so we have a >> difference to deal as part of how we address the issue >> >> We probably want wrapper method (or overloaded) for at least ZipOutputStream >> so we can avoid multiple try/catch >> >> Also, I am wondering if we should set the cause to an IAE for the thrown >> ZipException. Not sure there is a huge win value-wise, but thought I would >> throw it out for discussion > >> ZipOutputStream::setComment and other setXXf methods throw >> IllegalArgumentException vs ZipException per the javadocs so we have a >> difference to deal as part of how we address the issue > > Yes. I have not proposed any change there in this PR, just added the test to > document current behavior and make any future regressions visible. Did you > mean to suggest we take some other action here? > >> We probably want wrapper method (or overloaded) for at least ZipOutputStream >> so we can avoid multiple try/catch > > I don't think I understand what you suggest here. You mean methods in > ZipCoder as Alan suggested? What do you think about my idea to consolidate > ZipCoder methods to throw mostly CharacterCodingException, as suggested in a > reply to Alan above? > >> Also, I am wondering if we should set the cause to an IAE as the cause to >> the ZipException. Not sure there is a huge win valuewise, but thought I >> would through it out for discussion > > I like it, swallowing exceptions is rarely a win. > A quick prototype to declare toString (with overloads), getBytes, and > checkedHash as `throws CharacterCodingException` revealed no showstoppers. For reference, here's a sketch branch of what I had in mind in terms of consolidating on CharacterCodingException: https://github.com/openjdk/jdk/compare/master...eirbjo:zipcoder-consolidate-exceptions ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/30319#discussion_r2962821096
