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.XPathExpressionException;
|
||||||
import javax.xml.xpath.XPathFactory;
|
import javax.xml.xpath.XPathFactory;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URL;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -172,13 +171,12 @@ public class DevelConfigLoader implements ConfigLoader {
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
Document doc;
|
Document doc;
|
||||||
try {
|
try {
|
||||||
String current = new java.io.File(".").getCanonicalPath();
|
is = getClass().getClassLoader().getResource(filePath).openStream();
|
||||||
is = new URL("file:///" + current + filePath).openStream();
|
|
||||||
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
|
||||||
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
|
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
|
||||||
doc = documentBuilder.parse(is);
|
doc = documentBuilder.parse(is);
|
||||||
return doc;
|
return doc;
|
||||||
} catch (IOException | ParserConfigurationException | SAXException e) {
|
} catch (IOException | ParserConfigurationException | SAXException | NullPointerException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue