mirror of https://github.com/apache/cassandra
fix npe if configURL is null (new URL(null) throws)
This commit is contained in:
parent
3047ab6387
commit
3fb2dcdf06
|
|
@ -38,9 +38,12 @@ public class SnitchProperties
|
||||||
String configURL = System.getProperty(RACKDC_PROPERTY_FILENAME);
|
String configURL = System.getProperty(RACKDC_PROPERTY_FILENAME);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
URL url = new URL(configURL);
|
URL url;
|
||||||
if (configURL == null)
|
if (configURL == null)
|
||||||
url = SnitchProperties.class.getClassLoader().getResource(RACKDC_PROPERTY_FILENAME);
|
url = SnitchProperties.class.getClassLoader().getResource(RACKDC_PROPERTY_FILENAME);
|
||||||
|
else
|
||||||
|
url = new URL(configURL);
|
||||||
|
|
||||||
stream = url.openStream(); // catch block handles potential NPE
|
stream = url.openStream(); // catch block handles potential NPE
|
||||||
properties.load(stream);
|
properties.load(stream);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue