From 62b034979c34441eeca6c9176aec7a26fe111e3a Mon Sep 17 00:00:00 2001 From: Jack Berg Date: Thu, 30 Nov 2023 16:24:34 -0600 Subject: [PATCH] Remove exception handling in TlsUtil#decodePem --- .../io/opentelemetry/exporter/internal/TlsUtil.java | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/exporters/common/src/main/java/io/opentelemetry/exporter/internal/TlsUtil.java b/exporters/common/src/main/java/io/opentelemetry/exporter/internal/TlsUtil.java index 4d177402241..785291635f1 100644 --- a/exporters/common/src/main/java/io/opentelemetry/exporter/internal/TlsUtil.java +++ b/exporters/common/src/main/java/io/opentelemetry/exporter/internal/TlsUtil.java @@ -33,7 +33,6 @@ import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509KeyManager; import javax.net.ssl.X509TrustManager; -import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement; /** * Utilities for working with TLS. @@ -142,9 +141,6 @@ public static X509TrustManager trustManager(byte[] trustedCertificatesPem) throw } } - // We catch linkage error to provide a better exception message on Android. - // https://github.com/open-telemetry/opentelemetry-java/issues/4533 - @IgnoreJRERequirement // Visible for testing static byte[] decodePem(byte[] pem) { String pemStr = new String(pem, StandardCharsets.UTF_8).trim(); @@ -157,12 +153,6 @@ static byte[] decodePem(byte[] pem) { pemStr.substring(PEM_KEY_HEADER.length(), pemStr.length() - PEM_KEY_FOOTER.length()); String content = contentWithNewLines.replaceAll("\\s", ""); - try { - return Base64.getDecoder().decode(content); - } catch (LinkageError unused) { - throw new IllegalArgumentException( - "PEM private keys are currently not supported on Android. " - + "You may try a key encoded as DER."); - } + return Base64.getDecoder().decode(content); } }