ARTEMIS-2066 LegacyJMSConfiguration parser may deploy non-jms queues

This commit is contained in:
Justin Bertram 2018-08-29 21:20:13 -05:00 committed by Clebert Suconic
parent f80e87768b
commit e7e5112d51
2 changed files with 8 additions and 6 deletions

View File

@ -17,9 +17,6 @@
package org.apache.activemq.artemis.core.config.impl;
import javax.management.MBeanServer;
import javax.xml.XMLConstants;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
@ -110,9 +107,11 @@ public class LegacyJMSConfiguration implements Deployable {
String xml = XMLUtil.readerToString(reader);
xml = XMLUtil.replaceSystemProps(xml);
Element e = XMLUtil.stringToElement(xml);
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = schemaFactory.newSchema(XMLUtil.findResource(CONFIGURATION_SCHEMA_URL));
parseConfiguration(e);
// only parse elements from <jms>
NodeList children = e.getElementsByTagName(CONFIGURATION_SCHEMA_ROOT_ELEMENT);
if (children.getLength() > 0) {
parseConfiguration(children.item(0));
}
}
/**

View File

@ -260,6 +260,9 @@ public class RedeployTest extends ActiveMQTestBase {
Assert.assertTrue(listQueuesNamesForAddress(embeddedActiveMQ, "config_test_queue_change").contains("config_test_queue_change_queue"));
Assert.assertEquals(1, getQueue(embeddedActiveMQ, "config_test_queue_change_queue").getMaxConsumers());
Assert.assertEquals(true, getQueue(embeddedActiveMQ, "config_test_queue_change_queue").isPurgeOnNoConsumers());
Assert.assertNull(getAddressInfo(embeddedActiveMQ, "config_test_queue_change_queue"));
Assert.assertNull(getAddressInfo(embeddedActiveMQ, "config_test_queue_removal_queue_1"));
} finally {
embeddedActiveMQ.stop();
}