Hi,

Please help review the change for JDK-8176379

issue: https://bugs.openjdk.java.net/browse/JDK-8176379
webrev: http://cr.openjdk.java.net/~sherman/8176379/webrev

It appears the spec is somewhat misleading and/or incorrect in this corner
case. And the implementation of the mime type encoder OutputStream does
not expect a "length==0" mime encoder. The difference behavior of the
non-stream-type encoder and stream-type encoder comes from

in non-stream-type case, we always have a " > 0" guard as

           if (linemax > 0 && slen > linemax / 4 * 3)
                slen = linemax / 4 * 3

but in stream-type we don't.

        private void checkNewline() throws IOException {
            if (linepos == linemax) {
                out.write(newline);
                linepos = 0;
            }
        }

The proposed change here is to clarify the spec and the implementation
to use a non-mime type encoder (no line separator) when the rounded down
mime line length is smaller than 4.

We probably need a CSR for this spec clarification, if the proposed change is
approved.

Thanks,
Sherman

Reply via email to