Added check for valid properties file

This commit is contained in:
Keith Armstrong 2025-01-02 16:59:44 -05:00
parent 8b8e7ebab7
commit 383eaa5cd3

@ -70,8 +70,9 @@ public class webService {
System.exit(0);
}
if (!fileProcessor.getFile(varProps))
if (!fileProcessor.getFile(varProps) || !fileProcessor.validFile(varProps))
{
debugProcessor.writer(true, "Something went wrong. Please check that the properties file is correctly formatted!");
System.exit(0);
}
@ -85,11 +86,8 @@ public class webService {
private static void doSoap(File thisProps) throws Exception {
String varPassword = "";
String varDelimiter = propertyProcessor.getProperty(thisProps, "ARGUMENT_DELIMITER");
debugProcessor.writer(false, "Debug is set to : " + varDebug);
System.out.println();
String varURL = propertyProcessor.getProperty(thisProps, "SHIM_URL");
String varUsername = propertyProcessor.getProperty(thisProps, "USERNAME");
String varPasswordTemp = propertyProcessor.getProperty(thisProps, "PASSWORD");
@ -104,28 +102,24 @@ public class webService {
String varPropEmptyColumns = propertyProcessor.getProperty(thisProps, "CSV_ALLOW_EMPTY_COLUMN_VALUES");
Boolean varEmptyColumns = Boolean.valueOf(varPropEmptyColumns);
debugProcessor.writer(varDebug, thisProps + " => SOAP URL : " + varURL);
debugProcessor.writer(varDebug, thisProps + " => Username : " + varUsername);
debugProcessor.writer(varDebug, thisProps + " => Use SSL : " + varUseSSL);
debugProcessor.writer(varDebug, thisProps + " => JAVA keystore : " + varKeystore_LOC);
debugProcessor.writer(varDebug, thisProps + " => JAVA keystore password : " + varKeystore_PW);
debugProcessor.writer(varDebug, thisProps + " => XML file : " + varInputFile);
debugProcessor.writer(varDebug, thisProps + " => CSV file : " + varRoleFile);
debugProcessor.writer(varDebug, thisProps + " => CSV allow empty : " + varEmptyColumns);
try {
File checkInput = new File(varInputFile);
if (!checkInput.exists()) {
debugProcessor.writer(true, thisProps + " => The file specified in XML_FILE does not exist [ " + varInputFile + " ]");
System.exit(0);
}
File checkInput = new File (varInputFile);
if (!checkInput.exists())
{
debugProcessor.writer(true, thisProps + " => The file specified in XML_FILE does not exist [ " + varInputFile + " ]");
System.exit(0);
}
File checkRole = new File (varRoleFile);
if (!checkRole.exists())
{
File checkRole = new File(varRoleFile);
if (!checkRole.exists()) {
debugProcessor.writer(true, thisProps + " => The file specified in CSV_FILE does not exist [ " + varRoleFile + " ]");
System.exit(0);
}
}
catch (Exception e)
{
debugProcessor.writer(true, thisProps + " => Something went wrong. Please check that the properties file is correctly formatted!");
System.exit(0);
}
try {
varPassword = salter.decrypt(varPasswordTemp, varKey, varSalt);
@ -135,6 +129,16 @@ public class webService {
System.exit(0);
}
System.out.println();
debugProcessor.writer(varDebug, thisProps + " => SOAP URL : " + varURL);
debugProcessor.writer(varDebug, thisProps + " => Username : " + varUsername);
debugProcessor.writer(varDebug, thisProps + " => Use SSL : " + varUseSSL);
debugProcessor.writer(varDebug, thisProps + " => JAVA keystore : " + varKeystore_LOC);
debugProcessor.writer(varDebug, thisProps + " => JAVA keystore password : " + varKeystore_PW);
debugProcessor.writer(varDebug, thisProps + " => XML file : " + varInputFile);
debugProcessor.writer(varDebug, thisProps + " => CSV file : " + varRoleFile);
debugProcessor.writer(varDebug, thisProps + " => CSV allow empty : " + varEmptyColumns);
ArrayList thisCSV = userVerify.readCSV(varRoleFile, false, !varEmptyColumns);
boolean validfile = (!thisCSV.isEmpty());