8204494: Fix for 8200530 triggered regression, closed/test/jdk/security/infra/java/security/KeyStore/BouncyCastleInterop.java failed
Reviewed-by: rriggs
--- a/src/java.base/share/classes/java/util/jar/Manifest.java Wed Jun 06 17:10:37 2018 -0400
+++ b/src/java.base/share/classes/java/util/jar/Manifest.java Wed Jun 06 14:36:48 2018 -0700
@@ -393,7 +393,27 @@
off += n;
total += n;
pos = tpos;
- if (c == '\n' || c == '\r') {
+ c = tbuf[tpos-1];
+ if (c == '\n') {
+ break;
+ }
+ if (c == '\r') {
+ if (count == pos) {
+ // try to see if there is a trailing LF
+ fill();
+ if (pos < count && tbuf[pos] == '\n') {
+ if (total < len) {
+ b[off++] = '\n';
+ total++;
+ } else {
+ // we should always have big enough lbuf but
+ // just in case we don't, replace the last CR
+ // with LF.
+ b[off - 1] = '\n';
+ }
+ pos++;
+ }
+ }
break;
}
}