gemmellr commented on code in PR #5547:
URL: https://github.com/apache/activemq-artemis/pull/5547#discussion_r1983217987


##########
artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java:
##########
@@ -352,10 +354,15 @@ public static KeyStore loadKeystore(final String 
keystoreProvider,
       return ks;
    }
 
-   public static void checkPemProviderLoaded(String keystoreType) {
+   /**
+    * This method uses reflection to load the appropriate 
java.security.Provider for PEM use-cases. Reflection is used
+    * to avoid a hard dependency on the provider's implementation so that 
folks who don't use PEM don't have to include
+    * the corresponding dependency.
+    */
+   public static void checkPemProviderLoaded(String keystoreType) throws 
Exception {
       if (keystoreType != null && keystoreType.startsWith("PEM")) {
          if (Security.getProvider("PEM") == null) {
-            Security.insertProviderAt(new 
de.dentrassi.crypto.pem.PemKeyStoreProvider(),
+            Security.insertProviderAt((Provider) 
Class.forName(PEM_PROVIDER).getDeclaredConstructor().newInstance(),

Review Comment:
   You could instead just move the original line (with wrapped next part) into 
a static method in its own sibling class, e.g PEMSupport.loadProvider() and 
then call out to it. That should then just work as intended, even without using 
reflection, because that class would not be initialized unless executing the 
method and so the related classes/dependency would then also not be referenced.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org
For additional commands, e-mail: gitbox-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact


Reply via email to