This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 3.2.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 914b5f7f10dc485e32f6872fa3767f18d0ac900c
Author: James Netherton <jamesnether...@gmail.com>
AuthorDate: Wed Nov 15 13:50:44 2023 +0000

    Log warning instead of throwing RuntimeException if paho temporary 
certificate files could not be deleted
---
 .../camel/quarkus/component/paho/mqtt5/it/PahoMqtt5Resource.java    | 6 ++++--
 .../java/org/apache/camel/quarkus/component/paho/PahoResource.java  | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/integration-tests/paho-mqtt5/src/main/java/org/apache/camel/quarkus/component/paho/mqtt5/it/PahoMqtt5Resource.java
 
b/integration-tests/paho-mqtt5/src/main/java/org/apache/camel/quarkus/component/paho/mqtt5/it/PahoMqtt5Resource.java
index 339a4cc3c5..ef86d06a0b 100644
--- 
a/integration-tests/paho-mqtt5/src/main/java/org/apache/camel/quarkus/component/paho/mqtt5/it/PahoMqtt5Resource.java
+++ 
b/integration-tests/paho-mqtt5/src/main/java/org/apache/camel/quarkus/component/paho/mqtt5/it/PahoMqtt5Resource.java
@@ -49,10 +49,12 @@ import 
org.apache.camel.component.paho.mqtt5.PahoMqtt5Constants;
 import org.apache.camel.spi.RouteController;
 import org.eclipse.microprofile.config.Config;
 import org.eclipse.microprofile.config.ConfigProvider;
+import org.jboss.logging.Logger;
 
 @Path("/paho-mqtt5")
 @ApplicationScoped
 public class PahoMqtt5Resource {
+    private static final Logger LOG = 
Logger.getLogger(PahoMqtt5Resource.class);
 
     @Inject
     CamelContext context;
@@ -219,9 +221,9 @@ public class PahoMqtt5Resource {
 
     private void removeKeyStore(String keystore) {
         try {
-            Files.delete(Paths.get(keystore));
+            Files.deleteIfExists(Paths.get(keystore));
         } catch (Exception e) {
-            throw new RuntimeException("Could not delete " + keystore, e);
+            LOG.warn("Failed to delete temporary keystore file", e);
         }
     }
 }
diff --git 
a/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/PahoResource.java
 
b/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/PahoResource.java
index 8269c71fa1..8250e0141e 100644
--- 
a/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/PahoResource.java
+++ 
b/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/PahoResource.java
@@ -186,9 +186,9 @@ public class PahoResource {
 
     private void removeKeyStore(java.nio.file.Path keystore) {
         try {
-            Files.delete(keystore);
+            Files.deleteIfExists(keystore);
         } catch (Exception e) {
-            throw new RuntimeException("Could not delete " + keystore, e);
+            LOG.warn("Failed to delete temporary keystore file", e);
         }
     }
 }

Reply via email to