Consistent use of StringUtils.toStringArray
(cherry picked from commit 6d11b40)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -22,6 +22,7 @@ import java.util.Map;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Support class for {@link AttributeAccessor AttributeAccessors}, providing
|
||||
@@ -73,7 +74,7 @@ public abstract class AttributeAccessorSupport implements AttributeAccessor, Ser
|
||||
|
||||
@Override
|
||||
public String[] attributeNames() {
|
||||
return this.attributes.keySet().toArray(new String[this.attributes.size()]);
|
||||
return StringUtils.toStringArray(this.attributes.keySet());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -19,6 +19,7 @@ package org.springframework.core.env;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* {@link CommandLinePropertySource} implementation backed by a simple String array.
|
||||
@@ -102,7 +103,7 @@ public class SimpleCommandLinePropertySource extends CommandLinePropertySource<C
|
||||
*/
|
||||
@Override
|
||||
public String[] getPropertyNames() {
|
||||
return source.getOptionNames().toArray(new String[source.getOptionNames().size()]);
|
||||
return StringUtils.toStringArray(this.source.getOptionNames());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user