From 65dfc61104b2ddc642389628009eaa018f8ffa8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Boschi?= Date: Tue, 23 May 2023 11:37:54 +0200 Subject: [PATCH 1/3] [improve][client] Swallow Conscrypt ClassNotFoundException --- .../java/org/apache/pulsar/common/util/SecurityUtility.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pulsar-common/src/main/java/org/apache/pulsar/common/util/SecurityUtility.java b/pulsar-common/src/main/java/org/apache/pulsar/common/util/SecurityUtility.java index 12ab9ae0b0bc9..6e6daf00dd2c7 100644 --- a/pulsar-common/src/main/java/org/apache/pulsar/common/util/SecurityUtility.java +++ b/pulsar-common/src/main/java/org/apache/pulsar/common/util/SecurityUtility.java @@ -127,6 +127,8 @@ private static Provider loadConscryptProvider() { if (e.getCause() instanceof UnsatisfiedLinkError) { log.warn("Conscrypt isn't available for {} {}. Using JDK default security provider.", System.getProperty("os.name"), System.getProperty("os.arch")); + } else if (e.getCause() instanceof ClassNotFoundException) { + log.warn("Conscrypt jar isn't available in the classpath. Using JDK default security provider."); } else { log.warn("Conscrypt isn't available. Using JDK default security provider.", e); } From 176b4e774848a414c0e84f43473717ca5ac8a5e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Boschi?= Date: Tue, 23 May 2023 11:42:34 +0200 Subject: [PATCH 2/3] fix --- .../java/org/apache/pulsar/common/util/SecurityUtility.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pulsar-common/src/main/java/org/apache/pulsar/common/util/SecurityUtility.java b/pulsar-common/src/main/java/org/apache/pulsar/common/util/SecurityUtility.java index 6e6daf00dd2c7..5f501df4989b5 100644 --- a/pulsar-common/src/main/java/org/apache/pulsar/common/util/SecurityUtility.java +++ b/pulsar-common/src/main/java/org/apache/pulsar/common/util/SecurityUtility.java @@ -124,11 +124,11 @@ private static Provider loadConscryptProvider() { conscryptClazz = Class.forName("org.conscrypt.Conscrypt"); conscryptClazz.getMethod("checkAvailability").invoke(null); } catch (Throwable e) { - if (e.getCause() instanceof UnsatisfiedLinkError) { + if (e instanceof ClassNotFoundException) { + log.warn("Conscrypt jar isn't available in the classpath. Using JDK default security provider."); + } else if (e.getCause() instanceof UnsatisfiedLinkError) { log.warn("Conscrypt isn't available for {} {}. Using JDK default security provider.", System.getProperty("os.name"), System.getProperty("os.arch")); - } else if (e.getCause() instanceof ClassNotFoundException) { - log.warn("Conscrypt jar isn't available in the classpath. Using JDK default security provider."); } else { log.warn("Conscrypt isn't available. Using JDK default security provider.", e); } From c4678e65f4289229adf5b97859d08e2c1a8403d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Boschi?= Date: Tue, 23 May 2023 14:10:41 +0200 Subject: [PATCH 3/3] rm jar --- .../java/org/apache/pulsar/common/util/SecurityUtility.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pulsar-common/src/main/java/org/apache/pulsar/common/util/SecurityUtility.java b/pulsar-common/src/main/java/org/apache/pulsar/common/util/SecurityUtility.java index 5f501df4989b5..f0023ce5a42dd 100644 --- a/pulsar-common/src/main/java/org/apache/pulsar/common/util/SecurityUtility.java +++ b/pulsar-common/src/main/java/org/apache/pulsar/common/util/SecurityUtility.java @@ -125,7 +125,7 @@ private static Provider loadConscryptProvider() { conscryptClazz.getMethod("checkAvailability").invoke(null); } catch (Throwable e) { if (e instanceof ClassNotFoundException) { - log.warn("Conscrypt jar isn't available in the classpath. Using JDK default security provider."); + log.warn("Conscrypt isn't available in the classpath. Using JDK default security provider."); } else if (e.getCause() instanceof UnsatisfiedLinkError) { log.warn("Conscrypt isn't available for {} {}. Using JDK default security provider.", System.getProperty("os.name"), System.getProperty("os.arch"));