Refactored config file resource loading to make it easier to load config files from class path when embedding.
This commit is contained in:
@@ -15,11 +15,15 @@
|
||||
*/
|
||||
package io.moquette.server.config;
|
||||
|
||||
import io.moquette.BrokerConstants;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.text.ParseException;
|
||||
import java.util.Properties;
|
||||
|
||||
@@ -100,6 +104,14 @@ class ConfigurationParser {
|
||||
} catch (IOException ex) {
|
||||
throw new ParseException("Failed to read", 1);
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
reader.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Properties getProperties() {
|
||||
|
||||
Reference in New Issue
Block a user