activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r561815 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Date Wed, 01 Aug 2007 14:49:52 GMT
Author: rajdavies
Date: Wed Aug  1 07:49:48 2007
New Revision: 561815

URL: http://svn.apache.org/viewvc?view=rev&rev=561815
Log:
Added explicit error for badly formated broker name

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

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?view=diff&rev=561815&r1=561814&r2=561815
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Wed Aug  1 07:49:48 2007
@@ -549,13 +549,18 @@
 
     /**
      * Sets the name of this broker; which must be unique in the network
+     * @param brokerName 
      */
     public void setBrokerName(String brokerName) {
         if (brokerName == null) {
             throw new NullPointerException("The broker name cannot be null");
         }
-        brokerName = brokerName.trim();
-        this.brokerName = brokerName;
+        String str = brokerName.replaceAll("[^a-zA-Z0-9\\.\\_\\-\\:]", "_");
+        if (!str.equals(brokerName)) {
+            log.error("Broker Name: " + brokerName + " contained illegal characters - replaced
with " + str);
+        }
+        this.brokerName = str.trim();
+        
     }
 
     public PersistenceAdapterFactory getPersistenceFactory() {
@@ -573,7 +578,7 @@
     }
 
     public File getBrokerDataDirectory() {
-        String brokerDir = getBrokerName().replaceAll("[^a-zA-Z0-9\\.\\_\\-]", "_");
+        String brokerDir = getBrokerName();
         return new File(getDataDirectoryFile(), brokerDir);
     }
 



Mime
View raw message