Using a destinationDotFilePlugin results in an ArrayStoreException
------------------------------------------------------------------
Key: AMQ-1508
URL: https://issues.apache.org/activemq/browse/AMQ-1508
Project: ActiveMQ
Issue Type: Bug
Components: Broker
Affects Versions: 4.1.1
Environment: Windows
ActiveMQ 4.1.1
Reporter: Peter Mortier
Priority: Minor
When you add a destinationDotFilePlugin to the activemq configuration, like
this:
<broker>
<plugins>
<destinationDotFilePlugin/>
</plugins>
...
</broker>
The Broker refuses to start up and crashes with ArrayStoreException:
ERROR BrokerService - Failed to start ActiveMQ JMS Message
Broker. Reason: java.lang.ArrayStoreExceptio
n
java.lang.ArrayStoreException
at java.lang.System.arraycopy(Native Method)
at java.util.ArrayList.toArray(ArrayList.java:304)
at
org.apache.activemq.broker.region.RegionBroker.getDestinations(RegionBroker.java:315)
at
org.apache.activemq.broker.BrokerFilter.getDestinations(BrokerFilter.java:149)
at
org.apache.activemq.broker.BrokerFilter.getDestinations(BrokerFilter.java:149)
at
org.apache.activemq.broker.BrokerFilter.getDestinations(BrokerFilter.java:149)
at
org.apache.activemq.broker.BrokerFilter.getDestinations(BrokerFilter.java:149)
at
org.apache.activemq.broker.view.DestinationDotFileInterceptor.generateFile(DestinationDotFileInterceptor.java:53)
at
org.apache.activemq.broker.view.DotFileInterceptorSupport.generateFile(DotFileInterceptorSupport.java:48)
at
org.apache.activemq.broker.view.DestinationDotFileInterceptor.addDestination(DestinationDotFileInterceptor.java:43)
at
org.apache.activemq.broker.MutableBrokerFilter.addDestination(MutableBrokerFilter.java:151)
at
org.apache.activemq.broker.BrokerService.startDestinations(BrokerService.java:1619)
at
org.apache.activemq.broker.BrokerService.start(BrokerService.java:410)
at
org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:46)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1201)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1171)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
The bug is in RegionBroker.getDestinations method:
public ActiveMQDestination[] getDestinations() throws Exception {
ArrayList l;
l = new ArrayList(destinations.values());
ActiveMQDestination rc[] = new ActiveMQDestination[l.size()];
l.toArray(rc);
return rc;
}
The destinations property is Map where the keys are ActiveMQDestinations and
the values are Destinations. Trying to convert a collection of Destinations to
an array of ActiveMQConnections throws the aforementioned exception.
The method should be changed to:
public ActiveMQDestination[] getDestinations() throws Exception {
ArrayList l;
l = new ArrayList(destinations.keySet());
ActiveMQDestination rc[] = new ActiveMQDestination[l.size()];
l.toArray(rc);
return rc;
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.