From 40410b2546b7823b3c2a1e2b05e9fd2723c9492e Mon Sep 17 00:00:00 2001
From: Scott Leberknight <174812+sleberknight@users.noreply.github.com>
Date: Sat, 16 Dec 2023 20:26:53 -0500
Subject: [PATCH] Code cleanup (#303)

* Suppress warning in ConsulResponse that deprecated code is still used
* Replace printStackTrace() with Logger in KeyValueClientITest
---
 .../java/org/kiwiproject/consul/KeyValueClientITest.java    | 6 +++++-
 .../java/org/kiwiproject/consul/model/ConsulResponse.java   | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/itest/java/org/kiwiproject/consul/KeyValueClientITest.java b/src/itest/java/org/kiwiproject/consul/KeyValueClientITest.java
index b42d362..1852d4b 100644
--- a/src/itest/java/org/kiwiproject/consul/KeyValueClientITest.java
+++ b/src/itest/java/org/kiwiproject/consul/KeyValueClientITest.java
@@ -24,6 +24,8 @@
 import org.kiwiproject.consul.option.ImmutableQueryOptions;
 import org.kiwiproject.consul.option.PutOptions;
 import org.kiwiproject.consul.option.QueryOptions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.nio.charset.Charset;
 import java.util.HashSet;
@@ -39,6 +41,8 @@
 
 class KeyValueClientITest extends BaseIntegrationTest {
 
+    private static final Logger LOG = LoggerFactory.getLogger(KeyValueClientITest.class);
+
     private static final Charset TEST_CHARSET = Charset.forName("IBM297");
 
     private KeyValueClient keyValueClient;
@@ -398,7 +402,7 @@ public void onComplete(ConsulResponse<List<Value>> consulResponse) {
 
             @Override
             public void onFailure(Throwable throwable) {
-                throwable.printStackTrace();
+                LOG.error("getValues failed for key {}", key, throwable);
                 completed.countDown();
             }
         });
diff --git a/src/main/java/org/kiwiproject/consul/model/ConsulResponse.java b/src/main/java/org/kiwiproject/consul/model/ConsulResponse.java
index e96c9a9..ba72fb0 100644
--- a/src/main/java/org/kiwiproject/consul/model/ConsulResponse.java
+++ b/src/main/java/org/kiwiproject/consul/model/ConsulResponse.java
@@ -100,6 +100,7 @@ public BigInteger getIndex() {
      * @deprecated replaced by {@link #getCacheResponseInfo()}
      * @see <a href="https://developer.hashicorp.com/consul/api-docs/features/caching#background-refresh-caching">Background Refresh Caching</a>
      */
+    @SuppressWarnings("DeprecatedIsStillUsed")
     @Deprecated(since = "1.1.0", forRemoval = true)
     public Optional<CacheResponseInfo> getCacheReponseInfo(){
         return getCacheResponseInfo();