On Thu, 19 Mar 2026 21:33:09 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
>> 
>> 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

> > 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

> 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?

Apologies for not b being clearer.  I would like to avoid the extra 
try-with-resources in putNextEntry() if we can

I see writeLOC does

`byte[] nameBytes = zc.getBytes(e.name);`

We will probably want to throw ZipException here

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/30319#discussion_r2966673647

Reply via email to