diff options
Diffstat (limited to 'qpid/java')
3 files changed, 22 insertions, 5 deletions
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java index 0d291fb6ea..6dd6c58853 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java @@ -320,12 +320,12 @@ public class Broker implements BrokerShutdownProvider } } - private void populateSystemPropertiesFromDefaults(final String initialProperties) throws IOException + public static void populateSystemPropertiesFromDefaults(final String initialProperties) throws IOException { URL initialPropertiesLocation; if(initialProperties == null) { - initialPropertiesLocation = getClass().getClassLoader().getResource("system.properties"); + initialPropertiesLocation = Broker.class.getClassLoader().getResource("system.properties"); } else { @@ -335,7 +335,11 @@ public class Broker implements BrokerShutdownProvider Properties props = new Properties(QpidProperties.asProperties()); if(initialPropertiesLocation != null) { - props.load(initialPropertiesLocation.openStream()); + + try(InputStream inStream = initialPropertiesLocation.openStream()) + { + props.load(inStream); + } } Set<String> propertyNames = new HashSet<>(props.stringPropertyNames()); @@ -344,7 +348,6 @@ public class Broker implements BrokerShutdownProvider { System.setProperty(propName, props.getProperty(propName)); } - } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectFactoryImpl.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectFactoryImpl.java index 27d914c639..5026df0e19 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectFactoryImpl.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectFactoryImpl.java @@ -156,7 +156,7 @@ public class ConfiguredObjectFactoryImpl implements ConfiguredObjectFactory factory = categoryFactories.get(_defaultTypes.get(category)); if(factory == null) { - throw new NoFactoryForTypeException(category, _defaultTypes.get(category)); + throw new NoFactoryForTypeException(category, type); } } return factory; diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java index 9a3308603b..9bcc2cb3ae 100755 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java @@ -59,6 +59,7 @@ import org.apache.qpid.exchange.ExchangeDefaults; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.jms.BrokerDetails; import org.apache.qpid.jms.ConnectionURL; +import org.apache.qpid.server.Broker; import org.apache.qpid.server.BrokerOptions; import org.apache.qpid.server.configuration.BrokerProperties; import org.apache.qpid.server.configuration.updater.TaskExecutor; @@ -189,6 +190,19 @@ public class QpidBrokerTestCase extends QpidTestCase _brokerConfigurations = new HashMap<Integer, TestBrokerConfiguration>(); initialiseSpawnedBrokerLogConfigFile(); _brokerCommandTemplate = BROKER_COMMAND_TEMPLATE; + + + if (JAVA.equals(_brokerLanguage)) + { + try + { + Broker.populateSystemPropertiesFromDefaults(null); + } + catch (IOException ioe) + { + throw new RuntimeException("Failed to load Java broker system properties", ioe); + } + } } public TestBrokerConfiguration getBrokerConfiguration(int port) |
