diff options
| author | Keith Wall <kwall@apache.org> | 2015-02-18 11:56:07 +0000 |
|---|---|---|
| committer | Keith Wall <kwall@apache.org> | 2015-02-18 11:56:07 +0000 |
| commit | 3f5cab26f9b4fdf299b8774a529948f0d25e25ad (patch) | |
| tree | c1fbc635526f7e9ba44b8412b6faf6908525c1a2 /qpid/java/broker-core | |
| parent | 01cc230ddd9d630c99bd27140297e31213821ae6 (diff) | |
| download | qpid-python-3f5cab26f9b4fdf299b8774a529948f0d25e25ad.tar.gz | |
QPID-6390: [Java System Tests] Ensure that Broker's system properties are loaded before the test begins to use the Model to create test config
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1660604 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-core')
| -rw-r--r-- | qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java | 11 | ||||
| -rw-r--r-- | qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectFactoryImpl.java | 2 |
2 files changed, 8 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; |
