Skip to content

Commit

Permalink
Fix behavior, method renames
Browse files Browse the repository at this point in the history
  • Loading branch information
evie-lau committed Oct 25, 2023
1 parent f1bbf20 commit 01ef106
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ private static void parseInclude(Document doc) throws XPathExpressionException,
continue;
}

ArrayList<Document> inclDocs = getIncludeDoc(includeFileName);
ArrayList<Document> inclDocs = getIncludeDocs(includeFileName);
for (Document inclDoc : inclDocs) {
parseApplication(inclDoc, XPATH_SERVER_APPLICATION);
parseApplication(inclDoc, XPATH_SERVER_WEB_APPLICATION);
Expand Down Expand Up @@ -427,7 +427,7 @@ private static void parseDropinsFile(File file) throws IOException, XPathExpress
}
}

private static ArrayList<Document> getIncludeDoc(String loc) throws IOException, SAXException {
private static ArrayList<Document> getIncludeDocs(String loc) throws IOException, SAXException {
ArrayList<Document> docs = new ArrayList<Document>();
Document doc = null;
File locFile = null;
Expand All @@ -442,7 +442,9 @@ private static ArrayList<Document> getIncludeDoc(String loc) throws IOException,
} else if (loc.startsWith("file:")) {
if (isValidURL(loc)) {
locFile = new File(loc);
parseDocumentFromFile(locFile, docs);
// While Java URIs support directories, the Liberty include implementation does not support them yet.
doc = parseDocument(locFile);
docs.add(doc);
}
} else if (loc.startsWith("ftp:")) {
// TODO handle ftp protocol
Expand All @@ -451,7 +453,7 @@ private static ArrayList<Document> getIncludeDoc(String loc) throws IOException,

// check if absolute file
if (locFile.isAbsolute()) {
parseDocumentFromFile(locFile, docs);
parseDocumentFromFileOrDirectory(locFile, docs);
} else {
// check configDirectory first if exists
if (configDirectory != null && configDirectory.exists()) {
Expand All @@ -461,7 +463,7 @@ private static ArrayList<Document> getIncludeDoc(String loc) throws IOException,
if (locFile == null || !locFile.exists()) {
locFile = new File(getServerXML().getParentFile(), loc);
}
parseDocumentFromFile(locFile, docs);
parseDocumentFromFileOrDirectory(locFile, docs);
}
}

Expand All @@ -479,7 +481,7 @@ private static ArrayList<Document> getIncludeDoc(String loc) throws IOException,
* @throws IOException
* @throws SAXException
*/
private static void parseDocumentFromFile(File file, ArrayList<Document> docs) throws FileNotFoundException, IOException, SAXException {
private static void parseDocumentFromFileOrDirectory(File file, ArrayList<Document> docs) throws FileNotFoundException, IOException, SAXException {
Document doc = null;
if (file == null || !file.exists()) {
log.warn("Unable to parse from file: " + file.getCanonicalPath());
Expand Down Expand Up @@ -617,7 +619,7 @@ private static void parseIncludeVariables(Document doc) throws XPathExpressionEx
continue;
}

ArrayList<Document> inclDocs = getIncludeDoc(includeFileName);
ArrayList<Document> inclDocs = getIncludeDocs(includeFileName);

for (Document inclDoc : inclDocs) {
parseVariablesForBothValues(inclDoc);
Expand Down

0 comments on commit 01ef106

Please sign in to comment.