Polish Collection.toArray
Consistently use `StringUtils.toStringArray`, `ClassUtils.toClassArray` or zero length when converting collections to arrays. Fixes gh-12160
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-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.
|
||||
@@ -122,7 +122,7 @@ public class DevToolsProperties {
|
||||
allExclude.addAll(
|
||||
StringUtils.commaDelimitedListToSet(this.additionalExclude));
|
||||
}
|
||||
return allExclude.toArray(new String[allExclude.size()]);
|
||||
return StringUtils.toStringArray(allExclude);
|
||||
}
|
||||
|
||||
public String getExclude() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-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.
|
||||
@@ -79,7 +79,7 @@ final class ChangeableUrls implements Iterable<URL> {
|
||||
}
|
||||
|
||||
public URL[] toArray() {
|
||||
return this.urls.toArray(new URL[this.urls.size()]);
|
||||
return this.urls.toArray(new URL[0]);
|
||||
}
|
||||
|
||||
public List<URL> toList() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-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.
|
||||
@@ -119,7 +119,7 @@ final class ClassLoaderFilesResourcePatternResolver implements ResourcePatternRe
|
||||
}
|
||||
}
|
||||
resources.addAll(getAdditionalResources(locationPattern));
|
||||
return resources.toArray(new Resource[resources.size()]);
|
||||
return resources.toArray(new Resource[0]);
|
||||
}
|
||||
|
||||
private List<Resource> getAdditionalResources(String locationPattern)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-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.
|
||||
@@ -273,7 +273,7 @@ public class Restarter {
|
||||
|
||||
private Throwable doStart() throws Exception {
|
||||
Assert.notNull(this.mainClassName, "Unable to find the main class to restart");
|
||||
URL[] urls = this.urls.toArray(new URL[this.urls.size()]);
|
||||
URL[] urls = this.urls.toArray(new URL[0]);
|
||||
ClassLoaderFiles updatedFiles = new ClassLoaderFiles(this.classLoaderFiles);
|
||||
ClassLoader classLoader = new RestartClassLoader(this.applicationClassLoader,
|
||||
urls, updatedFiles, this.logger);
|
||||
|
||||
Reference in New Issue
Block a user