You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2021/01/12 15:50:27 UTC

[camel-quarkus] branch master updated: Improve exception handling in ExtendDefaultTrustStore

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

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


The following commit(s) were added to refs/heads/master by this push:
     new ceb614d  Improve exception handling in ExtendDefaultTrustStore
ceb614d is described below

commit ceb614d43a9679ece8bc9467e60f0bc959615017
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue Jan 12 16:49:05 2021 +0100

    Improve exception handling in ExtendDefaultTrustStore
---
 .../org/apache/camel/quarkus/test/ExtendDefaultTrustStore.java     | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/integration-tests-support/test-support/src/main/java/org/apache/camel/quarkus/test/ExtendDefaultTrustStore.java b/integration-tests-support/test-support/src/main/java/org/apache/camel/quarkus/test/ExtendDefaultTrustStore.java
index 2167006..0d0ea50 100644
--- a/integration-tests-support/test-support/src/main/java/org/apache/camel/quarkus/test/ExtendDefaultTrustStore.java
+++ b/integration-tests-support/test-support/src/main/java/org/apache/camel/quarkus/test/ExtendDefaultTrustStore.java
@@ -58,8 +58,9 @@ public class ExtendDefaultTrustStore {
                 final int colonPos = cert.indexOf(':');
                 final String alias = colonPos >= 0 ? cert.substring(0, colonPos) : "localhost";
                 final String certPath = colonPos >= 0 ? cert.substring(colonPos + 1) : cert;
-                try (InputStream in = ExtendDefaultTrustStore.class.getClassLoader().getResourceAsStream(certPath)) {
-                    final X509Certificate ca = (X509Certificate) cf.generateCertificate(new BufferedInputStream(in));
+                try (InputStream in = new BufferedInputStream(
+                        ExtendDefaultTrustStore.class.getClassLoader().getResourceAsStream(certPath))) {
+                    final X509Certificate ca = (X509Certificate) cf.generateCertificate(in);
                     keystore.setCertificateEntry(alias, ca);
                 }
             }
@@ -81,7 +82,7 @@ public class ExtendDefaultTrustStore {
             System.arraycopy(args, 1, certs, 0, args.length - 1);
             extendTrustStoreIfNeeded(baseDir, certs);
         } catch (Exception e) {
-            new Exception("Could not extend the default trust store with args " + String.join(", ", args), e).printStackTrace();
+            throw new RuntimeException("Could not extend the default trust store with args " + String.join(", ", args), e);
         }
     }
 }