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 ;
@@ -90,7 +89,7 @@ public RedisClusterConfiguration(Collection<String> clusterNodes) {
90
89
*/
91
90
public RedisClusterConfiguration (PropertySource <?> propertySource ) {
92
91
93
- notNull (propertySource , "PropertySource must not be null!" );
92
+ Assert . notNull (propertySource , "PropertySource must not be null!" );
94
93
95
94
this .clusterNodes = new LinkedHashSet <>();
96
95
@@ -111,7 +110,7 @@ public RedisClusterConfiguration(PropertySource<?> propertySource) {
111
110
*/
112
111
public void setClusterNodes (Iterable <RedisNode > nodes ) {
113
112
114
- notNull (nodes , "Cannot set cluster nodes to 'null'." );
113
+ Assert . notNull (nodes , "Cannot set cluster nodes to 'null'." );
115
114
116
115
this .clusterNodes .clear ();
117
116
@@ -136,7 +135,7 @@ public Set<RedisNode> getClusterNodes() {
136
135
*/
137
136
public void addClusterNode (RedisNode node ) {
138
137
139
- notNull (node , "ClusterNode must not be 'null'." );
138
+ Assert . notNull (node , "ClusterNode must not be 'null'." );
140
139
this .clusterNodes .add (node );
141
140
}
142
141
@@ -227,8 +226,8 @@ private RedisNode readHostAndPortFromString(String hostAndPort) {
227
226
228
227
String [] args = split (hostAndPort , ":" );
229
228
230
- notNull (args , "HostAndPort need to be seperated by ':'." );
231
- isTrue (args .length == 2 , "Host and Port String needs to specified as host:port" );
229
+ Assert . notNull (args , "HostAndPort need to be seperated by ':'." );
230
+ Assert . isTrue (args .length == 2 , "Host and Port String needs to specified as host:port" );
232
231
return new RedisNode (args [0 ], Integer .valueOf (args [1 ]));
233
232
}
234
233
@@ -239,7 +238,8 @@ private RedisNode readHostAndPortFromString(String hostAndPort) {
239
238
*/
240
239
private static Map <String , Object > asMap (Collection <String > clusterHostAndPorts , int redirects ) {
241
240
242
- notNull (clusterHostAndPorts , "ClusterHostAndPorts must not be null!" );
241
+ Assert .notNull (clusterHostAndPorts , "ClusterHostAndPorts must not be null!" );
242
+ Assert .noNullElements (clusterHostAndPorts , "ClusterHostAndPorts must not contain null elements!" );
243
243
244
244
Map <String , Object > map = new HashMap <>();
245
245
map .put (REDIS_CLUSTER_NODES_CONFIG_PROPERTY , StringUtils .collectionToCommaDelimitedString (clusterHostAndPorts ));
0 commit comments