Consistent use of StringUtils.toStringArray
(cherry picked from commit 6d11b40)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -221,7 +221,7 @@ public class AnnotationConfigWebApplicationContext extends AbstractRefreshableWe
|
||||
logger.info("Scanning base packages: [" +
|
||||
StringUtils.collectionToCommaDelimitedString(this.basePackages) + "]");
|
||||
}
|
||||
scanner.scan(this.basePackages.toArray(new String[this.basePackages.size()]));
|
||||
scanner.scan(StringUtils.toStringArray(this.basePackages));
|
||||
}
|
||||
|
||||
String[] configLocations = getConfigLocations();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,6 +42,7 @@ import org.springframework.http.server.ServletServerHttpRequest;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* {@link javax.servlet.Filter} that makes form encoded data available through
|
||||
@@ -170,13 +171,13 @@ public class HttpPutFormContentFilter extends OncePerRequestFilter {
|
||||
return parameterValues;
|
||||
}
|
||||
if (parameterValues == null || getQueryString() == null) {
|
||||
return formParam.toArray(new String[formParam.size()]);
|
||||
return StringUtils.toStringArray(formParam);
|
||||
}
|
||||
else {
|
||||
List<String> result = new ArrayList<>(parameterValues.length + formParam.size());
|
||||
result.addAll(Arrays.asList(parameterValues));
|
||||
result.addAll(formParam);
|
||||
return result.toArray(new String[result.size()]);
|
||||
return StringUtils.toStringArray(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* {@code UriBuilderFactory} that relies on {@link UriComponentsBuilder} for
|
||||
@@ -216,7 +217,6 @@ public class DefaultUriBuilderFactory implements UriBuilderFactory {
|
||||
private UriComponentsBuilder initUriComponentsBuilder(String uriTemplate) {
|
||||
UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromUriString(uriTemplate);
|
||||
UriComponents uriComponents = uriComponentsBuilder.build();
|
||||
|
||||
UriComponentsBuilder result = (uriComponents.getHost() == null ?
|
||||
baseUri.cloneBuilder().uriComponents(uriComponents) : uriComponentsBuilder);
|
||||
|
||||
@@ -224,10 +224,8 @@ public class DefaultUriBuilderFactory implements UriBuilderFactory {
|
||||
UriComponents uric = result.build();
|
||||
String path = uric.getPath();
|
||||
List<String> pathSegments = uric.getPathSegments();
|
||||
|
||||
result.replacePath(null);
|
||||
result.pathSegment(pathSegments.toArray(new String[0]));
|
||||
|
||||
result.pathSegment(StringUtils.toStringArray(pathSegments));
|
||||
if (path != null && path.endsWith("/")) {
|
||||
result.path("/");
|
||||
}
|
||||
|
||||
@@ -792,7 +792,7 @@ final class HierarchicalUriComponents extends UriComponents {
|
||||
|
||||
@Override
|
||||
public void copyToUriComponentsBuilder(UriComponentsBuilder builder) {
|
||||
builder.pathSegment(getPathSegments().toArray(new String[getPathSegments().size()]));
|
||||
builder.pathSegment(StringUtils.toStringArray(getPathSegments()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user