Skip to content

Commit 37400a4

Browse files
committed
Accept empty config values in the Lettuce connection wrapper.
Closes #2798
1 parent b78dd1b commit 37400a4

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterServerCommands.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public Properties getConfig(RedisClusterNode node, String pattern) {
220220
public void setConfig(String param, String value) {
221221

222222
Assert.hasText(param, "Parameter must not be null or empty");
223-
Assert.hasText(value, "Value must not be null or empty");
223+
Assert.notNull(value, "Value must not be null");
224224

225225
executeCommandOnAllNodes(client -> client.configSet(param, value));
226226
}

src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public Mono<Properties> getConfig(String pattern) {
130130
public Mono<String> setConfig(String param, String value) {
131131

132132
Assert.hasText(param, "Parameter must not be null or empty");
133-
Assert.hasText(value, "Value must not be null or empty");
133+
Assert.notNull(value, "Value must not be null");
134134

135135
return connection.execute(c -> c.configSet(param, value)).next();
136136
}

src/main/java/org/springframework/data/redis/connection/lettuce/LettuceServerCommands.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public Properties getConfig(String pattern) {
145145
public void setConfig(String param, String value) {
146146

147147
Assert.hasText(param, "Parameter must not be null or empty");
148-
Assert.hasText(value, "Value must not be null or empty");
148+
Assert.notNull(value, "Value must not be null");
149149

150150
connection.invokeStatus().just(RedisServerAsyncCommands::configSet, param, value);
151151
}

src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommandsIntegrationTests.java

+17
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,23 @@ void getConfigShouldRespondCorrectly() {
215215
}
216216
}
217217

218+
@ParameterizedRedisTest // GH-2798
219+
void setConfigShouldRespondCorrectly() {
220+
221+
if (!(connection instanceof LettuceReactiveRedisClusterConnection)) {
222+
223+
connection.serverCommands().setConfig("notify-keyspace-events", "") //
224+
.as(StepVerifier::create) //
225+
.expectNext("OK")
226+
.verifyComplete();
227+
228+
connection.serverCommands().setConfig("notify-keyspace-events", "KEA") //
229+
.as(StepVerifier::create) //
230+
.expectNext("OK")
231+
.verifyComplete();
232+
}
233+
}
234+
218235
@ParameterizedRedisTest // DATAREDIS-659
219236
void setConfigShouldApplyConfiguration() {
220237

src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterTests.java

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ void setUp() {
9191
RedisConnection connection = template.getConnectionFactory().getConnection();
9292

9393
try {
94+
connection.setConfig("notify-keyspace-events", "");
9495
connection.setConfig("notify-keyspace-events", "KEA");
9596
} finally {
9697
connection.close();

0 commit comments

Comments
 (0)