1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| private ElementParam() {
super();
InputStream iStream = null;
// get the factory
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
iStream = getClass().getClassLoader().getResourceAsStream(configFilePath);
// Using factory get an instance of document builder
DocumentBuilder db = dbf.newDocumentBuilder();
// parse using builder to get DOM representation of the XML file
ivGevalConfig = db.parse(iStream);
} catch (Throwable t) {
log.error("Erreur while loading" + configFilePath, t);
} finally {
if (iStream != null) {
try {
iStream.close();
} catch (IOException e) {
log.error("Erreur while closing" + configFilePath, e);
}
}
}
} |