Refactors file parsing on Config loader function.
This commit is contained in:
parent
2d56ff0676
commit
a88f423864
|
@ -24,7 +24,6 @@ import javax.xml.xpath.XPathConstants;
|
|||
import javax.xml.xpath.XPathExpressionException;
|
||||
import javax.xml.xpath.XPathFactory;
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
@ -172,13 +171,12 @@ public class DevelConfigLoader implements ConfigLoader {
|
|||
InputStream is = null;
|
||||
Document doc;
|
||||
try {
|
||||
String current = new java.io.File(".").getCanonicalPath();
|
||||
is = new URL("file:///" + current + filePath).openStream();
|
||||
is = getClass().getClassLoader().getResource(filePath).openStream();
|
||||
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
|
||||
doc = documentBuilder.parse(is);
|
||||
return doc;
|
||||
} catch (IOException | ParserConfigurationException | SAXException e) {
|
||||
} catch (IOException | ParserConfigurationException | SAXException | NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue