Adding an API Note will require a CSR.

And yes,  what we often think as the right change tends to bite us (given this 
code has been in the wild since the 90s) so best to err on the side of 
documentation vs. assuming this change would not cause more problems than it is 
worth.

Best
Lance

On Mar 6, 2023, at 3:20 PM, Eirik Bjørsnøs 
<eir...@gmail.com<mailto:eir...@gmail.com>> wrote:

On Mon, Mar 6, 2023 at 8:45 PM Alan Bateman 
<alan.bate...@oracle.com<mailto:alan.bate...@oracle.com>> wrote:
Changing ZOS.putNextEntry to ignore the method/size provided by the
caller would change long standing behavior, and Hyrum's Law has it that
somebody will notice.

I was not thinking of changing anything if the caller actually specified a 
method. This would be just for the default/unspecified case, in which case 
ZipEntry.method is -1.

So:

if (e.method == -1) {

    if (e.isDirectory()) {
       // New code:
       e.setMethod(STORED);
       e.setSize(0);
       e.setCrc(0);
    } else {
        // Today's code:
        e.method = method;  // use default method
    }
}

But I guess this doesn't completely alleviate concerns, since there might be 
code out there doing:

zo.putNextEntry("directory/");
zo.write("Hello".getBytes());

(This would be very weird code, but people might have found it convenient to 
attach data to directories somehow).

This may be something for an API note rather than
an implementation change.

Am I right that this would not be a specification change, so it would not 
require a CSR?

Thanks,


[cid:E1C4E2F0-ECD0-4C9D-ADB4-B16CA7BCB7FC@home]






Lance Andersen | Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering
1 Network Drive
Burlington, MA 01803
lance.ander...@oracle.com<mailto:lance.ander...@oracle.com>



Reply via email to