activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1480117 - /activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java
Date Tue, 07 May 2013 22:08:28 GMT
Author: tabish
Date: Tue May  7 22:08:28 2013
New Revision: 1480117

URL: http://svn.apache.org/r1480117
Log:
fix for: https://issues.apache.org/jira/browse/AMQ-4520

Load BouncyCastle if present in lib dir.

Modified:
    activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java

Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=1480117&r1=1480116&r2=1480117&view=diff
==============================================================================
--- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java
(original)
+++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java
Tue May  7 22:08:28 2013
@@ -24,6 +24,8 @@ import java.io.InputStreamReader;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.UnknownHostException;
+import java.security.Provider;
+import java.security.Security;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
@@ -235,6 +237,17 @@ public class BrokerService implements Se
     private boolean slave = true;
 
     static {
+
+        try {
+            ClassLoader loader = BrokerService.class.getClassLoader();
+            Class<?> clazz = loader.loadClass("org.bouncycastle.jce.provider.BouncyCastleProvider");
+            Provider bouncycastle = (Provider) clazz.newInstance();
+            Security.insertProviderAt(bouncycastle, 2);
+            LOG.info("Loaded the Bouncy Castle security provider.");
+        } catch(Throwable e) {
+            // No BouncyCastle found so we use the default Java Security Provider
+        }
+
         String localHostName = "localhost";
         try {
             localHostName =  InetAddressUtil.getLocalHostName();
@@ -545,6 +558,7 @@ public class BrokerService implements Se
                     MDC.put("activemq.broker", brokerName);
                 }
             }
+
             // in jvm master slave, lets not publish over existing broker till we get the
lock
             final BrokerRegistry brokerRegistry = BrokerRegistry.getInstance();
             if (brokerRegistry.lookup(getBrokerName()) == null) {



Mime
View raw message