Skip to content

Commit 4310a95

Browse files
committed
renamed NO_THROW_ON_UNKNOWN_CONFIG to IGNORE_UNKNOWN_CONFIG_KEY to avoid double negative logic
1 parent f0f296a commit 4310a95

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

client-v2/src/main/java/com/clickhouse/client/api/ClientConfigProperties.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public <T> T getDefObjVal() {
239239
// Key used to identify default value in configuration map
240240
public static final String DEFAULT_KEY = "_default_";
241241

242-
public static final String NO_THROW_ON_UNKNOWN_CONFIG = "no_throw_on_unknown_config";
242+
public static final String IGNORE_UNKNOWN_CONFIG_KEY = "ignore_unknown_config_key";
243243

244244
public static String serverSetting(String key) {
245245
return SERVER_SETTING_PREFIX + key;
@@ -363,10 +363,10 @@ public static Map<String, Object> parseConfigMap(Map<String, String> configMap)
363363
}
364364
}
365365

366-
tmpMap.remove(ClientConfigProperties.NO_THROW_ON_UNKNOWN_CONFIG);
366+
tmpMap.remove(ClientConfigProperties.IGNORE_UNKNOWN_CONFIG_KEY);
367367
if (!tmpMap.isEmpty()) {
368368
String msg = "Unknown and unmapped config properties: " + tmpMap.keySet();
369-
if (configMap.containsKey(NO_THROW_ON_UNKNOWN_CONFIG)) {
369+
if (Boolean.parseBoolean(String.valueOf(configMap.get(IGNORE_UNKNOWN_CONFIG_KEY)))) {
370370
LOG.warn(msg);
371371
} else {
372372
throw new ClientMisconfigurationException(msg);

client-v2/src/test/java/com/clickhouse/client/ClientTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ public void testUnknownClientSettings() throws Exception {
502502
Assert.assertTrue(ex.getMessage().contains("unknown_setting"));
503503
}
504504

505-
try (Client client = newClient().setOption(ClientConfigProperties.NO_THROW_ON_UNKNOWN_CONFIG, "what ever").setOption("unknown_setting", "value").build()) {
505+
try (Client client = newClient().setOption(ClientConfigProperties.IGNORE_UNKNOWN_CONFIG_KEY, "true").setOption("unknown_setting", "value").build()) {
506506
Assert.assertTrue(client.ping());
507507
}
508508

jdbc-v2/src/test/java/com/clickhouse/jdbc/DriverTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,6 @@ public void testUnknownSettings() throws Exception {
194194
}
195195

196196
// next should not throw exception
197-
driver.connect(getEndpointString() + "?unknown_setting=1&" + ClientConfigProperties.NO_THROW_ON_UNKNOWN_CONFIG + "=1", new Properties()).close();
197+
driver.connect(getEndpointString() + "?unknown_setting=1&" + ClientConfigProperties.IGNORE_UNKNOWN_CONFIG_KEY + "=true", new Properties()).close();
198198
}
199199
}

0 commit comments

Comments
 (0)