fix npe if configURL is null (new URL(null) throws)

This commit is contained in:
Dave Brosius 2014-05-03 16:39:16 -04:00
parent 3047ab6387
commit 3fb2dcdf06
1 changed files with 4 additions and 1 deletions

View File

@ -38,9 +38,12 @@ public class SnitchProperties
String configURL = System.getProperty(RACKDC_PROPERTY_FILENAME);
try
{
URL url = new URL(configURL);
URL url;
if (configURL == null)
url = SnitchProperties.class.getClassLoader().getResource(RACKDC_PROPERTY_FILENAME);
else
url = new URL(configURL);
stream = url.openStream(); // catch block handles potential NPE
properties.load(stream);
}