I am reading some path from xml file in static block. I have read one field from xml file and it was succesful. When I try to read second element from the same file, static block is not executed.
private static String path1 = "";
private static String path2 = "";
static{
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse("..."); // path of file
Element element = doc.getDocumentElement();
// if i open only this line, it works fine
path1 = UtilityFunctions.getStringValue(element, "path1");
// when i open this line all static block is not executed
path2 = UtilityFunctions.getStringValue(element, "path2");
}
Why static block is not executed when I add second line (path2 = ...) ?