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.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.LinkedHashMap;
import java.util.List;
@ -85,17 +85,9 @@ final class TraceableHttpServletRequest implements TraceableRequest {
Enumeration<String> names = this.request.getHeaderNames();
while (names.hasMoreElements()) {
String name = names.nextElement();
headers.put(name, toList(this.request.getHeaders(name)));
headers.put(name, Collections.list(this.request.getHeaders(name)));
}
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.URLClassLoader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.jar.JarOutputStream;
@ -212,13 +212,8 @@ public class RestartClassLoaderTests {
}
private <T> List<T> toList(Enumeration<T> enumeration) {
List<T> list = new ArrayList<>();
if (enumeration != null) {
while (enumeration.hasMoreElements()) {
list.add(enumeration.nextElement());
}
}
return list;
return (enumeration != null) ? Collections.list(enumeration)
: Collections.<T>emptyList();
}
}

Loading…
Cancel
Save