Merge branch '2.0.x'

pull/14035/merge
Andy Wilkinson 6 years ago
commit 971caad6f8

@ -19,7 +19,7 @@ package org.springframework.boot.actuate.web.trace.servlet;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.Collections;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
@ -85,17 +85,9 @@ final class TraceableHttpServletRequest implements TraceableRequest {
Enumeration<String> names = this.request.getHeaderNames(); Enumeration<String> names = this.request.getHeaderNames();
while (names.hasMoreElements()) { while (names.hasMoreElements()) {
String name = names.nextElement(); String name = names.nextElement();
headers.put(name, toList(this.request.getHeaders(name))); headers.put(name, Collections.list(this.request.getHeaders(name)));
} }
return headers; return headers;
} }
private List<String> toList(Enumeration<String> enumeration) {
List<String> list = new ArrayList<>();
while (enumeration.hasMoreElements()) {
list.add(enumeration.nextElement());
}
return list;
}
} }

@ -23,7 +23,7 @@ import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.Collections;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List; import java.util.List;
import java.util.jar.JarOutputStream; import java.util.jar.JarOutputStream;
@ -212,13 +212,8 @@ public class RestartClassLoaderTests {
} }
private <T> List<T> toList(Enumeration<T> enumeration) { private <T> List<T> toList(Enumeration<T> enumeration) {
List<T> list = new ArrayList<>(); return (enumeration != null) ? Collections.list(enumeration)
if (enumeration != null) { : Collections.<T>emptyList();
while (enumeration.hasMoreElements()) {
list.add(enumeration.nextElement());
}
}
return list;
} }
} }

Loading…
Cancel
Save