Adding a validation step when searching for the application.properties

file
This commit is contained in:
Ryan Kurtz 2020-10-12 08:40:49 -04:00
parent ce78b860be
commit 1a50107af7

View file

@ -60,8 +60,21 @@ public class ApplicationUtilities {
try {
ResourceFile pathFile = new ResourceFile(new File(pathEntry).getCanonicalPath());
while (pathFile != null && pathFile.exists()) {
if (new ResourceFile(pathFile, ApplicationProperties.PROPERTY_FILE).exists()) {
return pathFile;
ResourceFile applicationPropertiesFile =
new ResourceFile(pathFile, ApplicationProperties.PROPERTY_FILE);
if (applicationPropertiesFile.exists()) {
try {
ApplicationProperties applicationProperties =
new ApplicationProperties(applicationPropertiesFile);
if (!applicationProperties.getApplicationName().isEmpty()) {
return pathFile;
}
}
catch (IOException e2) {
Msg.error(ApplicationUtilities.class,
"Failed to read: " + applicationPropertiesFile, e2);
break;
}
}
pathFile = pathFile.getParentFile();
}