From 6bae2a279f75240f2c65a46fd82f53e50097d220 Mon Sep 17 00:00:00 2001 From: Ali Ahmed Date: Thu, 1 Feb 2024 00:05:49 -0800 Subject: [PATCH] Fix Code Issues --- .../io/streamnative/oxia/client/it/OxiaClientFailFastIT.java | 2 +- .../pulsarmetadatastoreoxia/OxiaMetadataStore.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client-it/src/test/java/io/streamnative/oxia/client/it/OxiaClientFailFastIT.java b/client-it/src/test/java/io/streamnative/oxia/client/it/OxiaClientFailFastIT.java index 97c5aced..d7bb54ae 100644 --- a/client-it/src/test/java/io/streamnative/oxia/client/it/OxiaClientFailFastIT.java +++ b/client-it/src/test/java/io/streamnative/oxia/client/it/OxiaClientFailFastIT.java @@ -46,7 +46,7 @@ public void testWrongNamespace() { Assertions.fail("Unexpected behaviour!"); } catch (CompletionException exception) { Assertions.assertNotNull(exception.getCause()); - Assertions.assertTrue(exception.getCause() instanceof NamespaceNotFoundException); + Assertions.assertInstanceOf(NamespaceNotFoundException.class, exception.getCause()); } } } diff --git a/pulsar-metadatastore-oxia/src/main/java/io/streamnative/pulsarmetadatastoreoxia/OxiaMetadataStore.java b/pulsar-metadatastore-oxia/src/main/java/io/streamnative/pulsarmetadatastoreoxia/OxiaMetadataStore.java index 23a04ea1..a4384b67 100644 --- a/pulsar-metadatastore-oxia/src/main/java/io/streamnative/pulsarmetadatastoreoxia/OxiaMetadataStore.java +++ b/pulsar-metadatastore-oxia/src/main/java/io/streamnative/pulsarmetadatastoreoxia/OxiaMetadataStore.java @@ -150,7 +150,7 @@ protected CompletableFuture storeDelete(String path, Optional expect return getChildrenFromStore(path) .thenCompose( children -> { - if (children.size() > 0) { + if (!children.isEmpty()) { return CompletableFuture.failedFuture( new MetadataStoreException("Key '" + path + "' has children")); } else { @@ -237,7 +237,7 @@ private CompletionStage convertException(Throwable ex) { private CompletableFuture createParents(String path) { var parent = parent(path); - if (parent == null || parent.length() == 0) { + if (parent == null || parent.isEmpty()) { return CompletableFuture.completedFuture(null); } return exists(parent)