You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2016/02/15 13:40:05 UTC
svn commit: r1730507 - in /qpid/java/branches/6.0.x: ./
broker-core/src/main/java/org/apache/qpid/server/BrokerOptions.java
broker-core/src/test/java/org/apache/qpid/server/BrokerOptionsTest.java
Author: orudyy
Date: Mon Feb 15 12:40:05 2016
New Revision: 1730507
URL: http://svn.apache.org/viewvc?rev=1730507&view=rev
Log:
QPID-7039: Throw an exception if resource overridden with JVM system property 'qpid.initialConfigurationLocation' does not exist
merged from trunk
svn merge -c 1730499 https://svn.apache.org/repos/asf/qpid/java/trunk
Modified:
qpid/java/branches/6.0.x/ (props changed)
qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/BrokerOptions.java
qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/BrokerOptionsTest.java
Propchange: qpid/java/branches/6.0.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Feb 15 12:40:05 2016
@@ -9,5 +9,5 @@
/qpid/branches/java-broker-vhost-refactor/java:1493674-1494547
/qpid/branches/java-network-refactor/qpid/java:805429-821809
/qpid/branches/qpid-2935/qpid/java:1061302-1072333
-/qpid/java/trunk:1715445-1715447,1715586,1715940,1716086-1716087,1716127-1716128,1716141,1716153,1716155,1716194,1716204,1716209,1716227,1716277,1716357,1716368,1716370,1716374,1716432,1716444-1716445,1716455,1716461,1716474,1716489,1716497,1716515,1716555,1716602,1716606-1716610,1716619,1716636,1717269,1717299,1717401,1717446,1717449,1717626,1717691,1717735,1717780,1718744,1718889,1718893,1718918,1718922,1719026,1719028,1719033,1719037,1719047,1719051,1720340,1720664,1721151,1721198,1722019-1722020,1722246,1722339,1722416,1722674,1722678,1722683,1722711,1723064,1723194,1723563,1724216,1724251,1724257,1724292,1724375,1724397,1724432,1724582,1724603,1724780,1724843-1724844,1725295,1725569,1725760,1726176,1726244-1726246,1726249,1726358,1726436,1726449,1726456,1726646,1726653,1726755,1726778,1727532,1727555,1727608,1727951,1728089,1728167,1728302,1728497,1728524,1728639,1728772,1729297,1729347,1729356,1729638,1729828,1729832,1729841,1729851,1729904,1729973,1730072,1730494
+/qpid/java/trunk:1715445-1715447,1715586,1715940,1716086-1716087,1716127-1716128,1716141,1716153,1716155,1716194,1716204,1716209,1716227,1716277,1716357,1716368,1716370,1716374,1716432,1716444-1716445,1716455,1716461,1716474,1716489,1716497,1716515,1716555,1716602,1716606-1716610,1716619,1716636,1717269,1717299,1717401,1717446,1717449,1717626,1717691,1717735,1717780,1718744,1718889,1718893,1718918,1718922,1719026,1719028,1719033,1719037,1719047,1719051,1720340,1720664,1721151,1721198,1722019-1722020,1722246,1722339,1722416,1722674,1722678,1722683,1722711,1723064,1723194,1723563,1724216,1724251,1724257,1724292,1724375,1724397,1724432,1724582,1724603,1724780,1724843-1724844,1725295,1725569,1725760,1726176,1726244-1726246,1726249,1726358,1726436,1726449,1726456,1726646,1726653,1726755,1726778,1727532,1727555,1727608,1727951,1728089,1728167,1728302,1728497,1728524,1728639,1728772,1729297,1729347,1729356,1729638,1729828,1729832,1729841,1729851,1729904,1729973,1730072,1730494,1730499
/qpid/trunk/qpid:796646-796653
Modified: qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/BrokerOptions.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/BrokerOptions.java?rev=1730507&r1=1730506&r2=1730507&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/BrokerOptions.java (original)
+++ qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/BrokerOptions.java Mon Feb 15 12:40:05 2016
@@ -21,6 +21,7 @@
package org.apache.qpid.server;
import java.io.File;
+import java.net.URL;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -28,6 +29,7 @@ import java.util.concurrent.ConcurrentHa
import java.util.concurrent.ConcurrentMap;
import org.apache.qpid.server.configuration.BrokerProperties;
+import org.apache.qpid.server.configuration.IllegalConfigurationException;
import org.apache.qpid.server.model.ConfiguredObject;
import org.apache.qpid.server.model.SystemConfig;
@@ -241,7 +243,13 @@ public class BrokerOptions
String overriddenDefaultConfigurationLocation = System.getProperty("qpid.initialConfigurationLocation");
if (overriddenDefaultConfigurationLocation != null)
{
- return BrokerOptions.class.getClassLoader().getResource(overriddenDefaultConfigurationLocation).toExternalForm();
+ URL resource = BrokerOptions.class.getClassLoader().getResource(overriddenDefaultConfigurationLocation);
+ if (resource == null)
+ {
+ throw new IllegalArgumentException(String.format("Initial configuration '%s' is not found",
+ overriddenDefaultConfigurationLocation));
+ }
+ return resource.toExternalForm();
}
return DEFAULT_INITIAL_CONFIG_LOCATION;
}
Modified: qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/BrokerOptionsTest.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/BrokerOptionsTest.java?rev=1730507&r1=1730506&r2=1730507&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/BrokerOptionsTest.java (original)
+++ qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/BrokerOptionsTest.java Mon Feb 15 12:40:05 2016
@@ -88,6 +88,20 @@ public class BrokerOptionsTest extends Q
assertEquals(BrokerOptions.DEFAULT_INITIAL_CONFIG_LOCATION, _options.getInitialConfigurationLocation());
}
+ public void testInitialConfigurationLocationOverrideWithJVMSystemPropertyToNonExistingResource()
+ {
+ setTestSystemProperty("qpid.initialConfigurationLocation", "non-existing");
+ try
+ {
+ _options.getInitialConfigurationLocation();
+ fail("IllegalArgumentException is expected");
+ }
+ catch(IllegalArgumentException e)
+ {
+ assertEquals("Initial configuration 'non-existing' is not found", e.getMessage());
+ }
+ }
+
public void testOverriddenInitialConfigurationLocation()
{
final String testConfigFile = "etc/mytestconfig.json";
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org