diff options
-rw-r--r-- | src/main/java/com/mavlushechka/animarfo/App.java | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/main/java/com/mavlushechka/animarfo/App.java b/src/main/java/com/mavlushechka/animarfo/App.java index 897f4d6..7c5baad 100644 --- a/src/main/java/com/mavlushechka/animarfo/App.java +++ b/src/main/java/com/mavlushechka/animarfo/App.java @@ -1,9 +1,7 @@ package com.mavlushechka.animarfo; import com.mavlushechka.animarfo.telegram.bot.Bot; -import org.jetbrains.annotations.NotNull; -import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; @@ -12,10 +10,16 @@ import java.util.logging.LogManager; import java.util.logging.Logger; public class App { - public static final Properties PROPERTIES = loadProperties(new File("src/main/resources/app.properties")); + public static final Properties PROPERTIES = new Properties(); private static final Logger LOGGER = Logger.getLogger(App.class.getName()); static { + try (FileInputStream fileInputStream = new FileInputStream("src/main/resources/app.properties")) { + PROPERTIES.load(fileInputStream); + } catch (IOException ioException) { + ioException.printStackTrace(); + } + try (FileInputStream fileInputStream = new FileInputStream("log.config")) { LogManager.getLogManager().readConfiguration(fileInputStream); } catch (IOException ioException) { @@ -29,17 +33,4 @@ public class App { LOGGER.info("Trying to start bot"); Bot.start(); } - - @NotNull - private static Properties loadProperties(File file) { - Properties properties = new Properties(); - - try (FileInputStream fileInputStream = new FileInputStream(file)) { - properties.load(fileInputStream); - } catch (IOException ioException) { - ioException.printStackTrace(); - } - - return properties; - } } |