Advertisement
khermano

method loadProperties

Feb 26th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. static Properties loadProperties(String dirName, String fileName) {
  2. Properties properties = new Properties();
  3. if (dirName != null && fileName != null) {
  4. File dir = new File(dirName);
  5. File fileProp = new File(dir, fileName);
  6. if (fileProp.exists()) {
  7. try (InputStream is = new FileInputStream(fileProp)) {
  8. properties.load(is);
  9. } catch (IOException e) {
  10. throw new IllegalArgumentException("There was a problem with reading properties", e);
  11. }
  12. } else {
  13. log.warn("Missing config.properties file!");
  14. }
  15. }
  16. return properties;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement