From 2a233bc5d3aa3889fb52bfa86e6c4ed9853a868f Mon Sep 17 00:00:00 2001 From: Keith Armstrong Date: Thu, 16 Jan 2025 07:48:04 -0500 Subject: [PATCH] Just a general code cleanup --- src/com/belkast/soap/fileProcessor.java | 2 +- src/com/belkast/soap/jCommanderArgs.java | 9 ++------- src/com/belkast/soap/propertyProcessor.java | 4 ++++ src/com/belkast/soap/userVerify.java | 14 +++++++------- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/com/belkast/soap/fileProcessor.java b/src/com/belkast/soap/fileProcessor.java index 60edb48..8ce30bb 100644 --- a/src/com/belkast/soap/fileProcessor.java +++ b/src/com/belkast/soap/fileProcessor.java @@ -16,7 +16,7 @@ public class fileProcessor { public static String readFirstLine(String thisFile) throws IOException { File file = new File(thisFile); - Boolean isValid = validFile(thisFile); + boolean isValid = validFile(thisFile); if ( !isValid ) { diff --git a/src/com/belkast/soap/jCommanderArgs.java b/src/com/belkast/soap/jCommanderArgs.java index 9af6519..0d91811 100644 --- a/src/com/belkast/soap/jCommanderArgs.java +++ b/src/com/belkast/soap/jCommanderArgs.java @@ -2,13 +2,8 @@ package com.belkast.soap; import com.beust.jcommander.Parameter; -import java.util.ArrayList; -import java.util.List; - -public class jCommanderArgs { - @Parameter - private List parameters = new ArrayList<>(); - +public class jCommanderArgs +{ @Parameter(names = "--props" , description = "Location of the properties file", validateWith = jCommanderVerifyFile.class) public String props; diff --git a/src/com/belkast/soap/propertyProcessor.java b/src/com/belkast/soap/propertyProcessor.java index 059b72f..623b227 100644 --- a/src/com/belkast/soap/propertyProcessor.java +++ b/src/com/belkast/soap/propertyProcessor.java @@ -19,6 +19,10 @@ public class propertyProcessor { propertyValue = thisDefault; } + else + { + propertyValue = propertyValue.trim(); + } } catch (Exception e) { diff --git a/src/com/belkast/soap/userVerify.java b/src/com/belkast/soap/userVerify.java index e863f26..cdda86b 100644 --- a/src/com/belkast/soap/userVerify.java +++ b/src/com/belkast/soap/userVerify.java @@ -23,7 +23,7 @@ public class userVerify System.out.print(varPrompt); varFileName = myObj.nextLine(); File thisFile = new File(varFileName); - Boolean isValidFile = fileProcessor.validFile(varFileName); + boolean isValidFile = fileProcessor.validFile(varFileName); if ( thisFile.exists() && isValidFile ) { break; @@ -31,7 +31,7 @@ public class userVerify varPrompt = "\nThe CSV file does not exist or cannot be read!\nPlease enter the name of the CSV file to validate : "; } - Boolean varUserBlockEmpty = false; + boolean varUserBlockEmpty = false; HashMap valueMap = new HashMap(); valueMap.put("Y", true); @@ -73,9 +73,9 @@ public class userVerify } debugProcessor.writer(true, ""); } - boolean validfile = (!thisCSV.isEmpty()); + boolean validFile = (!thisCSV.isEmpty()); debugProcessor.writer(true, "CSV file records : " + varIter); - debugProcessor.writer(true, "CSV file is valid : " + validfile); + debugProcessor.writer(true, "CSV file is valid : " + validFile); System.out.println(); } @@ -92,8 +92,8 @@ public class userVerify } String exceptionReason = null; - Boolean failedOnException = false; - Boolean parsedCorrectly = false; + boolean failedOnException = false; + boolean parsedCorrectly = false; long lineNum = 0; while (!parsedCorrectly && !failedOnException) { @@ -133,7 +133,7 @@ public class userVerify boolean isValid = record.isConsistent(); int thisSize = record.size(); String thisLine = Files.readAllLines(Paths.get(thisFile)).get(Math.toIntExact(lineNum - 1)); - Boolean validValues = true; + boolean validValues = true; if (isValid) {