15
15
*/
16
16
package org .springframework .data .redis .connection ;
17
17
18
- import static org .springframework .util .Assert .*;
19
18
import static org .springframework .util .StringUtils .*;
20
19
21
20
import java .util .Collection ;
@@ -91,7 +90,7 @@ public RedisClusterConfiguration(Collection<String> clusterNodes) {
91
90
*/
92
91
public RedisClusterConfiguration (PropertySource <?> propertySource ) {
93
92
94
- notNull (propertySource , "PropertySource must not be null!" );
93
+ Assert . notNull (propertySource , "PropertySource must not be null!" );
95
94
96
95
this .clusterNodes = new LinkedHashSet <>();
97
96
@@ -112,7 +111,7 @@ public RedisClusterConfiguration(PropertySource<?> propertySource) {
112
111
*/
113
112
public void setClusterNodes (Iterable <RedisNode > nodes ) {
114
113
115
- notNull (nodes , "Cannot set cluster nodes to 'null'." );
114
+ Assert . notNull (nodes , "Cannot set cluster nodes to 'null'." );
116
115
117
116
this .clusterNodes .clear ();
118
117
@@ -137,7 +136,7 @@ public Set<RedisNode> getClusterNodes() {
137
136
*/
138
137
public void addClusterNode (RedisNode node ) {
139
138
140
- notNull (node , "ClusterNode must not be 'null'." );
139
+ Assert . notNull (node , "ClusterNode must not be 'null'." );
141
140
this .clusterNodes .add (node );
142
141
}
143
142
@@ -266,8 +265,8 @@ private RedisNode readHostAndPortFromString(String hostAndPort) {
266
265
267
266
String [] args = split (hostAndPort , ":" );
268
267
269
- notNull (args , "HostAndPort need to be seperated by ':'." );
270
- isTrue (args .length == 2 , "Host and Port String needs to specified as host:port" );
268
+ Assert . notNull (args , "HostAndPort need to be seperated by ':'." );
269
+ Assert . isTrue (args .length == 2 , "Host and Port String needs to specified as host:port" );
271
270
return new RedisNode (args [0 ], Integer .valueOf (args [1 ]));
272
271
}
273
272
@@ -278,7 +277,8 @@ private RedisNode readHostAndPortFromString(String hostAndPort) {
278
277
*/
279
278
private static Map <String , Object > asMap (Collection <String > clusterHostAndPorts , int redirects ) {
280
279
281
- notNull (clusterHostAndPorts , "ClusterHostAndPorts must not be null!" );
280
+ Assert .notNull (clusterHostAndPorts , "ClusterHostAndPorts must not be null!" );
281
+ Assert .noNullElements (clusterHostAndPorts , "ClusterHostAndPorts must not contain null elements!" );
282
282
283
283
Map <String , Object > map = new HashMap <>();
284
284
map .put (REDIS_CLUSTER_NODES_CONFIG_PROPERTY , StringUtils .collectionToCommaDelimitedString (clusterHostAndPorts ));
0 commit comments