in commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteUtils.java [200:254]
public static Properties loadProps(final String propFile)
throws IOException
{
InputStream is = RemoteUtils.class.getResourceAsStream(propFile);
// Try root of class path
if (null == is && !propFile.startsWith("/"))
{
is = RemoteUtils.class.getResourceAsStream("/" + propFile);
}
if (null == is) // not found in class path
{
final Path propPath = Paths.get(propFile);
if (Files.exists(propPath))
{
// file found
is = Files.newInputStream(propPath);
}
else
{
// try URL
is = new URL(propFile).openStream();
}
}
final Properties props = new Properties();
try
{
props.load(is);
log.debug("props.size={0}", props::size);
if (log.isTraceEnabled())
{
final StringBuilder buf = new StringBuilder();
props.forEach((key, value)
-> buf.append('\n').append(key).append(" = ").append(value));
log.trace(buf.toString());
}
}
catch (final IOException ex)
{
log.error("Error loading remote properties, for file name "
+ "[{0}]", propFile, ex);
}
finally
{
if (is != null)
{
is.close();
}
}
return props;
}