Exemple #1
0
 /**
  * Read a specified node of the configuration
  *
  * @param part Node to read
  * @return String - Content of the node
  */
 private static String readConfig(String part) {
   try {
     if (!InternalConfigDummy.CONFIG_FILE.exists()) {
       ConfigurationFile.getDefaultContent().saveToFile(InternalConfigDummy.CONFIG_FILE);
       Log.logWarning("Couldn't find the configuration file. Writing default configuration...");
     }
     FileInputStream fis = new FileInputStream(InternalConfigDummy.CONFIG_FILE);
     Properties logProperties = new Properties();
     logProperties.load(fis);
     return logProperties.getProperty(InternalConfigDummy.CONFIG_LOG_PREFIX + part);
   } catch (Exception e) {
     Util.showPureError(
         "Couldn't read the configuration file. Exception is: "
             + e.getCause()
             + " Stacktrace is:"
             + Util.getLineSeparator()
             + Util.exceptionToString(e));
     System.exit(1);
   }
   return null;
 }