Consistent use of StringUtils.toStringArray
This commit is contained in:
@@ -25,6 +25,7 @@ import org.springframework.beans.NotReadablePropertyException;
|
||||
import org.springframework.beans.PropertyAccessor;
|
||||
import org.springframework.beans.PropertyAccessorFactory;
|
||||
import org.springframework.jdbc.core.StatementCreatorUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* {@link SqlParameterSource} implementation that obtains parameter values
|
||||
@@ -98,7 +99,7 @@ public class BeanPropertySqlParameterSource extends AbstractSqlParameterSource {
|
||||
names.add(pd.getName());
|
||||
}
|
||||
}
|
||||
this.propertyNames = names.toArray(new String[names.size()]);
|
||||
this.propertyNames = StringUtils.toStringArray(names);
|
||||
}
|
||||
return this.propertyNames;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -51,6 +51,7 @@ import org.springframework.jdbc.support.SQLStateSQLExceptionTranslator;
|
||||
import org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor;
|
||||
import org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractorAdapter;
|
||||
import org.springframework.util.LinkedCaseInsensitiveMap;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
@@ -229,7 +230,7 @@ public class JdbcTemplateTests {
|
||||
this.list.add(rs.getString(1));
|
||||
}
|
||||
public String[] getStrings() {
|
||||
return this.list.toArray(new String[this.list.size()]);
|
||||
return StringUtils.toStringArray(this.list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -38,6 +38,7 @@ import org.springframework.dao.IncorrectResultSizeDataAccessException;
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
import org.springframework.jdbc.Customer;
|
||||
import org.springframework.jdbc.core.SqlParameter;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
@@ -763,9 +764,7 @@ public class SqlQueryTests {
|
||||
}
|
||||
|
||||
public String[] run() {
|
||||
List<String> list = execute();
|
||||
String[] results = list.toArray(new String[list.size()]);
|
||||
return results;
|
||||
return StringUtils.toStringArray(execute());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user