public Properties loadCfg(Properties properties, String propPath, boolean verbose) { InputStream is = null; try { is = new FileInputStream(propPath); properties.load(is); return properties; } catch (IOException e) { if (verbose) { log.error("Error loading property file", e); } } finally { if (is != null) try { is.close(); } catch (IOException e) { if (verbose) { log.error("Error closing property file", e); } } } return null; }
/** * Returns default configuration properties. This is read from property file embedded in agent jar * file. * * @return default configuration properties. */ public static Properties defaultProperties(String path) { Properties props = new Properties(); InputStream is = null; try { is = SlacConfig.class.getResourceAsStream(path); props.load(is); is.close(); } catch (IOException e) { log.error("Error loading property file", e); } finally { if (is != null) { try { is.close(); } catch (IOException e) { log.error("Error closing property file", e); } } } return props; }