diff --git a/kafka-ui-api/src/main/java/com/provectus/kafka/ui/service/ReactiveAdminClient.java b/kafka-ui-api/src/main/java/com/provectus/kafka/ui/service/ReactiveAdminClient.java index 731824cdf0..85f0d17fb1 100644 --- a/kafka-ui-api/src/main/java/com/provectus/kafka/ui/service/ReactiveAdminClient.java +++ b/kafka-ui-api/src/main/java/com/provectus/kafka/ui/service/ReactiveAdminClient.java @@ -90,10 +90,15 @@ public class ReactiveAdminClient implements Closeable { } private static SupportedFeature getSupportedUpdateFeatureForVersion(String versionStr) { - float version = NumberUtil.parserClusterVersion(versionStr); - return version <= 2.3f - ? SupportedFeature.ALTER_CONFIGS - : SupportedFeature.INCREMENTAL_ALTER_CONFIGS; + try { + float version = NumberUtil.parserClusterVersion(versionStr); + return version <= 2.3f + ? SupportedFeature.ALTER_CONFIGS + : SupportedFeature.INCREMENTAL_ALTER_CONFIGS; + } catch (NumberFormatException e) { + log.info("Assuming non-incremental alter configs due to version parsing error"); + return SupportedFeature.ALTER_CONFIGS; + } } //TODO: discuss - maybe we should map kafka-library's exceptions to our exceptions here diff --git a/kafka-ui-api/src/main/java/com/provectus/kafka/ui/util/NumberUtil.java b/kafka-ui-api/src/main/java/com/provectus/kafka/ui/util/NumberUtil.java index cb1f08b3ab..9ea8c037cc 100644 --- a/kafka-ui-api/src/main/java/com/provectus/kafka/ui/util/NumberUtil.java +++ b/kafka-ui-api/src/main/java/com/provectus/kafka/ui/util/NumberUtil.java @@ -13,7 +13,8 @@ public class NumberUtil { return value != null && NumberUtils.isCreatable(value.toString()); } - public static float parserClusterVersion(String version) { + public static float parserClusterVersion(String version) throws NumberFormatException { + log.trace("Parsing cluster version [{}]", version); try { final String[] parts = version.split("\\."); if (parts.length > 2) { @@ -21,7 +22,7 @@ public class NumberUtil { } return Float.parseFloat(version.split("-")[0]); } catch (Exception e) { - log.error("Conversion clusterVersion {} to float value failed", version); + log.error("Conversion clusterVersion [{}] to float value failed", version, e); throw e; } }