--- a/src/java.base/share/classes/sun/net/www/MessageHeader.java Fri Aug 30 13:11:16 2019 +0100
+++ b/src/java.base/share/classes/sun/net/www/MessageHeader.java Fri Aug 30 15:42:27 2019 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -311,12 +311,23 @@
return (k.substring(i+1, len-3).equalsIgnoreCase("HTTP/"));
}
+ /** Prints the key-value pairs represented by this
+ header. Also prints the RFC required blank line
+ at the end. Omits pairs with a null key. Omits
+ colon if key-value pair is the requestline. */
+ public void print(PrintStream p) {
+ // no synchronization: use cloned arrays instead.
+ String[] k; String[] v; int n;
+ synchronized (this) { n = nkeys; k = keys.clone(); v = values.clone(); }
+ print(n, k, v, p);
+ }
+
/** Prints the key-value pairs represented by this
header. Also prints the RFC required blank line
at the end. Omits pairs with a null key. Omits
colon if key-value pair is the requestline. */
- public synchronized void print(PrintStream p) {
+ private void print(int nkeys, String[] keys, String[] values, PrintStream p) {
for (int i = 0; i < nkeys; i++)
if (keys[i] != null) {
StringBuilder sb = new StringBuilder(keys[i]);