RFR JDK-8176379: java.util.Base64 mime encoder behaves incorrectly if initialized with a line length of size 1-3 (original) (raw)
Xueming Shen xueming.shen at oracle.com
Fri Jan 26 23:32:14 UTC 2018
- Previous message: RFR: 8179294 several langtools tests depend on jar but do not declare that dependency
- Next message: RFR JDK-8176379: java.util.Base64 mime encoder behaves incorrectly if initialized with a line length of size 1-3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: RFR: 8179294 several langtools tests depend on jar but do not declare that dependency
- Next message: RFR JDK-8176379: java.util.Base64 mime encoder behaves incorrectly if initialized with a line length of size 1-3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]