Difference between revisions of "Code Discussion 2008-11-03"
Jump to navigation
Jump to search
m |
m (→PropertyReader) |
||
Line 3: | Line 3: | ||
=PropertyReader= | =PropertyReader= | ||
== Current situation == | |||
<code> | |||
public static String getProperty(String key) throws IOException, URISyntaxException | |||
{ | |||
// First check system properties | |||
String value = System.getProperty(key); | |||
if (value != null) | |||
{ | |||
return value; | |||
} | |||
// Check properties file | |||
if (properties == null) | |||
{ | |||
loadProperties(); | |||
} | |||
// Get the property | |||
value = properties.getProperty(key); | |||
return value; | |||
} | |||
</code> | |||
== Problem == | |||
== Solution == | |||
==Next topic== | ==Next topic== |
Revision as of 10:41, 3 November 2008
Previous topic
PropertyReader
Current situation
public static String getProperty(String key) throws IOException, URISyntaxException
{
// First check system properties
String value = System.getProperty(key);
if (value != null)
{
return value;
}
// Check properties file
if (properties == null)
{
loadProperties();
}
// Get the property
value = properties.getProperty(key);
return value;
}